js/src/jit-test/tests/debug/breakpoint-gc-04.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 // Enabled debuggers keep breakpoint handlers alive.
     3 var g = newGlobal();
     4 g.eval("var line0 = Error().lineNumber;\n" +
     5        "function f() {\n" +     // line0 + 1
     6        "    return 2;\n" +      // line0 + 2
     7        "}\n");
     8 var N = 4;
     9 var hits = 0;
    10 for (var i = 0; i < N; i++) {
    11     var dbg = Debugger(g);
    12     dbg.onDebuggerStatement = function (frame) {
    13         var handler = {hit: function () { hits++; }};
    14         var s = frame.eval("f").return.script;
    15         var offs = s.getLineOffsets(g.line0 + 2);
    16         for (var j = 0; j < offs.length; j++)
    17             s.setBreakpoint(offs[j], handler);
    18     };
    19 }
    20 g.eval('debugger;');
    21 gc({});
    22 assertEq(g.f(), 2);
    23 assertEq(hits, N);

mercurial