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 // Test the corner case of accessing an unaliased variable of a block
2 // while the block is not live.
4 var g = newGlobal();
5 g.eval("function h() { debugger }");
6 g.eval("function f() { let (x = 1, y) { (function() { y = 0 })(); h() } }");
7 g.eval("var surprise = null");
9 var dbg = new Debugger(g);
10 dbg.onDebuggerStatement = function(hFrame) {
11 var fFrame = hFrame.older;
12 assertEq(fFrame.environment.getVariable('x'), 1);
13 assertEq(fFrame.environment.getVariable('y'), 0);
14 fFrame.eval("surprise = function() { return ++x }");
15 assertEq(g.surprise(), 2);
16 }
17 g.f();
18 assertEq(g.surprise !== null, true);
20 // Either succeed or throw an error about 'x' not being live
21 try {
22 assertEq(g.surprise(), 3);
23 } catch (e) {
24 assertEq(e+'', 'Error: x is not live');
25 }