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 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=495300 |
michael@0 | 5 | --> |
michael@0 | 6 | |
michael@0 | 7 | <head> |
michael@0 | 8 | <title>Bug 495300 - seeking to the end should behave as "ended"</title> |
michael@0 | 9 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 11 | <script type="text/javascript" src="manifest.js"></script> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=495300">Mozilla Bug 495300</a> |
michael@0 | 15 | <pre id="test"> |
michael@0 | 16 | <script class="testbody" type="text/javascript"> |
michael@0 | 17 | |
michael@0 | 18 | var manager = new MediaTestManager; |
michael@0 | 19 | |
michael@0 | 20 | function filename(uri) { |
michael@0 | 21 | return uri.substr(uri.lastIndexOf("/")+1); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | function mediaEnded(event) { |
michael@0 | 25 | ok(true, "Got expected 'ended' event: " + filename(event.target.currentSrc)); |
michael@0 | 26 | |
michael@0 | 27 | if (event.target._expectedDuration) |
michael@0 | 28 | ok(Math.abs(event.target.currentTime - event.target._expectedDuration) < 0.1, |
michael@0 | 29 | "currentTime equals duration: " + filename(event.target.currentSrc)); |
michael@0 | 30 | |
michael@0 | 31 | manager.finished(event.target.token); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | function startTest(test, token) { |
michael@0 | 35 | var elemType = /^audio/.test(test.type) ? "audio" : "video"; |
michael@0 | 36 | var v1 = document.createElement(elemType); |
michael@0 | 37 | v1.preload = "auto"; |
michael@0 | 38 | |
michael@0 | 39 | v1.src = test.name; |
michael@0 | 40 | if (test.duration) { |
michael@0 | 41 | v1._expectedDuration = test.duration; |
michael@0 | 42 | } |
michael@0 | 43 | v1.addEventListener("loadedmetadata", function (event) { |
michael@0 | 44 | event.target.currentTime = event.target.duration; |
michael@0 | 45 | }, false); |
michael@0 | 46 | v1.addEventListener("ended", mediaEnded, false); |
michael@0 | 47 | v1.load(); |
michael@0 | 48 | |
michael@0 | 49 | v1.token = token; |
michael@0 | 50 | manager.started(token); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | manager.runTests(gSeekTests, startTest); |
michael@0 | 54 | |
michael@0 | 55 | </script> |
michael@0 | 56 | </pre> |
michael@0 | 57 | </body> |
michael@0 | 58 | </html> |