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 <HTML>
2 <HEAD>
3 <SCRIPT>
4 function docFragAppendTest() {
5 var d = document.createDocumentFragment();
6 d.appendChild(document.createTextNode(" Hello"));
7 var b = document.createElement("B")
8 b.appendChild(document.createTextNode(" there"));
9 d.appendChild(b);
10 p = document.getElementById("appendTest");
11 p.appendChild(d);
12 alert("This number should be 0: " + d.childNodes.length);
13 }
14 function docFragReplaceTest() {
15 var d = document.createDocumentFragment();
16 d.appendChild(document.createTextNode(" new"));
17 var b = document.createElement("B")
18 b.appendChild(document.createTextNode(" ones"));
19 d.appendChild(b);
20 p = document.getElementById("replaceTest");
21 s = document.getElementById("replaceSpan");
22 if (null != s) {
23 p.replaceChild(d, s);
24 }
25 alert("This number should be 0: " + d.childNodes.length);
26 }
27 </SCRIPT>
28 </HEAD>
29 <BODY>
30 <H1>Document Fragment test</H1>
32 <P ID="appendTest">If this test works, clicking on this <A href="" onclick="docFragAppendTest(); return false;">link</A> will add two words to the end of this paragraph.</P>
34 <P ID="replaceTest">
35 Clicking on this <A href="" onclick="docFragReplaceTest(); return false;">link</A> will replace the following two words with new ones: <span id="replaceSpan">two words</span>.
36 </P>
38 </BODY>
39 </HTML>