Debian Codegraph @

js/src/jit-test/tests/proxy/preserve-iscallable-isconstructor.js

raw
1 load(libdir + "asserts.js");
2
3 var global = newGlobal({newCompartment: true})
4 var fun = global.eval("(function() {})")
5 var p = new Proxy(fun, {})
6
7 // Nuking should preserve IsCallable and IsConstructor.
8 assertEq(isConstructor(p), true);
9 assertEq(typeof p, "function");
10 nukeCCW(fun);
11 assertEq(isConstructor(p), true);
12 assertEq(typeof p, "function");
13
14 // But actually calling and constructing should throw, because it's been
15 // nuked.
16 assertThrowsInstanceOf(() => { p(); }, TypeError);
17 assertThrowsInstanceOf(() => { new p(); }, TypeError);