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 <body>
4 <script>
5 var loadsWaiting = 0;
6 var elements = [];
8 function loadedData(event) {
9 parent.ok(elements.indexOf(event.target) == -1, "Element already loaded: " + event.target.currentSrc);
11 elements.push(event.target);
13 --loadsWaiting;
14 parent.ok(true, "Loaded " + event.target.currentSrc);
15 if (loadsWaiting == 0) {
16 parent.loadedAll(elements);
17 }
18 }
20 for (var i = 0; i < parent.gSmallTests.length; ++i) {
21 var test = parent.gSmallTests[i];
22 var elemType = /^audio/.test(test.type) ? "audio" : "video";
23 // Associate these elements with the subframe's document
24 var e = document.createElement(elemType);
25 e.preload = "auto";
26 if (e.canPlayType(test.type)) {
27 e.src = test.name;
28 e.addEventListener("loadeddata", loadedData, false);
29 e.load();
30 ++loadsWaiting;
31 }
32 }
34 if (loadsWaiting == 0) {
35 parent.todo(false, "Can't play anything");
36 } else {
37 parent.SimpleTest.waitForExplicitFinish();
38 }
39 </script>
40 </body>
41 </html>