dom/tests/mochitest/ajax/offline/test_missingFile.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 <html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest">
     2 <head>
     3 <title>missing manifest file test</title>
     5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6 <script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
     7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     9 <script type="text/javascript">
    11 var gGotChecking = false;
    12 var gGotDownloading = false;
    14 function finishTest() {
    15   OfflineTest.teardownAndFinish();
    16 }
    18 function handleError() {
    19   OfflineTest.ok(gGotChecking, "Expected checking event");
    20   OfflineTest.ok(gGotDownloading, "Expected downloading event");
    21   OfflineTest.ok(true, "Expected error event");
    23   // These items are listed in the manifest, but the error should have
    24   // prevented them from being committed to the cache.
    25   var entries = [
    26     ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
    27     ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false]
    28   ];
    29   OfflineTest.checkCacheEntries(entries, finishTest);
    30 }
    32 if (OfflineTest.setup()) {
    33   // Don't expect any "success" events.
    34   applicationCache.onupdateready = function() { OfflineTest.failEvent("updateready"); }
    35   applicationCache.oncached = function() { OfflineTest.failEvent("cached"); }
    36   applicationCache.onnoupdate = function() { OfflineTest.failEvent("noupdate"); }
    38   applicationCache.ondownloading = function() { gGotDownloading = true; };
    39   applicationCache.onchecking = function() { gGotChecking = true; };
    40   applicationCache.onerror = OfflineTest.priv(handleError);
    41 }
    43 SimpleTest.waitForExplicitFinish();
    46 </script>
    48 </head>
    50 <body>
    52 </body>
    53 </html>

mercurial