dom/tests/mochitest/ajax/offline/test_bug445544.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <html manifest="445544.cacheManifest">
michael@0 2 <!--
michael@0 3 https://bugzilla.mozilla.org/show_bug.cgi?id=445544
michael@0 4 -->
michael@0 5
michael@0 6 <head>
michael@0 7 <title>Test for Bug 445544</title>
michael@0 8
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 10 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 11 <script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
michael@0 12
michael@0 13 <script type="text/javascript">
michael@0 14
michael@0 15 var gTestWin;
michael@0 16 var gTimeoutId;
michael@0 17
michael@0 18 function finish()
michael@0 19 {
michael@0 20 gTestWin.close();
michael@0 21 OfflineTest.teardownAndFinish();
michael@0 22 }
michael@0 23
michael@0 24 function error()
michael@0 25 {
michael@0 26 OfflineTest.ok(false, "Part 2 did not successfully load.");
michael@0 27 finish();
michael@0 28 }
michael@0 29
michael@0 30 function part2loaded()
michael@0 31 {
michael@0 32 clearTimeout(gTimeoutId);
michael@0 33 OfflineTest.ok(true, "Part 2 successfully loaded.");
michael@0 34 finish();
michael@0 35 }
michael@0 36
michael@0 37 function part1loaded(appCacheStatus)
michael@0 38 {
michael@0 39 OfflineTest.ok(appCacheStatus > 0,
michael@0 40 "Part 1 successfully loaded from the application cache.");
michael@0 41
michael@0 42 // Loading part 2 (which is not part of that application
michael@0 43 // cache) should succeed...
michael@0 44 gTestWin.location = "445544_part2.html";
michael@0 45
michael@0 46 // We won't be notified if the page fails to load, fail this test
michael@0 47 // in 10 seconds.
michael@0 48 gTimeoutId = setTimeout(error, 10000);
michael@0 49 }
michael@0 50
michael@0 51 function manifestUpdated()
michael@0 52 {
michael@0 53 // Open a new window that will be associated with this application
michael@0 54 // cache. This will call part1loaded().
michael@0 55 gTestWin = window.open("445544_part1.html");
michael@0 56 }
michael@0 57
michael@0 58 if (OfflineTest.setup()) {
michael@0 59 applicationCache.onerror = OfflineTest.failEvent;
michael@0 60 applicationCache.oncached = OfflineTest.priv(manifestUpdated);
michael@0 61 }
michael@0 62
michael@0 63 SimpleTest.waitForExplicitFinish();
michael@0 64
michael@0 65 </script>
michael@0 66
michael@0 67 </head>
michael@0 68
michael@0 69 <body>
michael@0 70
michael@0 71 </body>
michael@0 72 </html>

mercurial