js/src/jit-test/tests/debug/Debugger-findAllGlobals-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 // Debugger.prototype.findAllGlobals finds ALL the globals!
     3 var g1 = newGlobal();           // Created before the Debugger; debuggee.
     4 var g2 = newGlobal();           // Created before the Debugger; not debuggee.
     6 var dbg = new Debugger;
     8 var g3 = newGlobal();           // Created after the Debugger; debuggee.
     9 var g4 = newGlobal();           // Created after the Debugger; not debuggee.
    11 var g1w = dbg.addDebuggee(g1);
    12 var g3w = dbg.addDebuggee(g3);
    14 var a = dbg.findAllGlobals();
    16 // Get Debugger.Objects viewing the globals from their own compartments;
    17 // this is the sort that findAllGlobals and addDebuggee return.
    18 var g2w = g1w.makeDebuggeeValue(g2).unwrap();
    19 var g4w = g1w.makeDebuggeeValue(g4).unwrap();
    20 var thisw = g1w.makeDebuggeeValue(this).unwrap();
    22 // Check that they're all there.
    23 assertEq(a.indexOf(g1w) != -1, true);
    24 assertEq(a.indexOf(g2w) != -1, true);
    25 assertEq(a.indexOf(g3w) != -1, true);
    26 assertEq(a.indexOf(g4w) != -1, true);
    27 assertEq(a.indexOf(thisw) != -1, true);

mercurial