js/src/jit-test/tests/proxy/testDirectProxySet2.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/testDirectProxySet2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +/*
     1.5 + * Call the trap with the handler as the this value, the target as the first
     1.6 + * argument, the name of the property as the second argument, the value as the
     1.7 + * third argument, and the receiver as the fourth argument
     1.8 + */
     1.9 +var target = {};
    1.10 +var called = false;
    1.11 +var handler = {
    1.12 +    set: function (target1, name, val, receiver) {
    1.13 +        assertEq(this, handler);
    1.14 +        assertEq(target1, target);
    1.15 +        assertEq(name, 'foo');
    1.16 +        assertEq(val, 'baz');
    1.17 +        assertEq(receiver, proxy);
    1.18 +        called = true;
    1.19 +    }
    1.20 +};
    1.21 +var proxy = new Proxy(target, handler);
    1.22 +proxy['foo'] = 'baz';
    1.23 +assertEq(called, true);

mercurial