Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // setVariable can create a new property on a with block's bindings object, if
2 // it is shadowing an existing property on the prototype chain.
4 var g = newGlobal();
5 var dbg = Debugger(g);
6 dbg.onDebuggerStatement = function (frame) {
7 var env = frame.environment.find("x");
8 env.setVariable("x", 2);
9 };
10 g.eval("var obj1 = {x: 1}, obj2 = Object.create(obj1), z; with (obj2) { debugger; z = x; }");
11 assertEq(g.obj1.x, 1);
12 assertEq(g.obj2.x, 2);
13 assertEq(g.z, 2);
15 // The property created by setVariable is like the one created by ordinary
16 // assignment in a with-block.
17 var desc = Object.getOwnPropertyDescriptor(g.obj2, "x");
18 assertEq(desc.configurable, true);
19 assertEq(desc.enumerable, true);
20 assertEq(desc.writable, true);
21 assertEq(desc.value, 2);