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=493187 |
michael@0 | 5 | --> |
michael@0 | 6 | |
michael@0 | 7 | <head> |
michael@0 | 8 | <title>Bug 493187 - enter HAVE_FUTURE_DATA when seeking within buffered data even if new data isn't arriving</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=493187">Mozilla Bug 493187</a> |
michael@0 | 15 | <pre id="test"> |
michael@0 | 16 | <script class="testbody" type="text/javascript"> |
michael@0 | 17 | |
michael@0 | 18 | SimpleTest.expectAssertions(0, 2); |
michael@0 | 19 | |
michael@0 | 20 | var manager = new MediaTestManager; |
michael@0 | 21 | |
michael@0 | 22 | function start(e) { |
michael@0 | 23 | e.target.currentTime = e.target.duration / 4; |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | function startSeeking(e) { |
michael@0 | 27 | e.target._seeked = true; |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | function canPlayThrough(e) { |
michael@0 | 31 | var v = e.target; |
michael@0 | 32 | if (v._seeked && !v._finished) { |
michael@0 | 33 | ok(true, "Got canplaythrough after seek for " + v._name); |
michael@0 | 34 | v._finished = true; |
michael@0 | 35 | v.parentNode.removeChild(v); |
michael@0 | 36 | v.src = ""; |
michael@0 | 37 | manager.finished(v.token); |
michael@0 | 38 | } |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function startTest(test, token) { |
michael@0 | 42 | // TODO: Bug 568402, there's a bug in the WAV backend where we sometimes |
michael@0 | 43 | // don't send canplaythrough events after seeking. Once that is fixed, |
michael@0 | 44 | // we should remove this guard below so that we run this test for audio. |
michael@0 | 45 | var type = getMajorMimeType(test.type); |
michael@0 | 46 | if (type != "video") |
michael@0 | 47 | return; |
michael@0 | 48 | |
michael@0 | 49 | var v = document.createElement('video'); |
michael@0 | 50 | v.token = token; |
michael@0 | 51 | manager.started(token); |
michael@0 | 52 | |
michael@0 | 53 | v.src = test.name; |
michael@0 | 54 | v._name = test.name; |
michael@0 | 55 | v._seeked = false; |
michael@0 | 56 | v._finished = false; |
michael@0 | 57 | v.preload = "auto"; |
michael@0 | 58 | v.addEventListener("loadedmetadata", start, false); |
michael@0 | 59 | v.addEventListener("canplaythrough", canPlayThrough, false); |
michael@0 | 60 | v.addEventListener("seeking", startSeeking, false); |
michael@0 | 61 | document.body.appendChild(v); |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 65 | SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest); |
michael@0 | 66 | function beginTest() { |
michael@0 | 67 | manager.runTests(gSeekTests, startTest); |
michael@0 | 68 | } |
michael@0 | 69 | </script> |
michael@0 | 70 | </pre> |
michael@0 | 71 | </body> |
michael@0 | 72 | </html> |