js/src/jit-test/tests/debug/breakpoint-multi-01.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 // A single Debugger object can set multiple breakpoints at an instruction.
     3 var g = newGlobal();
     4 var dbg = Debugger(g);
     5 var log = '';
     6 dbg.onDebuggerStatement = function (frame) {
     7     log += 'D';
     8     function handler(i) {
     9         return {hit: function (frame) { log += '' + i; }};
    10     }
    11     var f = frame.eval("f").return;
    12     var s = f.script;
    13     var offs = s.getLineOffsets(g.line0 + 2);
    14     for (var i = 0; i < 10; i++) {
    15         var bp = handler(i);
    16         for (var j = 0; j < offs.length; j++)
    17             s.setBreakpoint(offs[j], bp);
    18     }
    19     assertEq(f.call().return, 42);
    20     log += 'X';
    21 };
    23 g.eval("var line0 = Error().lineNumber;\n" +
    24        "function f() {\n" +  // line0 + 1
    25        "    return 42;\n" +  // line0 + 2
    26        "}\n" +
    27        "debugger;\n");
    28 assertEq(log, 'D0123456789X');

mercurial