summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/testDirectProxySetInherited.js
blob: 9c8c880938146dcd66bbf8ac59d115bcf12f2057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// When assigning to an object with a proxy is on the prototype chain,
// the proxy's set handler is called.

var C = {};
var B = new Proxy(C, {
    get() { throw "FAIL"; },
    getOwnPropertyDescriptor() { throw "FAIL"; },
    has() { throw "FAIL"; },
    defineProperty() { throw "FAIL"; },
    set(target, id, value, receiver) {
        hits++;
        assertEq(target, C);
        assertEq(id, "x");
        assertEq(value, 3);
        assertEq(receiver, A);
        return true;
    }
});
var A = Object.create(B);

var hits = 0;
A.x = 3;
assertEq(hits, 1);