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.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Media test: Bug 465498 - Seeking after playback ended</title> |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 7 | <script type="text/javascript" src="manifest.js"></script> |
michael@0 | 8 | </head> |
michael@0 | 9 | <body> |
michael@0 | 10 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=465498">Mozilla Bug 465498</a> |
michael@0 | 11 | <pre id="test"> |
michael@0 | 12 | <script class="testbody" type="text/javascript"> |
michael@0 | 13 | |
michael@0 | 14 | var manager = new MediaTestManager; |
michael@0 | 15 | |
michael@0 | 16 | function startTest(e) { |
michael@0 | 17 | e.target.play(); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | function playbackEnded(e) { |
michael@0 | 21 | var v = e.target; |
michael@0 | 22 | if (v._finished) |
michael@0 | 23 | return; |
michael@0 | 24 | ok(v.currentTime >= v.duration - 0.1 && v.currentTime <= v.duration + 0.1, |
michael@0 | 25 | "Checking currentTime at end: " + v.currentTime + " for " + v._name); |
michael@0 | 26 | ok(v.ended, "Checking playback has ended for " + v._name); |
michael@0 | 27 | v.pause(); |
michael@0 | 28 | v.currentTime = 0; |
michael@0 | 29 | ok(!v.ended, "Checking ended is no longer true for " + v._name); |
michael@0 | 30 | v._seeked = true; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function seekEnded(e) { |
michael@0 | 34 | var v = e.target; |
michael@0 | 35 | if (v._finished) |
michael@0 | 36 | return; |
michael@0 | 37 | ok(v.currentTime == 0, "Checking currentTime after seek: " + |
michael@0 | 38 | v.currentTime + " for " + v._name); |
michael@0 | 39 | ok(!v.ended, "Checking ended is false for " + v._name); |
michael@0 | 40 | v._finished = true; |
michael@0 | 41 | v.parentNode.removeChild(v); |
michael@0 | 42 | manager.finished(v.token); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | function initTest(test, token) { |
michael@0 | 46 | var type = getMajorMimeType(test.type); |
michael@0 | 47 | var v = document.createElement(type); |
michael@0 | 48 | if (!v.canPlayType(test.type)) |
michael@0 | 49 | return; |
michael@0 | 50 | v.preload = "metadata"; |
michael@0 | 51 | v.token = token; |
michael@0 | 52 | manager.started(token); |
michael@0 | 53 | v._name = test.name; |
michael@0 | 54 | |
michael@0 | 55 | var s = document.createElement("source"); |
michael@0 | 56 | s.type = test.type; |
michael@0 | 57 | s.src = test.name; |
michael@0 | 58 | v.appendChild(s); |
michael@0 | 59 | |
michael@0 | 60 | v._seeked = false; |
michael@0 | 61 | v._finished = false; |
michael@0 | 62 | v.addEventListener("loadedmetadata", startTest, false); |
michael@0 | 63 | v.addEventListener("ended", playbackEnded, false); |
michael@0 | 64 | v.addEventListener("seeked", seekEnded, false); |
michael@0 | 65 | document.body.appendChild(v); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | manager.runTests(gSmallTests, initTest); |
michael@0 | 69 | |
michael@0 | 70 | </script> |
michael@0 | 71 | </pre> |
michael@0 | 72 | </body> |
michael@0 | 73 | </html> |