michael@0: load(libdir + "asserts.js"); michael@0: /* michael@0: * Call the trap with the handler as the this value, the target as the first michael@0: * argument, and the original arguments as the third argument. michael@0: * michael@0: * Hooks that don't return an object must throw. michael@0: */ michael@0: var target = function () {}; michael@0: var handler = { michael@0: construct: function (target1, args) { michael@0: assertEq(this, handler); michael@0: assertEq(target1, target); michael@0: assertEq(args.length, 2); michael@0: assertEq(args[0], 2); michael@0: assertEq(args[1], 3); michael@0: } michael@0: } michael@0: assertThrowsInstanceOf(function () {new (new Proxy(target, handler))(2, 3)}, TypeError);