js/src/jit-test/tests/debug/dispatch-02.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 // Disabling a Debugger object causes events to stop being delivered to it
     2 // immediately, even if we're in the middle of dispatching.
     4 var g = newGlobal();
     5 var log;
     7 var arr = [];
     8 for (var i = 0; i < 4; i++) {
     9     arr[i] = new Debugger(g);
    10     arr[i].num = i;
    11     arr[i].onDebuggerStatement = function () {
    12         log += this.num;
    13         // Disable them all.
    14         for (var j = 0; j < arr.length; j++)
    15             arr[j].enabled = false;
    16     };
    17 }
    19 log = '';
    20 g.eval("debugger; debugger;");
    21 assertEq(log, '0');

mercurial