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 // Environments of different instances of the same generator have the same
2 // callee. I love this job.
4 var g = newGlobal();
5 var dbg = new Debugger;
6 var gw = dbg.addDebuggee(g);
8 function check(gen, label) {
9 print("check(" + label + ")");
10 var hits;
11 dbg.onDebuggerStatement = function (frame) {
12 hits++;
13 var env = frame.environment;
14 assertEq(env.callee, gw.makeDebuggeeValue(g.f));
15 };
16 hits = 0;
17 gen.next();
18 assertEq(hits, 1);
19 }
21 g.eval('function f(x) { debugger; yield x; }');
22 g.eval('var g = f(2);');
23 g.eval('var h = f(3);');
24 check(g.g, 'g.g');
25 check(g.h, 'g.h');
27 g.eval('function* f(x) { debugger; yield x; }');
28 g.eval('var g = f(2);');
29 g.eval('var h = f(3);');
30 check(g.g, 'g.g');
31 check(g.h, 'g.h');