js/src/jit-test/tests/debug/Frame-onPop-15.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 // Each resumption of a generator gets a fresh frame, whose onPop handler
     2 // fires the next time the generator yields.
     3 // This is not the behavior the spec requests, but it's what we do for the
     4 // moment, and it's good to check that at least we don't crash.
     5 var g = newGlobal();
     6 var dbg = new Debugger(g);
     7 var log;
     9 var debuggerFrames = [];
    10 var poppedFrames = [];
    11 dbg.onDebuggerStatement = function handleDebugger(frame) {
    12     log += 'd';
    13     assertEq(frame.type, "call");
    15     assertEq(debuggerFrames.indexOf(frame), -1);
    16     assertEq(poppedFrames.indexOf(frame), -1);
    17     debuggerFrames.push(frame);
    19     if (frame.eval('i').return % 3 == 0) {
    20         frame.onPop = function handlePop(c) {
    21             log += ')' + c.return;
    22             assertEq(debuggerFrames.indexOf(this) != -1, true);
    23             assertEq(poppedFrames.indexOf(this), -1);
    24             poppedFrames.push(this);
    25         };
    26     }
    27 };
    29 g.eval("function g() { for (var i = 0; i < 10; i++) { debugger; yield i; } }");
    30 log ='';
    31 assertEq(g.eval("var t = 0; for (j in g()) t += j; t;"), 45);
    32 assertEq(log, "d)0ddd)3ddd)6ddd)9");

mercurial