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.
michael@0 | 1 | // uncaughtExceptionHook resumption value other than undefined causes further |
michael@0 | 2 | // hooks to be skipped. |
michael@0 | 3 | |
michael@0 | 4 | var g = newGlobal(); |
michael@0 | 5 | var log; |
michael@0 | 6 | |
michael@0 | 7 | function makeDebug(g, name) { |
michael@0 | 8 | var dbg = new Debugger(g); |
michael@0 | 9 | dbg.onDebuggerStatement = function (frame) { |
michael@0 | 10 | log += name; |
michael@0 | 11 | throw new Error(name); |
michael@0 | 12 | }; |
michael@0 | 13 | dbg.uncaughtExceptionHook = function (exc) { |
michael@0 | 14 | assertEq(exc.message, name); |
michael@0 | 15 | return name == "2" ? {return: 42} : undefined; |
michael@0 | 16 | }; |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | var arr = []; |
michael@0 | 20 | for (var i = 0; i < 6; i++) |
michael@0 | 21 | arr[i] = makeDebug(g, "" + i); |
michael@0 | 22 | |
michael@0 | 23 | log = ''; |
michael@0 | 24 | assertEq(g.eval("debugger;"), 42); |
michael@0 | 25 | assertEq(log, "012"); |