Debian Codegraph @

js/src/jit-test/tests/proxy/testDirectProxyConstruct2.js

raw
1 load(libdir + "asserts.js");
2 /*
3 * Call the trap with the handler as the this value, the target as the first
4 * argument, and the original arguments as the third argument.
5 *
6 * Hooks that don't return an object must throw.
7 */
8 var p;
9 var target = function () {};
10 var handler = {
11 construct: function (target1, args, newTarget) {
12 assertEq(this, handler);
13 assertEq(target1, target);
14 assertEq(args.length, 2);
15 assertEq(args[0], 2);
16 assertEq(args[1], 3);
17 assertEq(newTarget, p);
18 }
19 }
20 for (p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy])
21 assertThrowsInstanceOf(function () {new p(2, 3)}, TypeError);