content/media/test/test_load_source.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.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=534571
     5 -->
     6 <head>
     7   <title>Test for Bug 534571</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10   <script type="text/javascript" src="manifest.js"></script>
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=534571">Mozilla Bug 534571</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    17 </div>
    18 <pre id="test">
    19 <script type="application/javascript">
    21 /** Test for Bug 534571 **/
    23 // Test that when we load a video from a source child and then change the
    24 // source's src attribute and load again, that the subsequent loads work.
    26 var v = null;
    27 var s = null;
    29 function finish(event) {
    30   ok(true, "Should have played both videos");
    31   SimpleTest.finish();
    32 }
    34 var first = null;
    35 var second = null;
    37 function ended(event) {
    38   s.type = second.type;
    39   s.src = second.name;
    40   v.removeEventListener("ended", ended, false);
    41   v.addEventListener("ended", finish, false);
    42   v.load();
    43 }
    45 // Find 2 videos we can play.
    46 v = document.createElement('video');
    47 for (var i=0; i<gPlayTests.length; i++) {
    48   if (!v.canPlayType(gPlayTests[i].type))
    49     continue;
    50   if (!first) {
    51     first = gPlayTests[i];
    52   } else if (!second) {
    53     second = gPlayTests[i];
    54     break;
    55   }
    56 }
    58 if (first && second) {
    59   s = document.createElement('source');
    60   s.type = first.type;
    61   s.src = first.name;
    62   v.appendChild(s);
    63   v.autoplay = true;
    64   v.addEventListener("ended", ended, false);
    65   document.body.appendChild(v);
    66   SimpleTest.waitForExplicitFinish();
    67 } else {
    68   todo(false, "Need at least two media of supported types for this test!");
    69 }
    73 </script>
    74 </pre>
    75 </body>
    76 </html>

mercurial