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: unknown/invalid formats raise decode error</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 | <pre id="test"> |
michael@0 | 11 | <script class="testbody" type="text/javascript"> |
michael@0 | 12 | var manager = new MediaTestManager; |
michael@0 | 13 | |
michael@0 | 14 | function startTest(test, token) { |
michael@0 | 15 | var v = document.createElement("video"); |
michael@0 | 16 | manager.started(token); |
michael@0 | 17 | v.addEventListener("error", function (event) { |
michael@0 | 18 | var el = event.currentTarget; |
michael@0 | 19 | is(event.type, "error", "Expected event of type 'error'"); |
michael@0 | 20 | ok(el.error, "Element 'error' attr expected to have a value"); |
michael@0 | 21 | ok(el.error instanceof MediaError, "Element 'error' attr expected to be MediaError"); |
michael@0 | 22 | is(el.error.code, MediaError.MEDIA_ERR_DECODE, "Expected a decode error"); |
michael@0 | 23 | is(el.networkState, HTMLMediaElement.NETWORK_EMPTY, "networkState should be EMPTY"); |
michael@0 | 24 | el._sawError = true; |
michael@0 | 25 | }, false); |
michael@0 | 26 | |
michael@0 | 27 | v.addEventListener("emptied", function (event) { |
michael@0 | 28 | var el = event.currentTarget; |
michael@0 | 29 | is(el.networkState, HTMLMediaElement.NETWORK_EMPTY, "networkState should be EMPTY"); |
michael@0 | 30 | ok(el._sawError, "Expected error event"); |
michael@0 | 31 | manager.finished(token); |
michael@0 | 32 | }, false); |
michael@0 | 33 | |
michael@0 | 34 | v.addEventListener("loadedmetadata", function () { |
michael@0 | 35 | ok(false, "Unexpected loadedmetadata event"); |
michael@0 | 36 | }, false); |
michael@0 | 37 | |
michael@0 | 38 | v.autoplay = true; |
michael@0 | 39 | v.addEventListener("ended", function () { |
michael@0 | 40 | ok(false, "Unexpected ended event"); |
michael@0 | 41 | }, false); |
michael@0 | 42 | |
michael@0 | 43 | v.src = test.name; // implicitly starts a load. |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 47 | SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest); |
michael@0 | 48 | function beginTest() { |
michael@0 | 49 | manager.runTests(gDecodeErrorTests, startTest); |
michael@0 | 50 | } |
michael@0 | 51 | </script> |
michael@0 | 52 | </pre> |
michael@0 | 53 | </body> |
michael@0 | 54 | </html> |