summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/preserve-iscallable-isconstructor.js
blob: f1c84e2065c3bc81196b32bb6a99db3c75fdd8af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
load(libdir + "asserts.js");

var global = newGlobal({newCompartment: true})
var fun = global.eval("(function() {})")
var p = new Proxy(fun, {})

// Nuking should preserve IsCallable and IsConstructor.
assertEq(isConstructor(p), true);
assertEq(typeof p, "function");
nukeCCW(fun);
assertEq(isConstructor(p), true);
assertEq(typeof p, "function");

// But actually calling and constructing should throw, because it's been
// nuked.
assertThrowsInstanceOf(() => { p(); }, TypeError);
assertThrowsInstanceOf(() => { new p(); }, TypeError);