summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/realms/proxy-realm.js
blob: 00d984dd404cb723569093952fb6404d3a5be150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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);