js/src/jit-test/tests/debug/Environment-setVariable-12.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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);

mercurial