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 | <html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest"> |
michael@0 | 2 | <head> |
michael@0 | 3 | <title>identical manifest test</title> |
michael@0 | 4 | |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script> |
michael@0 | 7 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 8 | |
michael@0 | 9 | <script type="text/javascript"> |
michael@0 | 10 | |
michael@0 | 11 | var gGotChecking = false; |
michael@0 | 12 | var gGotDownloading = false; |
michael@0 | 13 | |
michael@0 | 14 | function finishTest() |
michael@0 | 15 | { |
michael@0 | 16 | OfflineTest.teardownAndFinish(); |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | function noUpdate() |
michael@0 | 20 | { |
michael@0 | 21 | OfflineTest.ok(gGotChecking, "Should get a checking event"); |
michael@0 | 22 | OfflineTest.ok(!gGotDownloading, "Should not get a downloading event"); |
michael@0 | 23 | |
michael@0 | 24 | var entries = [ |
michael@0 | 25 | // The document that requested the manifest should be in the cache |
michael@0 | 26 | [window.location.href, true], |
michael@0 | 27 | |
michael@0 | 28 | ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true], |
michael@0 | 29 | ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true] |
michael@0 | 30 | ]; |
michael@0 | 31 | OfflineTest.checkCacheEntries(entries, finishTest); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | function manifestUpdated() |
michael@0 | 35 | { |
michael@0 | 36 | OfflineTest.ok(gGotChecking, "Should get a checking event"); |
michael@0 | 37 | OfflineTest.ok(gGotDownloading, "Should get a downloading event"); |
michael@0 | 38 | |
michael@0 | 39 | var entries = [ |
michael@0 | 40 | // The manifest itself should be in the cache |
michael@0 | 41 | ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true], |
michael@0 | 42 | |
michael@0 | 43 | // The document that requested the manifest should be in the cache |
michael@0 | 44 | [window.location.href, true], |
michael@0 | 45 | |
michael@0 | 46 | // The entries from the manifest should be in the cache |
michael@0 | 47 | ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true], |
michael@0 | 48 | ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true], |
michael@0 | 49 | |
michael@0 | 50 | // The bad entries from the manifest should not be in the cache |
michael@0 | 51 | ["bad:/uri/invalid", false] |
michael@0 | 52 | ]; |
michael@0 | 53 | OfflineTest.checkCacheEntries(entries, manifestUpdatedContinue); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | function manifestUpdatedContinue() |
michael@0 | 57 | { |
michael@0 | 58 | // Now make sure applicationCache.update() does what we expect. |
michael@0 | 59 | applicationCache.oncached = OfflineTest.failEvent; |
michael@0 | 60 | applicationCache.onnoupdate = OfflineTest.priv(noUpdate); |
michael@0 | 61 | |
michael@0 | 62 | gGotChecking = false; |
michael@0 | 63 | gGotDownloading = false; |
michael@0 | 64 | applicationCache.update(); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | if (OfflineTest.setup()) { |
michael@0 | 68 | applicationCache.onerror = OfflineTest.failEvent; |
michael@0 | 69 | applicationCache.onnoupdate = OfflineTest.failEvent; |
michael@0 | 70 | applicationCache.onudpateready = OfflineTest.failEvent; |
michael@0 | 71 | |
michael@0 | 72 | applicationCache.onchecking = function() { gGotChecking = true; }; |
michael@0 | 73 | applicationCache.ondownloading = function() { gGotDownloading = true; }; |
michael@0 | 74 | applicationCache.oncached = OfflineTest.priv(manifestUpdated); |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 78 | |
michael@0 | 79 | </script> |
michael@0 | 80 | |
michael@0 | 81 | </head> |
michael@0 | 82 | |
michael@0 | 83 | <body> |
michael@0 | 84 | |
michael@0 | 85 | </body> |
michael@0 | 86 | </html> |