Thu, 15 Jan 2015 15:59:08 +0100
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 /*
2 * Script.prototype.source should be an object. Moreover, it should be the
3 * same object for each child script within the same debugger.
4 */
5 let g = newGlobal();
6 let dbg = new Debugger(g);
8 let count = 0;
9 dbg.onNewScript = function (script) {
10 assertEq(typeof script.source, "object");
11 function traverse(script) {
12 ++count;
13 script.getChildScripts().forEach(function (child) {
14 assertEq(child.source, script.source);
15 traverse(child);
16 });
17 }
18 traverse(script);
19 }
21 g.eval("2 * 3");
22 g.eval("function f() {}");
23 g.eval("function f() { function g() {} }");
24 g.eval("eval('2 * 3')");
25 g.eval("new Function('2 * 3')");
26 assertEq(count, 10);