Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest"> |
michael@0 | 2 | <head> |
michael@0 | 3 | <title>unknown section</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 manifestUpdated() |
michael@0 | 15 | { |
michael@0 | 16 | OfflineTest.ok(gGotChecking, "Should get a checking event"); |
michael@0 | 17 | OfflineTest.ok(gGotDownloading, "Should get a downloading event"); |
michael@0 | 18 | |
michael@0 | 19 | OfflineTest.is(applicationCache.status, 1, "Cache status should be 1 (CACHED)"); |
michael@0 | 20 | |
michael@0 | 21 | var entries = [ |
michael@0 | 22 | // The manifest itself should be in the cache |
michael@0 | 23 | ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest", true], |
michael@0 | 24 | |
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 | // The entries from the manifest should be in the cache |
michael@0 | 29 | ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true], |
michael@0 | 30 | ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true], |
michael@0 | 31 | |
michael@0 | 32 | // The bad entries from the manifest should not be in the cache |
michael@0 | 33 | ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg", false] |
michael@0 | 34 | ]; |
michael@0 | 35 | OfflineTest.checkCacheEntries( |
michael@0 | 36 | entries, |
michael@0 | 37 | function() { |
michael@0 | 38 | OfflineTest.teardownAndFinish(); |
michael@0 | 39 | }); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | if (OfflineTest.setup()) { |
michael@0 | 43 | OfflineTest.ok(applicationCache instanceof EventTarget, |
michael@0 | 44 | "applicationCache should be an event target"); |
michael@0 | 45 | |
michael@0 | 46 | applicationCache.onerror = OfflineTest.failEvent; |
michael@0 | 47 | |
michael@0 | 48 | applicationCache.addEventListener("checking", function() { |
michael@0 | 49 | // We should get the "checking" event during an initial update, |
michael@0 | 50 | // but until we are associated it will not affect applicationCache.status |
michael@0 | 51 | OfflineTest.is(applicationCache.status, applicationCache.UNCACHED, |
michael@0 | 52 | "CHECKING state during initial update"); |
michael@0 | 53 | gGotChecking = true; |
michael@0 | 54 | }, true); |
michael@0 | 55 | applicationCache.ondownloading = function() { |
michael@0 | 56 | // We should get the "downloading" event during an initial update, |
michael@0 | 57 | // but until we are associated it will not affect applicationCache.status |
michael@0 | 58 | OfflineTest.is(applicationCache.status, applicationCache.UNCACHED, |
michael@0 | 59 | "DOWNLOADING state during initial update") |
michael@0 | 60 | gGotDownloading = true; }; |
michael@0 | 61 | applicationCache.oncached = OfflineTest.priv(manifestUpdated); |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 65 | |
michael@0 | 66 | </script> |
michael@0 | 67 | |
michael@0 | 68 | </head> |
michael@0 | 69 | |
michael@0 | 70 | <body> |
michael@0 | 71 | |
michael@0 | 72 | </body> |
michael@0 | 73 | </html> |