1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:57:44 +00:00

LibJS: Implement & use the {Ordinary,PrepareFor}WrappedFunctionCall AOs

This is a normative change in the ShadowRealm spec.

See: 5a3aae8
This commit is contained in:
Linus Groh 2022-07-31 12:13:33 +02:00
parent 5a281336c5
commit fed1498824
3 changed files with 102 additions and 13 deletions

View file

@ -130,4 +130,20 @@ describe("errors", () => {
shadowRealm.evaluate("(() => { throw 42; })()");
}).toThrowWithMessage(TypeError, "The evaluated script did not complete normally");
});
test("TypeError from revoked proxy is associated to caller realm", () => {
const shadowRealm = new ShadowRealm();
shadowRealm.evaluate("p = Proxy.revocable(() => {}, {}); undefined");
const proxy = shadowRealm.evaluate("p.proxy");
const revoke = shadowRealm.evaluate("p.revoke");
const ShadowRealmTypeError = shadowRealm.evaluate("TypeError");
revoke();
try {
proxy();
expect.fail();
} catch (e) {
expect(e.constructor).toBe(TypeError);
expect(e.constructor).not.toBe(ShadowRealmTypeError);
}
});
});