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 // Exceptions thrown by obj.defineProperties are copied into the debugger compartment.
3 var g = newGlobal();
4 var dbg = new Debugger;
5 var gw = dbg.addDebuggee(g);
7 function test(objexpr, descs) {
8 var exca, excb;
10 g.eval("obj = (" + objexpr + ");");
11 var gobjw = gw.getOwnPropertyDescriptor("obj").value;
12 try {
13 gobjw.defineProperties(descs);
14 } catch (exc) {
15 exca = exc;
16 }
18 var indirectEval = eval;
19 var obj = indirectEval("(" + objexpr + ");");
20 try {
21 Object.defineProperties(obj, descs);
22 } catch (exc) {
23 excb = exc;
24 }
26 assertEq(Object.getPrototypeOf(exca), Object.getPrototypeOf(excb));
27 assertEq(exca.message, excb.message);
28 assertEq(typeof exca.fileName, "string");
29 assertEq(typeof exca.stack, "string");
30 }
32 test("Object.create(null, {p: {value: 1}})", {p: {value: 2}});
33 test("({})", {x: {get: 'bad'}});