js/src/jit-test/tests/debug/cross-context-2.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 debugger can eval in any frame in the stack even if every frame was
     2 // pushed in a different context.
     4 var g = newGlobal();
     5 g.eval('function f(a) {\n' +
     6        '    if (a == 1)\n' +
     7        '        debugger;\n' +
     8        '    else\n' +
     9        '        evaluate("f(" + a + " - 1);", {newContext: true});\n' +
    10        '}\n');
    11 var N = 9;
    13 var dbg = new Debugger(g);
    14 var frames = [];
    15 var hits = 0;
    16 dbg.onEnterFrame = function (frame) {
    17     if (frame.type == "call" && frame.callee.name == "f") {
    18         frames.push(frame);
    19         frame.onPop = function () { assertEq(frames.pop(), frame); };
    20     }
    21 };
    22 dbg.onDebuggerStatement = function (frame) {
    23     assertEq(frames.length, N);
    24     var i = N;
    25     for (var f of frames)
    26         assertEq(f.eval('a').return, i--);
    27     hits++;
    28 };
    30 g.f(N);
    31 assertEq(hits, 1);
    32 assertEq(frames.length, 0);

mercurial