summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js')
-rw-r--r--js/src/tests/test262/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js b/js/src/tests/test262/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js
new file mode 100644
index 0000000000..83e4f8c6ff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js
@@ -0,0 +1,28 @@
+// |reftest| shell-option(--enable-shadow-realms) skip-if(!xulRuntime.shell) -- requires shell-options
+// 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((new Proxy(proxyCallable, {}))(), 42, 'wrapped functions can be proxied');
+
+reportCompare(0, 0);