content/media/test/test_bug448534.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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=448534
michael@0 5 -->
michael@0 6
michael@0 7 <head>
michael@0 8 <title>Test for Bug 448534</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=448535">Mozilla Bug 448534</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 loaded(event) {
michael@0 21 var v = event.target;
michael@0 22 if (v._finished)
michael@0 23 return;
michael@0 24 v.play();
michael@0 25 }
michael@0 26
michael@0 27 function started(event) {
michael@0 28 var v = event.target;
michael@0 29 if (v._finished)
michael@0 30 return;
michael@0 31 ok(!v.paused, "Video should not be paused while playing");
michael@0 32 v.parentNode.removeChild(v);
michael@0 33 v._played = true;
michael@0 34 }
michael@0 35
michael@0 36 function stopped(event) {
michael@0 37 var v = event.target;
michael@0 38 if (v._finished)
michael@0 39 return;
michael@0 40 v._finished = true;
michael@0 41 ok(v.paused, "Video should be paused after removing from the Document");
michael@0 42 manager.finished(v.token);
michael@0 43 }
michael@0 44
michael@0 45
michael@0 46 function startTest(test, token) {
michael@0 47 var v = document.createElement('video');
michael@0 48 v.preload = "metadata";
michael@0 49 v.token = token;
michael@0 50 manager.started(token);
michael@0 51 v.src = test.name;
michael@0 52 v._played = false;
michael@0 53 v._finished = false;
michael@0 54 v.addEventListener("loadedmetadata", loaded, false);
michael@0 55 v.addEventListener("play", started, false);
michael@0 56 v.addEventListener("pause", stopped, false);
michael@0 57 document.body.appendChild(v);
michael@0 58 }
michael@0 59
michael@0 60 manager.runTests(gSmallTests, startTest);
michael@0 61
michael@0 62 </script>
michael@0 63 </pre>
michael@0 64 </body>
michael@0 65 </html>

mercurial