js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-06.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 // obj.getOwnPropertyDescriptor works when obj is a transparent cross-compartment wrapper.
     3 var g1 = newGlobal();
     4 var g2 = newGlobal();
     5 g1.next = g2;
     7 // This test is a little hard to follow, especially the !== assertions.
     8 //
     9 // Bottom line: the value of a property of g1 can only be an object in g1's
    10 // compartment, so any Debugger.Objects obtained by calling
    11 // g1obj.getOwnPropertyDescriptor should all have referents in g1's
    12 // compartment.
    14 var dbg = new Debugger;
    15 var g1obj = dbg.addDebuggee(g1);
    16 var g2obj = dbg.addDebuggee(g2);
    17 var wobj = g1obj.getOwnPropertyDescriptor("next").value;
    18 assertEq(wobj instanceof Debugger.Object, true);
    19 assertEq(wobj !== g2obj, true);  // referents are in two different compartments
    21 g2.x = "ok";
    22 assertEq(wobj.getOwnPropertyDescriptor("x").value, "ok");
    24 g1.g2min = g2.min = g2.Math.min;
    25 g2.eval("Object.defineProperty(this, 'y', {get: min});");
    26 assertEq(g2.y, Infinity);
    27 var wmin = wobj.getOwnPropertyDescriptor("y").get;
    28 assertEq(wmin !== g2obj.getOwnPropertyDescriptor("min").value, true);  // as above
    29 assertEq(wmin, g1obj.getOwnPropertyDescriptor("g2min").value);

mercurial