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