js/src/jit-test/tests/debug/breakpoint-multi-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 // Multiple Debugger objects can set breakpoints at the same instruction.
     3 var g = newGlobal();
     4 function attach(g, i) {
     5     var dbg = Debugger(g);
     6     dbg.onDebuggerStatement = function (frame) {
     7         var s = frame.eval("f").return.script;
     8         var offs = s.getLineOffsets(g.line0 + 3);
     9         for (var j = 0; j < offs.length; j++)
    10             s.setBreakpoint(offs[j], {hit: function () { g.log += "" + i; }});
    11     };
    12 }
    14 g.eval("var line0 = Error().lineNumber;\n" +
    15        "function f() {\n" +     // line0 + 1
    16        "    log += 'a';\n" +    // line0 + 2
    17        "    log += 'b';\n" +    // line0 + 3
    18        "}\n");
    20 for (var i = 0; i < 3; i++)
    21     attach(g, i);
    23 g.log = '';
    24 g.eval('debugger;');
    25 g.log += 'x';
    26 g.f();
    27 assertEq(g.log, 'xa012b');

mercurial