js/src/jit-test/tests/debug/Script-getOffsetLine-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 getOffsetLine test, using Error.lineNumber as the gold standard.
     3 var g = newGlobal();
     4 var dbg = Debugger(g);
     5 var hits;
     6 dbg.onDebuggerStatement = function (frame) {
     7     var knownLine = frame.eval("line").return;
     8     assertEq(frame.script.getOffsetLine(frame.offset), knownLine);
     9     hits++;
    10 };
    12 hits = 0;
    13 g.eval("var line = new Error().lineNumber; debugger;");
    14 assertEq(hits, 1);
    16 hits = 0;
    17 g.eval("var s = 2 + 2;\n" +
    18        "s += 2;\n" +
    19        "line = new Error().lineNumber; debugger;\n" +
    20        "s += 2;\n" +
    21        "s += 2;\n" +
    22        "line = new Error().lineNumber; debugger;\n" +
    23        "s += 2;\n" +
    24        "assertEq(s, 12);\n");
    25 assertEq(hits, 2);

mercurial