Debian Codegraph @

js/src/jit-test/tests/basic/bug1106982.js

raw
1 var x = "wrong";
2 var t = {x: "x"};
3 var hits = 0;
4 var p = new Proxy(t, {
5 has(t, id) {
6 var found = id in t;
7 if (++hits == 2)
8 delete t[id];
9 return found;
10 },
11 get(t, id) { return t[id]; }
12 });
13 with (p)
14 x += " x";
15 // If you change this testcase (e.g. because we fix the number of
16 // has() calls we end up making to match spec better), don't forget to
17 // update bug1106982-2.js too. See also bug 1145641.
18 assertEq(hits, 2);
19 assertEq(t.x, "undefined x");