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 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=370098
5 -->
6 <head>
7 <title>Test for Bug 370098</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=370098">Mozilla Bug 370098</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
19 /** Test for Bug 370098 **/
20 function test_constructor(dom_proto, shouldthrow) {
21 var threw = false;
22 try {
23 window[dom_proto]();
24 } catch (e) {
25 threw = true;
26 }
27 // XSLTProcessor is still on the old bindings.
28 if (dom_proto != 'XSLTProcessor')
29 ok(threw, "Calling |" + dom_proto + "()| should always throw");
31 threw = false;
32 try {
33 new window[dom_proto]();
34 } catch (e) {
35 threw = true;
36 }
37 is(threw, shouldthrow, "Calling |new " + dom_proto + "()| should" + (shouldthrow ? " " : " not ") + "throw");
38 }
39 var dom_protos = [ "Element" ];
40 var dom_constructors = [ "Document", "Image", "DOMParser", "XMLSerializer",
41 "XMLHttpRequest", "XPathEvaluator", "XSLTProcessor" ];
42 dom_protos.forEach(
43 function(p) { test_constructor(p, true); });
44 dom_constructors.forEach(
45 function(p) { test_constructor(p, false); });
46 </script>
47 </pre>
48 </body>
49 </html>