content/media/test/test_streams_gc.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 <head>
     4   <title>Test garbage collection of captured stream (bug 806754)</title>
     5   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     7   <script type="text/javascript" src="manifest.js"></script>
     8 </head>
     9 <body onload="doTest()">
    10 <audio id="a"></audio>
    11 <pre id="test">
    12 <script class="testbody" type="text/javascript">
    13 SimpleTest.waitForExplicitFinish();
    15 var a = document.getElementById('a');
    16 a.src = getPlayableAudio(gSmallTests).name;
    18 function forceGC() {
    19   SpecialPowers.gc();
    20   SpecialPowers.forceGC();
    21   SpecialPowers.forceCC();
    22 }
    24 function doTest() {
    25   a.mozCaptureStreamUntilEnded();
    27   a.addEventListener("seeked", function() {
    28     a.play();
    30     a.addEventListener("play", function() {
    31       a.addEventListener("ended", function() {
    32         ok(true, "GC completed OK");
    33         SimpleTest.finish();
    34       }, false);
    35     }, false);
    36   }, false);
    38   a.currentTime = a.duration;
    40   setTimeout(forceGC, 0);
    41 }
    42 </script>
    43 </pre>
    44 </body>
    45 </html>

mercurial