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 | <meta charset="UTF-8" /> |
michael@0 | 5 | <title>Test rejection of invalid files</title> |
michael@0 | 6 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 7 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 8 | <script type="text/javascript" src="manifest.js"></script> |
michael@0 | 9 | </head> |
michael@0 | 10 | <body> |
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(test, token) { |
michael@0 | 17 | var v = document.createElement('video'); |
michael@0 | 18 | manager.started(token); |
michael@0 | 19 | |
michael@0 | 20 | // Set up event handlers. Seeing any of these is a failure. |
michael@0 | 21 | function badEvent(type) { return function(e) { |
michael@0 | 22 | ok(false, test.name + " should not fire '" + type + "' event"); |
michael@0 | 23 | }}; |
michael@0 | 24 | var events = [ |
michael@0 | 25 | 'loadedmetadata', 'load', |
michael@0 | 26 | 'canplay', 'canplaythrough', |
michael@0 | 27 | 'playing' |
michael@0 | 28 | ]; |
michael@0 | 29 | events.forEach( function(e) { |
michael@0 | 30 | v.addEventListener(e, badEvent(e)); |
michael@0 | 31 | }); |
michael@0 | 32 | |
michael@0 | 33 | // Seeing a decoder error is a success. |
michael@0 | 34 | v.addEventListener("error", function(e) { |
michael@0 | 35 | is(v.error.code, v.error.MEDIA_ERR_DECODE, |
michael@0 | 36 | "decoder should reject " + test.name); |
michael@0 | 37 | v.removeEventListener('error', arguments.callee, false); |
michael@0 | 38 | manager.finished(token); |
michael@0 | 39 | }); |
michael@0 | 40 | |
michael@0 | 41 | // Now try to load and play the file, which should result in the |
michael@0 | 42 | // error event handler above being called, terminating the test. |
michael@0 | 43 | document.body.appendChild(v); |
michael@0 | 44 | v.src = test.name; |
michael@0 | 45 | v.play(); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | manager.runTests(gInvalidTests, startTest); |
michael@0 | 49 | |
michael@0 | 50 | </script> |
michael@0 | 51 | </pre> |
michael@0 | 52 | </body> |
michael@0 | 53 | </html> |