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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/proxy/testDirectProxyConstruct2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,18 @@
     1.4 +load(libdir + "asserts.js");
     1.5 +/*
     1.6 + * Call the trap with the handler as the this value, the target as the first
     1.7 + * argument, and the original arguments as the third argument.
     1.8 + *
     1.9 + * Hooks that don't return an object must throw.
    1.10 + */
    1.11 +var target = function () {};
    1.12 +var handler = {
    1.13 +    construct: function (target1, args) {
    1.14 +        assertEq(this, handler);
    1.15 +        assertEq(target1, target);
    1.16 +        assertEq(args.length, 2);
    1.17 +        assertEq(args[0], 2);
    1.18 +        assertEq(args[1], 3);
    1.19 +    }
    1.20 +}
    1.21 +assertThrowsInstanceOf(function () {new (new Proxy(target, handler))(2, 3)}, TypeError);

mercurial