summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/testDirectProxyDefineProperty6.js
blob: 9818257e0c607f78dc1b9f2774f47b7c28a808cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Bug 1133094 - Proxy.[[DefineOwnProperty]]() should not throw when asked to
// define a configurable accessor property over an existing configurable data
// property on the target, even if the trap leaves the target unchanged.

var hits = 0;
var p = new Proxy({x: 1}, {
    defineProperty(t, k, desc) {
        // don't bother redefining the existing property t.x
        hits++;
        return true;
    }
});

assertEq(Object.defineProperty(p, "x", {get: function () {}}), p);
assertEq(hits, 1);
assertEq(p.x, 1);