diff --git a/test/built-ins/ShadowRealm/prototype/evaluate/nested-realms.js b/test/built-ins/ShadowRealm/prototype/evaluate/nested-realms.js index a76d9050c7..4868af9b3f 100644 --- a/test/built-ins/ShadowRealm/prototype/evaluate/nested-realms.js +++ b/test/built-ins/ShadowRealm/prototype/evaluate/nested-realms.js @@ -7,6 +7,12 @@ description: > features: [ShadowRealm] ---*/ +assert.sameValue( + typeof ShadowRealm.prototype.evaluate, + 'function', + 'This test must fail if ShadowRealm.prototype.evaluate is not a function' +); + globalThis.myValue = 'a'; const realm1 = new ShadowRealm(); diff --git a/test/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js b/test/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js new file mode 100644 index 0000000000..db194c6809 --- /dev/null +++ b/test/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js @@ -0,0 +1,25 @@ +// Copyright (C) 2021 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-shadowrealm.prototype.evaluate +description: > + ShadowRealm.prototype.evaluate wrapped proxy callable object. +features: [ShadowRealm] +---*/ + +assert.sameValue( + typeof ShadowRealm.prototype.evaluate, + 'function', + 'This test must fail if ShadowRealm.prototype.evaluate is not a function' +); + +const r = new ShadowRealm(); + +const proxyCallable = r.evaluate(` +function fn() { return 42; } +new Proxy(fn, {}); +`); + +assert.sameValue(typeof proxyCallable, 'function', 'wrapped proxy callable object is typeof function'); +assert.sameValue(proxyCallable(), 42, 'wrappedpfn() returns 42'); +assert.sameValue(proxyCallable instanceof Proxy, false, 'the wrapped function "hides" the proxy instance'); diff --git a/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-multiple-different-realms-nested.js b/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-multiple-different-realms-nested.js index 56d76c51d4..8ea9a726ba 100644 --- a/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-multiple-different-realms-nested.js +++ b/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-multiple-different-realms-nested.js @@ -6,6 +6,11 @@ description: > ShadowRealm can wrap a function to multiple nested realms. features: [ShadowRealm] ---*/ +assert.sameValue( + typeof ShadowRealm.prototype.evaluate, + 'function', + 'This test must fail if ShadowRealm.prototype.evaluate is not a function' +); globalThis.count = 0; const realm1 = new ShadowRealm();