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 <head>
4 <title>Media test: Test resume of server-dropped connections</title>
5 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
6 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
8 </head>
9 <body>
10 <audio preload="auto" id="a"></audio>
11 <iframe id="f"></iframe>
12 <pre id="test">
13 <script class="testbody" type="text/javascript">
14 var key = Math.round(Math.random()*1000000000);
15 var a = document.getElementById("a");
16 var f = document.getElementById("f");
18 function didEnd() {
19 ok(a.currentTime > 2.26, "Reached correct end time (got " + a.currentTime + ", expected > 2.26");
20 SimpleTest.finish();
21 }
23 function didSendCancel() {
24 a.addEventListener("ended", didEnd, false);
25 a.play();
26 }
28 function didSuspend() {
29 a.removeEventListener("suspend", didSuspend, false);
31 // Cache must have filled up, or something. Tell the Web server to drop
32 // our connection.
33 f.addEventListener("load", didSendCancel, false);
34 f.src = "cancellable_request.sjs?cancelkey=" + key;
35 }
37 if (!a.canPlayType("audio/wave")) {
38 todo(false, "Test requires support for audio/wave");
39 } else {
40 a.addEventListener("suspend", didSuspend, false);
41 a.src = "cancellable_request.sjs?key=" + key;
42 SimpleTest.waitForExplicitFinish();
43 }
44 </script>
45 </pre>
46 </body>
47 </html>