summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/realms/proxy-realm.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/realms/proxy-realm.js')
-rw-r--r--js/src/jit-test/tests/realms/proxy-realm.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/realms/proxy-realm.js b/js/src/jit-test/tests/realms/proxy-realm.js
new file mode 100644
index 0000000000..00d984dd40
--- /dev/null
+++ b/js/src/jit-test/tests/realms/proxy-realm.js
@@ -0,0 +1,14 @@
+// Based on a test written by André Bargull (bug 1297179).
+
+load(libdir + "asserts.js");
+
+var g = newGlobal({sameCompartmentAs: this});
+var {proxy, revoke} = g.eval(`Proxy.revocable(function(){}, {})`);
+
+revoke();
+
+assertEq(objectGlobal(proxy), g);
+assertThrowsInstanceOf(() => proxy(), TypeError);
+assertThrowsInstanceOf(() => new proxy(), TypeError);
+assertThrowsInstanceOf(() => proxy.foo, TypeError);
+assertThrowsInstanceOf(() => proxy.foo = 1, TypeError);