Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 function postMsg(message)
2 {
3 var l = SpecialPowers.wrap(parent.window.location);
4 parent.postMessage(message, l.protocol + "//" + l.host);
5 }
7 window.addEventListener("message", onMessageReceived, false);
9 function onMessageReceived(event)
10 {
11 if (event.data == "step") {
12 var performed = false;
13 try {
14 performed = doStep();
15 }
16 catch (ex) {
17 postMsg("FAILURE: exception threw at "+ location +":\n" + ex);
18 finishTest();
19 }
21 if (performed)
22 postMsg("perf");
24 return;
25 }
27 if (parent)
28 postMsg(event.data);
29 }
31 function ok(a, message)
32 {
33 if (!a)
34 postMsg("FAILURE: " + message);
35 else
36 postMsg(message);
37 }
39 function is(a, b, message)
40 {
41 if (a != b)
42 postMsg("FAILURE: " + message + ", expected "+b+" got "+a);
43 else
44 postMsg(message + ", expected "+b+" got "+a);
45 }
47 function todo(a, b, message)
48 {
49 postMsg("TODO: " + message + ", expected "+b+" got "+a);
50 }
52 function finishTest()
53 {
54 postMsg("done");
55 return false;
56 }