js/src/jit-test/tests/debug/Object-identity-03.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 // The same object gets the same Debugger.Object wrapper at different times, if the difference would be observable.
     3 var N = 12;
     5 var g = newGlobal();
     6 var dbg = Debugger(g);
     7 var wrappers = [];
     9 dbg.onDebuggerStatement = function (frame) { wrappers.push(frame.arguments[0]); };
    10 g.eval("var originals = []; function f(x) { originals.push(x); debugger; }");
    11 for (var i = 0; i < N; i++)
    12     g.eval("f({});");
    13 assertEq(wrappers.length, N);
    15 for (var i = 0; i < N; i++)
    16     for (var j = i + 1; j < N; j++)
    17         assertEq(wrappers[i] === wrappers[j], false);
    19 gc();
    21 dbg.onDebuggerStatement = function (frame) { assertEq(frame.arguments[0], wrappers.pop()); };
    22 g.eval("function h(x) { debugger; }");
    23 for (var i = 0; i < N; i++)
    24     g.eval("h(originals.pop());");
    25 assertEq(wrappers.length, 0);

mercurial