js/src/jit-test/tests/debug/Frame-onStep-iterators.js

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 var g = newGlobal();
     2 var dbg = new Debugger;
     3 var gw = dbg.addDebuggee(g);
     4 var log;
     5 var a = [];
     7 dbg.onDebuggerStatement = function (frame) {
     8   log += 'd';
     9   frame.onStep = function () {
    10     // This handler must not wipe out the debuggee's value in JSContext::iterValue.
    11     log += 's';
    12     // This will use JSContext::iterValue in the debugger.
    13     for (let i of a)
    14       log += 'i';
    15   };
    16 };
    18 log = '';
    19 g.eval("debugger; for (let i of [1,2,3]) print(i);");
    20 assertEq(!!log.match(/^ds*$/), true);

mercurial