diff --git a/README.md b/README.md index 1b06d5d..40b28a3 100644 --- a/README.md +++ b/README.md @@ -355,7 +355,7 @@ The basic principle is: **The caller is responsible for disposing all stubs.** T * Stubs passed in the params of a call remain property of the caller, and must be disposed by the caller, not by the callee. * Stubs returned in the result of a call have their ownership transferred from the callee to the caller, and must be disposed by the caller. -In practice, though, the callee and caller do not actually share the same stubs. When stubs are passed over RPC, they are _duplicated_, and the the target object is only disposed when all duplicates of the stub are disposed. Thus, to achieve the rule that only the caller needs to dispose stubs, the RPC system implicitly disposes the callee's duplicates of all stubs when the call completes. That is: +In practice, though, the callee and caller do not actually share the same stubs. When stubs are passed over RPC, they are _duplicated_, and the target object is only disposed when all duplicates of the stub are disposed. Thus, to achieve the rule that only the caller needs to dispose stubs, the RPC system implicitly disposes the callee's duplicates of all stubs when the call completes. That is: * Any stubs the callee receives in the parameters are implicitly disposed when the call completes. * Any stubs returned in the results are implicitly disposed some time after the call completes. (Specifically, the RPC system will dispose them once it knows there will be no more pipelined calls.) @@ -382,7 +382,7 @@ Note that if you pass the same `RpcTarget` instance to RPC multiple times -- thu ### Listening for disconnect -You can monitor any stub for "brokennness" with its `onRpcBroken()` method: +You can monitor any stub for "brokenness" with its `onRpcBroken()` method: ```ts stub.onRpcBroken((error: any) => { diff --git a/SECURITY.md b/SECURITY.md index 30d9f78..89c981c 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -7,7 +7,7 @@ https://www.cloudflare.com/disclosure * https://hackerone.com/cloudflare * All Cloudflare products are in scope for reporting. If you submit a valid report on bounty-eligible assets through our disclosure program, we will transfer your report to our private bug bounty program and invite you as a participant. * `mailto:security@cloudflare.com` - * If you'd like to encrypt your message, please do so within the the body of the message. Our email system doesn't handle PGP-MIME well. + * If you'd like to encrypt your message, please do so within the body of the message. Our email system doesn't handle PGP-MIME well. * https://www.cloudflare.com/gpg/security-at-cloudflare-pubkey-06A67236.txt All abuse reports should be submitted to our Trust & Safety team through our dedicated page: https://www.cloudflare.com/abuse/ diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index 3e3b23d..f551d15 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -270,20 +270,20 @@ describe("local stub", () => { expect(await outerStub.innerTarget.square(3)).toBe(9); }); - it("returns undefined when accessing non-existent properties", async () => { + it("returns undefined when accessing nonexistent properties", async () => { let objectStub = new RpcStub({foo: "bar"}); let arrayStub = new RpcStub([1, 2, 3]); let targetStub = new RpcStub(new TestTarget()); - expect(await (objectStub as any).nonExistent).toBe(undefined); - expect(await (arrayStub as any).nonExistent).toBe(undefined); - expect(await (targetStub as any).nonExistent).toBe(undefined); + expect(await (objectStub as any).nonexistent).toBe(undefined); + expect(await (arrayStub as any).nonexistent).toBe(undefined); + expect(await (targetStub as any).nonexistent).toBe(undefined); // Accessing a property of undefined should throw TypeError (but the error message differs // across runtimes). - await expect(() => (objectStub as any).nonExistent.foo).rejects.toThrow(TypeError); - await expect(() => (arrayStub as any).nonExistent.foo).rejects.toThrow(TypeError); - await expect(() => (targetStub as any).nonExistent.foo).rejects.toThrow(TypeError); + await expect(() => (objectStub as any).nonexistent.foo).rejects.toThrow(TypeError); + await expect(() => (arrayStub as any).nonexistent.foo).rejects.toThrow(TypeError); + await expect(() => (targetStub as any).nonexistent.foo).rejects.toThrow(TypeError); }); it("exposes only prototype properties for RpcTarget, not instance properties", async () => { diff --git a/__tests__/workerd.test.ts b/__tests__/workerd.test.ts index 980a9b3..3e69a00 100644 --- a/__tests__/workerd.test.ts +++ b/__tests__/workerd.test.ts @@ -217,7 +217,7 @@ describe("workerd compatibility", () => { } }) - it("can wrap a SerivceStub in an RpcStub", async () => { + it("can wrap a ServiceStub in an RpcStub", async () => { let result = await new RpcStub((env).testServer).greet("World"); expect(result).toBe("Hello, World!"); });