content/media/test/test_closing_connections.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 hg diff<!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=479863
     5 -->
     6 <head>
     7   <title>Test for Bug 479863 --- loading many connections</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="application/javascript" src="use_large_cache.js"></script>
    11   <script type="text/javascript" src="manifest.js"></script>
    12 </head>
    13 <body>
    14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=479863">Mozilla Bug 479863</a>
    15 <p id="display"></p>
    16 <div id="content" style="display: none">
    18 </div>
    20 <script type="application/javascript">
    21 window.onload = function() {
    22   ok(true, "loaded metadata for all videos");
    23   mediaTestCleanup();
    24   SimpleTest.finish();
    25 }
    27 /*   With normal per-domain connection limits and a naive implementation, we
    28      won't ever be able to load all these videos because the first 15 (or whatever)
    29      will each take up one HTTP connection (which will be suspended) and then
    30      the others will be blocked by the per-domain HTTP connection limit. We
    31      pass this test by closing the connection for non-buffered videos after
    32      we've got the first frame.
    33 */
    35 var resource = getPlayableVideo(gSeekTests);
    37 SimpleTest.waitForExplicitFinish();
    38 SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
    39 function beginTest() {
    40   if (resource != null) {
    41     for (var i=0; i<20; ++i) {
    42       var v = document.createElement("video");
    43       v.src = resource.name;
    44       document.body.appendChild(v);
    45     }
    46   } else {
    47     todo(false, "No types supported");
    48   }
    49 }
    50 </script>
    52 <pre id="test">
    53 <script type="application/javascript">
    54 </script>
    55 </pre>
    56 </body>
    57 </html>

mercurial