dom/tests/mochitest/ajax/offline/test_badManifestMagic.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/badManifestMagic.cacheManifest">
     2 <head>
     3 <title>bad manifest magic</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;
    13 function finishTest() {
    14   OfflineTest.teardownAndFinish();
    15 }
    17 function handleError() {
    18   OfflineTest.ok(gGotChecking, "Expected checking event");
    19   OfflineTest.ok(true, "Expected error event");
    21   // These items are listed in the manifest, but the error should have
    22   // prevented them from being committed to the cache.
    23   var entries = [
    24     ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
    25     ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false]
    26   ];
    27   OfflineTest.checkCacheEntries(entries, finishTest);
    28 }
    31 if (OfflineTest.setup()) {
    32   // Don't expect a bunch of events.
    33   applicationCache.ondownloading = OfflineTest.failEvent;
    34   applicationCache.onupdateready = OfflineTest.failEvent;
    35   applicationCache.oncached = OfflineTest.failEvent;
    36   applicationCache.onnoupdate = OfflineTest.failEvent;
    37   applicationCache.onprogress = OfflineTest.failEvent;
    39   // ... but expect 'checking' and 'error'
    40   applicationCache.onchecking = function() { gGotChecking = true; };
    41   applicationCache.onerror = OfflineTest.priv(handleError);
    42 }
    44 SimpleTest.waitForExplicitFinish();
    46 </script>
    48 </head>
    50 <body>
    52 </body>
    53 </html>

mercurial