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=476731
5 -->
6 <head>
7 <title>Test for Bug 476731</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 <script type="text/javascript" src="manifest.js"></script>
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=476731">Mozilla Bug </a>
14 <p id="display"></p>
15 <div id="content" style="display: none">
16 </div>
17 <pre id="test">
18 <script type="application/javascript">
19 /** Test for Bug 476731 **/
21 var videos = [];
23 function FinishedLoads() {
24 if (videos.length == 0)
25 return false;
26 for (var i=0; i<videos.length; ++i) {
27 if (videos[i]._loadedData) {
28 // A video loadeddata, it should have 404'd. Signal the end of the test
29 // so the error will be reported.
30 return true;
31 }
32 if (!videos[i]._loadError) {
33 return false;
34 }
35 }
36 return true;
37 }
39 function loadError(evt) {
40 var v = evt.target;
41 is(v._loadError, false, "Shouldn't receive multiple error events for " + v.src);
42 v._loadError = true;
43 is(v._loadStart, true, "Receive loadstart for " + v.src);
44 is(v._loadedData, false, "Shouldn't receive loadeddata for " + v.src);
45 if (FinishedLoads(videos))
46 SimpleTest.finish();
47 }
49 function loadedData(evt) {
50 evt.target._loadedData = true;
51 }
53 function loadStart(evt) {
54 evt.target._loadStart = true;
55 }
57 // Create all video objects.
58 for (var i=0; i<g404Tests.length; ++i) {
59 var v = document.createElement("video");
60 v.preload = "auto";
61 var test = g404Tests[i];
62 if (!v.canPlayType(test.type)) {
63 continue;
64 }
65 v.src = test.name;
66 v._loadedData = false;
67 v._loadStart = false;
68 v._loadError = false;
69 v.addEventListener("error", loadError, false);
70 v.addEventListener("loadstart", loadStart, false);
71 v.addEventListener("loadeddata", loadedData, false);
72 document.body.appendChild(v); // Will start load.
73 videos.push(v);
74 }
76 if (videos.length == 0) {
77 todo(false, "No types supported");
78 } else {
79 SimpleTest.waitForExplicitFinish();
80 }
81 </script>
82 </pre>
83 </body>
84 </html>