js/src/jit-test/tests/debug/breakpoint-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 // Basic breakpoint test.
     3 var g = newGlobal();
     4 g.s = '';
     5 var handler = {
     6     hit: function (frame) {
     7         assertEq(this, handler);
     8         g.s += '1';
     9     }
    10 };
    11 var dbg = Debugger(g);
    12 dbg.onDebuggerStatement = function (frame) {
    13     g.s += '0';
    14     var line0 = frame.script.getOffsetLine(frame.offset);
    15     var offs = frame.script.getLineOffsets(line0 + 2);
    16     for (var i = 0; i < offs.length; i++)
    17         frame.script.setBreakpoint(offs[i], handler);
    18 };
    19 g.eval("debugger;\n" +
    20        "s += 'a';\n" +  // line0 + 1
    21        "s += 'b';\n");  // line0 + 2
    22 assertEq(g.s, "0a1b");

mercurial