Debian Codegraph @

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

raw
1 // Bug 1133094 - Proxy.[[DefineOwnProperty]]() should not throw when asked to
2 // define a configurable accessor property over an existing configurable data
3 // property on the target, even if the trap leaves the target unchanged.
4
5 var hits = 0;
6 var p = new Proxy({x: 1}, {
7 defineProperty(t, k, desc) {
8 // don't bother redefining the existing property t.x
9 hits++;
10 return true;
11 }
12 });
13
14 assertEq(Object.defineProperty(p, "x", {get: function () {}}), p);
15 assertEq(hits, 1);
16 assertEq(p.x, 1);