summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/preserve-iscallable-isconstructor.js
blob: 2ffded36c8ae32840bbe3f50741f507969c7c227 (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()
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);