From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../mochitest/ajax/offline/445544.cacheManifest | 8 + .../ajax/offline/445544.cacheManifest^headers^ | 2 + dom/tests/mochitest/ajax/offline/445544_part1.html | 9 + dom/tests/mochitest/ajax/offline/445544_part2.html | 9 + .../ajax/offline/460353_iframe_nomanifest.html | 9 + .../ajax/offline/460353_iframe_ownmanifest.html | 37 ++ .../ajax/offline/460353_iframe_samemanifest.html | 25 ++ .../ajax/offline/744719-cancel.cacheManifest | 37 ++ .../offline/744719-cancel.cacheManifest^headers^ | 2 + .../mochitest/ajax/offline/744719.cacheManifest | 36 ++ .../ajax/offline/744719.cacheManifest^headers^ | 2 + .../ajax/offline/badManifestMagic.cacheManifest | 3 + .../badManifestMagic.cacheManifest^headers^ | 2 + .../mochitest/ajax/offline/bypass.cacheManifest | 7 + .../ajax/offline/bypass.cacheManifest^headers^ | 2 + dom/tests/mochitest/ajax/offline/bypass.html | 41 ++ dom/tests/mochitest/ajax/offline/changing1Hour.sjs | 8 + dom/tests/mochitest/ajax/offline/changing1Sec.sjs | 9 + .../mochitest/ajax/offline/changingManifest.sjs | 27 ++ .../mochitest/ajax/offline/dynamicRedirect.sjs | 27 ++ .../mochitest/ajax/offline/explicitRedirect.sjs | 27 ++ .../mochitest/ajax/offline/fallback.cacheManifest | 11 + .../ajax/offline/fallback.cacheManifest^headers^ | 2 + dom/tests/mochitest/ajax/offline/fallback.html | 12 + dom/tests/mochitest/ajax/offline/fallback2.html | 12 + dom/tests/mochitest/ajax/offline/fallbackTop.html | 8 + .../mochitest/ajax/offline/foreign1.cacheManifest | 3 + .../ajax/offline/foreign1.cacheManifest^headers^ | 2 + .../mochitest/ajax/offline/foreign2.cacheManifest | 3 + .../ajax/offline/foreign2.cacheManifest^headers^ | 2 + dom/tests/mochitest/ajax/offline/foreign2.html | 69 ++++ dom/tests/mochitest/ajax/offline/jupiter.jpg | Bin 0 -> 30694 bytes .../mochitest/ajax/offline/manifestRedirect.sjs | 6 + dom/tests/mochitest/ajax/offline/missing.html | 24 ++ .../ajax/offline/missingFile.cacheManifest | 6 + .../offline/missingFile.cacheManifest^headers^ | 2 + dom/tests/mochitest/ajax/offline/mochitest.ini | 101 +++++ .../mochitest/ajax/offline/namespace1/opp.html | 9 + .../namespace1/redirectToDifferentOrigin.sjs | 6 + .../mochitest/ajax/offline/namespace1/script.js | 4 + .../mochitest/ajax/offline/namespace1/sub/opp.html | 9 + .../ajax/offline/namespace1/sub/script1.js | 4 + .../ajax/offline/namespace1/sub2/script2.js | 4 + .../mochitest/ajax/offline/namespace2/script3.js | 4 + .../mochitest/ajax/offline/notonwhitelist.html | 9 + dom/tests/mochitest/ajax/offline/obsolete.html | 69 ++++ .../mochitest/ajax/offline/obsoletingManifest.sjs | 31 ++ dom/tests/mochitest/ajax/offline/offlineChild.html | 33 ++ dom/tests/mochitest/ajax/offline/offlineTests.js | 436 +++++++++++++++++++++ dom/tests/mochitest/ajax/offline/onwhitelist.html | 9 + .../ajax/offline/onwhitelist.html^headers^ | 1 + .../mochitest/ajax/offline/overlap.cacheManifest | 12 + .../ajax/offline/overlap.cacheManifest^headers^ | 1 + dom/tests/mochitest/ajax/offline/redirects.sjs | 52 +++ .../ajax/offline/simpleManifest.cacheManifest | 7 + .../offline/simpleManifest.cacheManifest^headers^ | 2 + .../mochitest/ajax/offline/subresource744719.html | 1 + .../ajax/offline/test_badManifestMagic.html | 53 +++ .../mochitest/ajax/offline/test_bug445544.html | 73 ++++ .../mochitest/ajax/offline/test_bug460353.html | 100 +++++ .../mochitest/ajax/offline/test_bug474696.html | 39 ++ .../mochitest/ajax/offline/test_bug544462.html | 53 +++ .../ajax/offline/test_bug744719-cancel.html | 84 ++++ .../mochitest/ajax/offline/test_bug744719.html | 76 ++++ .../mochitest/ajax/offline/test_bug765203.html | 73 ++++ dom/tests/mochitest/ajax/offline/test_bypass.html | 37 ++ .../ajax/offline/test_cancelOfflineCache.html | 58 +++ .../ajax/offline/test_changingManifest.html | 116 ++++++ .../mochitest/ajax/offline/test_fallback.html | 130 ++++++ dom/tests/mochitest/ajax/offline/test_foreign.html | 59 +++ .../ajax/offline/test_identicalManifest.html | 86 ++++ .../ajax/offline/test_lowDeviceStorage.html | 91 +++++ .../offline/test_lowDeviceStorageDuringUpdate.html | 58 +++ .../mochitest/ajax/offline/test_missingFile.html | 53 +++ .../ajax/offline/test_missingManifest.html | 33 ++ .../mochitest/ajax/offline/test_noManifest.html | 43 ++ .../mochitest/ajax/offline/test_obsolete.html | 42 ++ .../mochitest/ajax/offline/test_offlineIFrame.html | 46 +++ .../mochitest/ajax/offline/test_offlineMode.html | 164 ++++++++ dom/tests/mochitest/ajax/offline/test_overlap.html | 35 ++ .../ajax/offline/test_redirectManifest.html | 44 +++ .../ajax/offline/test_redirectUpdateItem.html | 137 +++++++ .../ajax/offline/test_refetchManifest.html | 88 +++++ .../ajax/offline/test_simpleManifest.html | 130 ++++++ .../mochitest/ajax/offline/test_updateCheck.html | 87 ++++ .../ajax/offline/test_updatingManifest.html | 346 ++++++++++++++++ .../ajax/offline/test_xhtmlManifest.xhtml | 32 ++ .../ajax/offline/unknownSection.cacheManifest | 10 + .../offline/unknownSection.cacheManifest^headers^ | 2 + .../mochitest/ajax/offline/updatingIframe.sjs | 45 +++ .../mochitest/ajax/offline/updatingImplicit.html | 53 +++ .../mochitest/ajax/offline/updatingManifest.sjs | 66 ++++ .../ajax/offline/wildcardManifest.cacheManifest | 7 + .../wildcardManifest.cacheManifest^headers^ | 2 + 94 files changed, 3946 insertions(+) create mode 100644 dom/tests/mochitest/ajax/offline/445544.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/445544.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/445544_part1.html create mode 100644 dom/tests/mochitest/ajax/offline/445544_part2.html create mode 100644 dom/tests/mochitest/ajax/offline/460353_iframe_nomanifest.html create mode 100644 dom/tests/mochitest/ajax/offline/460353_iframe_ownmanifest.html create mode 100644 dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html create mode 100644 dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/744719.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/744719.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/bypass.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/bypass.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/bypass.html create mode 100644 dom/tests/mochitest/ajax/offline/changing1Hour.sjs create mode 100644 dom/tests/mochitest/ajax/offline/changing1Sec.sjs create mode 100644 dom/tests/mochitest/ajax/offline/changingManifest.sjs create mode 100644 dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs create mode 100644 dom/tests/mochitest/ajax/offline/explicitRedirect.sjs create mode 100644 dom/tests/mochitest/ajax/offline/fallback.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/fallback.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/fallback.html create mode 100644 dom/tests/mochitest/ajax/offline/fallback2.html create mode 100644 dom/tests/mochitest/ajax/offline/fallbackTop.html create mode 100644 dom/tests/mochitest/ajax/offline/foreign1.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/foreign1.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/foreign2.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/foreign2.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/foreign2.html create mode 100644 dom/tests/mochitest/ajax/offline/jupiter.jpg create mode 100644 dom/tests/mochitest/ajax/offline/manifestRedirect.sjs create mode 100644 dom/tests/mochitest/ajax/offline/missing.html create mode 100644 dom/tests/mochitest/ajax/offline/missingFile.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/missingFile.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/mochitest.ini create mode 100644 dom/tests/mochitest/ajax/offline/namespace1/opp.html create mode 100644 dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs create mode 100644 dom/tests/mochitest/ajax/offline/namespace1/script.js create mode 100644 dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html create mode 100644 dom/tests/mochitest/ajax/offline/namespace1/sub/script1.js create mode 100644 dom/tests/mochitest/ajax/offline/namespace1/sub2/script2.js create mode 100644 dom/tests/mochitest/ajax/offline/namespace2/script3.js create mode 100644 dom/tests/mochitest/ajax/offline/notonwhitelist.html create mode 100644 dom/tests/mochitest/ajax/offline/obsolete.html create mode 100644 dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs create mode 100644 dom/tests/mochitest/ajax/offline/offlineChild.html create mode 100644 dom/tests/mochitest/ajax/offline/offlineTests.js create mode 100644 dom/tests/mochitest/ajax/offline/onwhitelist.html create mode 100644 dom/tests/mochitest/ajax/offline/onwhitelist.html^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/overlap.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/overlap.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/redirects.sjs create mode 100644 dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/subresource744719.html create mode 100644 dom/tests/mochitest/ajax/offline/test_badManifestMagic.html create mode 100644 dom/tests/mochitest/ajax/offline/test_bug445544.html create mode 100644 dom/tests/mochitest/ajax/offline/test_bug460353.html create mode 100644 dom/tests/mochitest/ajax/offline/test_bug474696.html create mode 100644 dom/tests/mochitest/ajax/offline/test_bug544462.html create mode 100644 dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html create mode 100644 dom/tests/mochitest/ajax/offline/test_bug744719.html create mode 100644 dom/tests/mochitest/ajax/offline/test_bug765203.html create mode 100644 dom/tests/mochitest/ajax/offline/test_bypass.html create mode 100644 dom/tests/mochitest/ajax/offline/test_cancelOfflineCache.html create mode 100644 dom/tests/mochitest/ajax/offline/test_changingManifest.html create mode 100644 dom/tests/mochitest/ajax/offline/test_fallback.html create mode 100644 dom/tests/mochitest/ajax/offline/test_foreign.html create mode 100644 dom/tests/mochitest/ajax/offline/test_identicalManifest.html create mode 100644 dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html create mode 100644 dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html create mode 100644 dom/tests/mochitest/ajax/offline/test_missingFile.html create mode 100644 dom/tests/mochitest/ajax/offline/test_missingManifest.html create mode 100644 dom/tests/mochitest/ajax/offline/test_noManifest.html create mode 100644 dom/tests/mochitest/ajax/offline/test_obsolete.html create mode 100644 dom/tests/mochitest/ajax/offline/test_offlineIFrame.html create mode 100644 dom/tests/mochitest/ajax/offline/test_offlineMode.html create mode 100644 dom/tests/mochitest/ajax/offline/test_overlap.html create mode 100644 dom/tests/mochitest/ajax/offline/test_redirectManifest.html create mode 100755 dom/tests/mochitest/ajax/offline/test_redirectUpdateItem.html create mode 100644 dom/tests/mochitest/ajax/offline/test_refetchManifest.html create mode 100644 dom/tests/mochitest/ajax/offline/test_simpleManifest.html create mode 100644 dom/tests/mochitest/ajax/offline/test_updateCheck.html create mode 100644 dom/tests/mochitest/ajax/offline/test_updatingManifest.html create mode 100644 dom/tests/mochitest/ajax/offline/test_xhtmlManifest.xhtml create mode 100644 dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest^headers^ create mode 100644 dom/tests/mochitest/ajax/offline/updatingIframe.sjs create mode 100644 dom/tests/mochitest/ajax/offline/updatingImplicit.html create mode 100644 dom/tests/mochitest/ajax/offline/updatingManifest.sjs create mode 100644 dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest create mode 100644 dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest^headers^ (limited to 'dom/tests/mochitest/ajax/offline') diff --git a/dom/tests/mochitest/ajax/offline/445544.cacheManifest b/dom/tests/mochitest/ajax/offline/445544.cacheManifest new file mode 100644 index 000000000..eb957d3df --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/445544.cacheManifest @@ -0,0 +1,8 @@ +CACHE MANIFEST +http://mochi.test:8888/tests/SimpleTest/SimpleTest.js +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js + +test_bug445544.html +445544_part1.html + +# not including 445544_part2.html diff --git a/dom/tests/mochitest/ajax/offline/445544.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/445544.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/445544.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/445544_part1.html b/dom/tests/mochitest/ajax/offline/445544_part1.html new file mode 100644 index 000000000..d5219e4b7 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/445544_part1.html @@ -0,0 +1,9 @@ + + +testing navigation part 1 + + + +testing navigation... + + diff --git a/dom/tests/mochitest/ajax/offline/445544_part2.html b/dom/tests/mochitest/ajax/offline/445544_part2.html new file mode 100644 index 000000000..74dec4a9a --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/445544_part2.html @@ -0,0 +1,9 @@ + + +testing navigation part 2 + + + +success. + + diff --git a/dom/tests/mochitest/ajax/offline/460353_iframe_nomanifest.html b/dom/tests/mochitest/ajax/offline/460353_iframe_nomanifest.html new file mode 100644 index 000000000..75b297bbd --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/460353_iframe_nomanifest.html @@ -0,0 +1,9 @@ + + +Bug 460353, iframe with no manifest reference + + + + This is an iframe without a manifest reference + + diff --git a/dom/tests/mochitest/ajax/offline/460353_iframe_ownmanifest.html b/dom/tests/mochitest/ajax/offline/460353_iframe_ownmanifest.html new file mode 100644 index 000000000..3959510ab --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/460353_iframe_ownmanifest.html @@ -0,0 +1,37 @@ + + +Bug 460353, iframe with a different manifest reference + + + + + + This is an iframe with a different manifest reference + + diff --git a/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html b/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html new file mode 100644 index 000000000..de357827b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html @@ -0,0 +1,25 @@ + + +Bug 460353, iframe with a different manifest reference + + + + + + This is an iframe with the same manifest reference + + diff --git a/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest b/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest new file mode 100644 index 000000000..a8a7a3bf6 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest @@ -0,0 +1,37 @@ +CACHE MANIFEST + +http://mochi.test:8888/tests/SimpleTest/SimpleTest.js +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js + +# more than 15 what is a number of parallel loads +subresource744719.html?001 +subresource744719.html?002 +subresource744719.html?003 +subresource744719.html?004 +subresource744719.html?005 +subresource744719.html?006 +subresource744719.html?007 +subresource744719.html?008 +subresource744719.html?009 +# this one is non existing and should cancel the load +nonexistent744719.html?010 +subresource744719.html?011 +subresource744719.html?012 +subresource744719.html?013 +subresource744719.html?014 +subresource744719.html?015 +subresource744719.html?016 +subresource744719.html?017 +subresource744719.html?018 +subresource744719.html?019 +subresource744719.html?020 +subresource744719.html?021 +subresource744719.html?022 +subresource744719.html?023 +subresource744719.html?024 +subresource744719.html?025 +subresource744719.html?026 +subresource744719.html?027 +subresource744719.html?028 +subresource744719.html?029 +subresource744719.html?030 diff --git a/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/744719.cacheManifest b/dom/tests/mochitest/ajax/offline/744719.cacheManifest new file mode 100644 index 000000000..c8246cb44 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/744719.cacheManifest @@ -0,0 +1,36 @@ +CACHE MANIFEST + +http://mochi.test:8888/tests/SimpleTest/SimpleTest.js +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js + +# more than 15 what is a number of parallel loads +subresource744719.html?001 +subresource744719.html?002 +subresource744719.html?003 +subresource744719.html?004 +subresource744719.html?005 +subresource744719.html?006 +subresource744719.html?007 +subresource744719.html?008 +subresource744719.html?009 +subresource744719.html?010 +subresource744719.html?011 +subresource744719.html?012 +subresource744719.html?013 +subresource744719.html?014 +subresource744719.html?015 +subresource744719.html?016 +subresource744719.html?017 +subresource744719.html?018 +subresource744719.html?019 +subresource744719.html?020 +subresource744719.html?021 +subresource744719.html?022 +subresource744719.html?023 +subresource744719.html?024 +subresource744719.html?025 +subresource744719.html?026 +subresource744719.html?027 +subresource744719.html?028 +subresource744719.html?029 +subresource744719.html?030 diff --git a/dom/tests/mochitest/ajax/offline/744719.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/744719.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/744719.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest b/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest new file mode 100644 index 000000000..18d84ab6e --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest @@ -0,0 +1,3 @@ +# This doesn't start with the magic cache manifest line. +http://mochi.test:8888/tests/SimpleTest/SimpleTest.js +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js diff --git a/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/bypass.cacheManifest b/dom/tests/mochitest/ajax/offline/bypass.cacheManifest new file mode 100644 index 000000000..ec31a901d --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/bypass.cacheManifest @@ -0,0 +1,7 @@ +CACHE MANIFEST + +bypass.html + +NETWORK: +namespace1/sub +namespace2 diff --git a/dom/tests/mochitest/ajax/offline/bypass.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/bypass.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/bypass.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/bypass.html b/dom/tests/mochitest/ajax/offline/bypass.html new file mode 100644 index 000000000..f5bf71e9e --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/bypass.html @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/changing1Hour.sjs b/dom/tests/mochitest/ajax/offline/changing1Hour.sjs new file mode 100644 index 000000000..2a1035965 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/changing1Hour.sjs @@ -0,0 +1,8 @@ +function handleRequest(request, response) +{ + response.setStatusLine(request.httpVersion, 200, "Ok"); + response.setHeader("Content-Type", "text/plain"); + response.setHeader("Cache-Control", "max-age=3600"); + + response.write(Date.now()); +} diff --git a/dom/tests/mochitest/ajax/offline/changing1Sec.sjs b/dom/tests/mochitest/ajax/offline/changing1Sec.sjs new file mode 100644 index 000000000..cb9428b6c --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/changing1Sec.sjs @@ -0,0 +1,9 @@ +function handleRequest(request, response) +{ + response.setStatusLine(request.httpVersion, 200, "Ok"); + response.setHeader("Content-Type", "text/plain"); + response.setHeader("Cache-Control", "max-age=1"); + + response.write(Date.now()); +} + diff --git a/dom/tests/mochitest/ajax/offline/changingManifest.sjs b/dom/tests/mochitest/ajax/offline/changingManifest.sjs new file mode 100644 index 000000000..4d178d1dd --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/changingManifest.sjs @@ -0,0 +1,27 @@ +function handleRequest(request, response) +{ + var match = request.queryString.match(/^state=(.*)$/); + if (match) + { + response.setStatusLine(request.httpVersion, 204, "No content"); + setState("offline.changingManifest", match[1]); + } + + if (request.queryString == "") + { + response.setStatusLine(request.httpVersion, 200, "Ok"); + response.setHeader("Content-Type", "text/cache-manifest"); + response.setHeader("Cache-Control", "no-cache"); + response.write( + "CACHE MANIFEST\n" + + "# v" + getState("offline.changingManifest") + "\n" + + "changing1Hour.sjs\n" + + "changing1Sec.sjs\n"); + + if (getState("offline.changingManifest") != "2") { + response.write( + "NETWORK:\n" + + "onwhitelist.html\n"); + } + } +} diff --git a/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs b/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs new file mode 100644 index 000000000..1ce865a8a --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs @@ -0,0 +1,27 @@ +function handleRequest(request, response) +{ + var match = request.queryString.match(/^state=(.*)$/); + if (match) + { + response.setStatusLine(request.httpVersion, 200, "No content"); + setState("state", match[1]); + response.write("state='" + match[1] + "'"); + } + + if (request.queryString == "") + { + switch (getState("state")) + { + case "": // The default value + response.setStatusLine(request.httpVersion, 307, "Moved temporarly"); + response.setHeader("Location", "http://example.com/non-existing-dynamic.html"); + response.setHeader("Content-Type", "text/html"); + break; + case "on": + response.setStatusLine(request.httpVersion, 200, "OK"); + response.setHeader("Content-Type", "text/html"); + response.write("Dynamic page"); + break; + } + } +} diff --git a/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs b/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs new file mode 100644 index 000000000..54da8be5d --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs @@ -0,0 +1,27 @@ +function handleRequest(request, response) +{ + var match = request.queryString.match(/^state=(.*)$/); + if (match) + { + response.setStatusLine(request.httpVersion, 200, "No content"); + setState("state", match[1]); + response.write("state='" + match[1] + "'"); + } + + if (request.queryString == "") + { + switch (getState("state")) + { + case "": // The default value + response.setStatusLine(request.httpVersion, 307, "Moved temporarly"); + response.setHeader("Location", "http://example.com/non-existing-explicit.html"); + response.setHeader("Content-Type", "text/html"); + break; + case "on": + response.setStatusLine(request.httpVersion, 200, "OK"); + response.setHeader("Content-Type", "text/html"); + response.write("Explicit page"); + break; + } + } +} diff --git a/dom/tests/mochitest/ajax/offline/fallback.cacheManifest b/dom/tests/mochitest/ajax/offline/fallback.cacheManifest new file mode 100644 index 000000000..ec31b2a4a --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/fallback.cacheManifest @@ -0,0 +1,11 @@ +CACHE MANIFEST +http://mochi.test:8888/tests/SimpleTest/SimpleTest.js +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js + +FALLBACK: +namespace1/ fallback.html +namespace1/sub/ fallback2.html +namespace2/ fallbackTop.html + +NETWORK: +onwhitelist.html diff --git a/dom/tests/mochitest/ajax/offline/fallback.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/fallback.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/fallback.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/fallback.html b/dom/tests/mochitest/ajax/offline/fallback.html new file mode 100644 index 000000000..4f5b39e31 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/fallback.html @@ -0,0 +1,12 @@ + + +fallback page for fallback test + + + + + + +Fallback page + + diff --git a/dom/tests/mochitest/ajax/offline/fallback2.html b/dom/tests/mochitest/ajax/offline/fallback2.html new file mode 100644 index 000000000..11890f65d --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/fallback2.html @@ -0,0 +1,12 @@ + + +fallback page for fallback test + + + + + + +Sub fallback page + + diff --git a/dom/tests/mochitest/ajax/offline/fallbackTop.html b/dom/tests/mochitest/ajax/offline/fallbackTop.html new file mode 100644 index 000000000..5de4316c0 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/fallbackTop.html @@ -0,0 +1,8 @@ + + +Fallback for top window + + + + + diff --git a/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest b/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest new file mode 100644 index 000000000..4b713f844 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest @@ -0,0 +1,3 @@ +CACHE MANIFEST + +foreign2.html diff --git a/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest b/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest new file mode 100644 index 000000000..4b713f844 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest @@ -0,0 +1,3 @@ +CACHE MANIFEST + +foreign2.html diff --git a/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/foreign2.html b/dom/tests/mochitest/ajax/offline/foreign2.html new file mode 100644 index 000000000..40d5dc11d --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/foreign2.html @@ -0,0 +1,69 @@ + + +Foreign page 2 + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/jupiter.jpg b/dom/tests/mochitest/ajax/offline/jupiter.jpg new file mode 100644 index 000000000..cddf589d5 Binary files /dev/null and b/dom/tests/mochitest/ajax/offline/jupiter.jpg differ diff --git a/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs b/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs new file mode 100644 index 000000000..55326a4cf --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs @@ -0,0 +1,6 @@ +function handleRequest(request, response) +{ + response.setStatusLine(request.httpVersion, 307, "Moved temporarly"); + response.setHeader("Location", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updating.cacheManifest"); + response.setHeader("Content-Type", "text/cache-manifest"); +} diff --git a/dom/tests/mochitest/ajax/offline/missing.html b/dom/tests/mochitest/ajax/offline/missing.html new file mode 100644 index 000000000..3e4fef759 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/missing.html @@ -0,0 +1,24 @@ + + +missing test + + + + +

+ diff --git a/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest b/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest new file mode 100644 index 000000000..4fe7cacfc --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest @@ -0,0 +1,6 @@ +CACHE MANIFEST +http://mochi.test:8888/tests/SimpleTest/SimpleTest.js +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js + +# The following item doesn't exist, and will cause an update error. +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/doesntExist.html diff --git a/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/mochitest.ini b/dom/tests/mochitest/ajax/offline/mochitest.ini new file mode 100644 index 000000000..961b143b6 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/mochitest.ini @@ -0,0 +1,101 @@ +[DEFAULT] +skip-if = toolkit == 'android' || e10s #SLOW_DIRECTORY +support-files = + 445544.cacheManifest + 445544.cacheManifest^headers^ + 445544_part1.html + 445544_part2.html + 460353_iframe_nomanifest.html + 460353_iframe_ownmanifest.html + 460353_iframe_samemanifest.html + 744719-cancel.cacheManifest + 744719-cancel.cacheManifest^headers^ + 744719.cacheManifest + 744719.cacheManifest^headers^ + badManifestMagic.cacheManifest + badManifestMagic.cacheManifest^headers^ + bypass.cacheManifest + bypass.cacheManifest^headers^ + bypass.html + changing1Hour.sjs + changing1Sec.sjs + changingManifest.sjs + dynamicRedirect.sjs + explicitRedirect.sjs + fallback.cacheManifest + fallback.cacheManifest^headers^ + fallback.html + fallback2.html + fallbackTop.html + foreign1.cacheManifest + foreign1.cacheManifest^headers^ + foreign2.cacheManifest + foreign2.cacheManifest^headers^ + foreign2.html + jupiter.jpg + manifestRedirect.sjs + missing.html + missingFile.cacheManifest + missingFile.cacheManifest^headers^ + notonwhitelist.html + obsolete.html + obsoletingManifest.sjs + offlineChild.html + offlineTests.js + onwhitelist.html + onwhitelist.html^headers^ + overlap.cacheManifest + overlap.cacheManifest^headers^ + redirects.sjs + simpleManifest.cacheManifest + simpleManifest.cacheManifest^headers^ + subresource744719.html + unknownSection.cacheManifest + unknownSection.cacheManifest^headers^ + updatingIframe.sjs + updatingImplicit.html + updatingManifest.sjs + wildcardManifest.cacheManifest + wildcardManifest.cacheManifest^headers^ + namespace1/opp.html + namespace1/script.js + namespace1/redirectToDifferentOrigin.sjs + namespace1/sub/opp.html + namespace1/sub/script1.js + namespace1/sub2/script2.js + namespace2/script3.js + +[test_badManifestMagic.html] +[test_bug445544.html] +[test_bug460353.html] +[test_bug474696.html] +[test_bug544462.html] +[test_bug744719-cancel.html] +[test_bug744719.html] +[test_bug765203.html] +[test_bypass.html] +[test_cancelOfflineCache.html] +[test_changingManifest.html] +[test_fallback.html] +[test_foreign.html] +[test_identicalManifest.html] +[test_lowDeviceStorage.html] +[test_lowDeviceStorageDuringUpdate.html] +[test_missingFile.html] +[test_missingManifest.html] +[test_noManifest.html] +[test_obsolete.html] +[test_offlineIFrame.html] +[test_offlineMode.html] +skip-if = true # disabled due to bug 656943 +[test_overlap.html] +[test_redirectManifest.html] +[test_redirectUpdateItem.html] +[test_refetchManifest.html] +[test_simpleManifest.html] +skip-if = toolkit == 'android' #TIMED_OUT +[test_updateCheck.html] +[test_updatingManifest.html] +skip-if = toolkit == 'android' #TIMED_OUT +[test_xhtmlManifest.xhtml] +skip-if = toolkit == 'android' #TIMED_OUT diff --git a/dom/tests/mochitest/ajax/offline/namespace1/opp.html b/dom/tests/mochitest/ajax/offline/namespace1/opp.html new file mode 100644 index 000000000..daf4abf21 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/namespace1/opp.html @@ -0,0 +1,9 @@ + + +Falback namespace page 1 + + + +Page in fall back namespace No. 1 + + diff --git a/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs b/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs new file mode 100644 index 000000000..22e9e146c --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs @@ -0,0 +1,6 @@ +function handleRequest(request, response) +{ + response.setStatusLine(request.httpVersion, 307, "Moved temporarly"); + response.setHeader("Location", "http://example.org/tests/dom/tests/mochitest/ajax/offline/fallback2.html"); + response.setHeader("Content-Type", "text/html"); +} diff --git a/dom/tests/mochitest/ajax/offline/namespace1/script.js b/dom/tests/mochitest/ajax/offline/namespace1/script.js new file mode 100644 index 000000000..61ffb174f --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/namespace1/script.js @@ -0,0 +1,4 @@ +function scriptNo0Function() +{ + return true; +} diff --git a/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html b/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html new file mode 100644 index 000000000..2d0996553 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html @@ -0,0 +1,9 @@ + + +Falback namespace page 2 + + + +Page in fall back namespace No. 2 + + diff --git a/dom/tests/mochitest/ajax/offline/namespace1/sub/script1.js b/dom/tests/mochitest/ajax/offline/namespace1/sub/script1.js new file mode 100644 index 000000000..30829316b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/namespace1/sub/script1.js @@ -0,0 +1,4 @@ +function scriptNo1Function() +{ + return true; +} diff --git a/dom/tests/mochitest/ajax/offline/namespace1/sub2/script2.js b/dom/tests/mochitest/ajax/offline/namespace1/sub2/script2.js new file mode 100644 index 000000000..586d39a19 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/namespace1/sub2/script2.js @@ -0,0 +1,4 @@ +function scriptNo2Function() +{ + return true; +} diff --git a/dom/tests/mochitest/ajax/offline/namespace2/script3.js b/dom/tests/mochitest/ajax/offline/namespace2/script3.js new file mode 100644 index 000000000..20dd8b97d --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/namespace2/script3.js @@ -0,0 +1,4 @@ +function scriptNo3Function() +{ + return true; +} diff --git a/dom/tests/mochitest/ajax/offline/notonwhitelist.html b/dom/tests/mochitest/ajax/offline/notonwhitelist.html new file mode 100644 index 000000000..7b61c6843 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/notonwhitelist.html @@ -0,0 +1,9 @@ + + +Page NOT on whitelist + + + +Page NOT on whitelist + + diff --git a/dom/tests/mochitest/ajax/offline/obsolete.html b/dom/tests/mochitest/ajax/offline/obsolete.html new file mode 100644 index 000000000..5f0106d3a --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/obsolete.html @@ -0,0 +1,69 @@ + + +obsolete test + + + + +

+ diff --git a/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs b/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs new file mode 100644 index 000000000..f53dbeb79 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs @@ -0,0 +1,31 @@ +var manifest = + "CACHE MANIFEST\n" + + "obsolete.html\n"; + +function handleRequest(request, response) +{ + var match = request.queryString.match(/^state=(.*)$/); + if (match) + { + response.setStatusLine(request.httpVersion, 204, "No content"); + response.setHeader("Cache-Control", "no-cache"); + setState("offline.obsoletingManifest", match[1]); + } + + if (request.queryString == "") + { + switch (getState("offline.obsoletingManifest")) + { + case "": // The default value + response.setStatusLine(request.httpVersion, 404, "Not found"); + response.setHeader("Cache-Control", "no-cache"); + break; + case "manifestPresent": + response.setStatusLine(request.httpVersion, 200, "Ok"); + response.setHeader("Content-Type", "text/cache-manifest"); + response.setHeader("Cache-Control", "no-cache"); + response.write(manifest); + break; + } + } +} diff --git a/dom/tests/mochitest/ajax/offline/offlineChild.html b/dom/tests/mochitest/ajax/offline/offlineChild.html new file mode 100644 index 000000000..d70a060a1 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/offlineChild.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/offlineTests.js b/dom/tests/mochitest/ajax/offline/offlineTests.js new file mode 100644 index 000000000..f239cd574 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/offlineTests.js @@ -0,0 +1,436 @@ +// Utility functions for offline tests. +var Cc = SpecialPowers.Cc; +var Ci = SpecialPowers.Ci; +var Cu = SpecialPowers.Cu; +var LoadContextInfo = Cc["@mozilla.org/load-context-info-factory;1"].getService(Ci.nsILoadContextInfoFactory); +var CommonUtils = Cu.import("resource://services-common/utils.js", {}).CommonUtils; + +const kNetBase = 2152398848; // 0x804B0000 +var NS_ERROR_CACHE_KEY_NOT_FOUND = kNetBase + 61; +var NS_ERROR_CACHE_KEY_WAIT_FOR_VALIDATION = kNetBase + 64; + +// Reading the contents of multiple cache entries asynchronously +function OfflineCacheContents(urls) { + this.urls = urls; + this.contents = {}; +} + +OfflineCacheContents.prototype = { +QueryInterface: function(iid) { + if (!iid.equals(Ci.nsISupports) && + !iid.equals(Ci.nsICacheEntryOpenCallback)) { + throw Cr.NS_ERROR_NO_INTERFACE; + } + return this; + }, +onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; }, +onCacheEntryAvailable: function(desc, isnew, applicationCache, status) { + if (!desc) { + this.fetch(this.callback); + return; + } + + var stream = desc.openInputStream(0); + var sstream = Cc["@mozilla.org/scriptableinputstream;1"] + .createInstance(SpecialPowers.Ci.nsIScriptableInputStream); + sstream.init(stream); + this.contents[desc.key] = sstream.read(sstream.available()); + sstream.close(); + desc.close(); + this.fetch(this.callback); + }, + +fetch: function(callback) +{ + this.callback = callback; + if (this.urls.length == 0) { + callback(this.contents); + return; + } + + var url = this.urls.shift(); + var self = this; + + var cacheStorage = OfflineTest.getActiveStorage(); + cacheStorage.asyncOpenURI(CommonUtils.makeURI(url), "", Ci.nsICacheStorage.OPEN_READONLY, this); +} +}; + +var OfflineTest = { + +_allowedByDefault: false, + +_hasSlave: false, + +// The window where test results should be sent. +_masterWindow: null, + +// Array of all PUT overrides on the server +_pathOverrides: [], + +// SJSs whom state was changed to be reverted on teardown +_SJSsStated: [], + +setupChild: function() +{ + if (this._allowedByDefault) { + this._masterWindow = window; + return true; + } + + if (window.parent.OfflineTest._hasSlave) { + return false; + } + + this._masterWindow = window.top; + + return true; +}, + +/** + * Setup the tests. This will reload the current page in a new window + * if necessary. + * + * @return boolean Whether this window is the slave window + * to actually run the test in. + */ +setup: function() +{ + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + try { + this._allowedByDefault = SpecialPowers.getBoolPref("offline-apps.allow_by_default"); + } catch (e) {} + + if (this._allowedByDefault) { + this._masterWindow = window; + + return true; + } + + if (!window.opener || !window.opener.OfflineTest || + !window.opener.OfflineTest._hasSlave) { + // Offline applications must be toplevel windows and have the + // offline-app permission. Because we were loaded without the + // offline-app permission and (probably) in an iframe, we need to + // enable the pref and spawn a new window to perform the actual + // tests. It will use this window to report successes and + // failures. + + if (SpecialPowers.testPermission("offline-app", Ci.nsIPermissionManager.ALLOW_ACTION, document)) { + ok(false, "Previous test failed to clear offline-app permission! Expect failures."); + } + SpecialPowers.addPermission("offline-app", Ci.nsIPermissionManager.ALLOW_ACTION, document); + + // Tests must run as toplevel windows. Open a slave window to run + // the test. + this._hasSlave = true; + window.open(window.location, "offlinetest"); + + return false; + } + + this._masterWindow = window.opener; + + return true; +}, + +teardownAndFinish: function() +{ + this.teardown(function(self) { self.finish(); }); +}, + +teardown: function(callback) +{ + // First wait for any pending scheduled updates to finish + this.waitForUpdates(function(self) { + // Remove the offline-app permission we gave ourselves. + + SpecialPowers.removePermission("offline-app", window.document); + + // Clear all overrides on the server + for (override in self._pathOverrides) + self.deleteData(self._pathOverrides[override]); + for (statedSJS in self._SJSsStated) + self.setSJSState(self._SJSsStated[statedSJS], ""); + + self.clear(); + callback(self); + }); +}, + +finish: function() +{ + if (this._allowedByDefault) { + SimpleTest.executeSoon(SimpleTest.finish); + } else if (this._masterWindow) { + // Slave window: pass control back to master window, close itself. + this._masterWindow.SimpleTest.executeSoon(this._masterWindow.OfflineTest.finish); + window.close(); + } else { + // Master window: finish test. + SimpleTest.finish(); + } +}, + +// +// Mochitest wrappers - These forward tests to the proper mochitest window. +// +ok: function(condition, name, diag) +{ + return this._masterWindow.SimpleTest.ok(condition, name, diag); +}, + +is: function(a, b, name) +{ + return this._masterWindow.SimpleTest.is(a, b, name); +}, + +isnot: function(a, b, name) +{ + return this._masterWindow.SimpleTest.isnot(a, b, name); +}, + +todo: function(a, name) +{ + return this._masterWindow.SimpleTest.todo(a, name); +}, + +clear: function() +{ + // XXX: maybe we should just wipe out the entire disk cache. + var applicationCache = this.getActiveCache(); + if (applicationCache) { + applicationCache.discard(); + } +}, + +waitForUpdates: function(callback) +{ + var self = this; + var observer = { + notified: false, + observe: function(subject, topic, data) { + if (subject) { + subject.QueryInterface(SpecialPowers.Ci.nsIOfflineCacheUpdate); + dump("Update of " + subject.manifestURI.spec + " finished\n"); + } + + SimpleTest.executeSoon(function() { + if (observer.notified) { + return; + } + + var updateservice = Cc["@mozilla.org/offlinecacheupdate-service;1"] + .getService(SpecialPowers.Ci.nsIOfflineCacheUpdateService); + var updatesPending = updateservice.numUpdates; + if (updatesPending == 0) { + try { + SpecialPowers.removeObserver(observer, "offline-cache-update-completed"); + } catch(ex) {} + dump("All pending updates done\n"); + observer.notified = true; + callback(self); + return; + } + + dump("Waiting for " + updateservice.numUpdates + " update(s) to finish\n"); + }); + } + } + + SpecialPowers.addObserver(observer, "offline-cache-update-completed", false); + + // Call now to check whether there are some updates scheduled + observer.observe(); +}, + +failEvent: function(e) +{ + OfflineTest.ok(false, "Unexpected event: " + e.type); +}, + +// The offline API as specified has no way to watch the load of a resource +// added with applicationCache.mozAdd(). +waitForAdd: function(url, onFinished) { + // Check every half second for ten seconds. + var numChecks = 20; + + var waitForAddListener = { + onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; }, + onCacheEntryAvailable: function(entry, isnew, applicationCache, status) { + if (entry) { + entry.close(); + onFinished(); + return; + } + + if (--numChecks == 0) { + onFinished(); + return; + } + + setTimeout(OfflineTest.priv(waitFunc), 500); + } + }; + + var waitFunc = function() { + var cacheStorage = OfflineTest.getActiveStorage(); + cacheStorage.asyncOpenURI(CommonUtils.makeURI(url), "", Ci.nsICacheStorage.OPEN_READONLY, waitForAddListener); + } + + setTimeout(this.priv(waitFunc), 500); +}, + +manifestURL: function(overload) +{ + var manifestURLspec; + if (overload) { + manifestURLspec = overload; + } else { + var win = window; + while (win && !win.document.documentElement.getAttribute("manifest")) { + if (win == win.parent) + break; + win = win.parent; + } + if (win) + manifestURLspec = win.document.documentElement.getAttribute("manifest"); + } + + var ios = Cc["@mozilla.org/network/io-service;1"] + .getService(Ci.nsIIOService) + + var baseURI = ios.newURI(window.location.href, null, null); + return ios.newURI(manifestURLspec, null, baseURI); +}, + +loadContext: function() +{ + return SpecialPowers.wrap(window).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor) + .getInterface(SpecialPowers.Ci.nsIWebNavigation) + .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor) + .getInterface(SpecialPowers.Ci.nsILoadContext); +}, + +loadContextInfo: function() +{ + return LoadContextInfo.fromLoadContext(this.loadContext(), false); +}, + +getActiveCache: function(overload) +{ + // Note that this is the current active cache in the cache stack, not the + // one associated with this window. + var serv = Cc["@mozilla.org/network/application-cache-service;1"] + .getService(Ci.nsIApplicationCacheService); + var groupID = serv.buildGroupIDForInfo(this.manifestURL(overload), this.loadContextInfo()); + return serv.getActiveCache(groupID); +}, + +getActiveStorage: function() +{ + var cache = this.getActiveCache(); + if (!cache) { + return null; + } + + var cacheService = Cc["@mozilla.org/netwerk/cache-storage-service;1"] + .getService(Ci.nsICacheStorageService); + return cacheService.appCacheStorage(LoadContextInfo.default, cache); +}, + +priv: function(func) +{ + var self = this; + return function() { + func(arguments); + } +}, + +checkCacheEntries: function(entries, callback) +{ + var checkNextEntry = function() { + if (entries.length == 0) { + setTimeout(OfflineTest.priv(callback), 0); + } else { + OfflineTest.checkCache(entries[0][0], entries[0][1], checkNextEntry); + entries.shift(); + } + } + + checkNextEntry(); +}, + +checkCache: function(url, expectEntry, callback) +{ + var cacheStorage = this.getActiveStorage(); + this._checkCache(cacheStorage, url, expectEntry, callback); +}, + +_checkCache: function(cacheStorage, url, expectEntry, callback) +{ + if (!cacheStorage) { + if (expectEntry) { + this.ok(false, url + " should exist in the offline cache (no session)"); + } else { + this.ok(true, url + " should not exist in the offline cache (no session)"); + } + if (callback) setTimeout(this.priv(callback), 0); + return; + } + + var _checkCacheListener = { + onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; }, + onCacheEntryAvailable: function(entry, isnew, applicationCache, status) { + if (entry) { + if (expectEntry) { + OfflineTest.ok(true, url + " should exist in the offline cache"); + } else { + OfflineTest.ok(false, url + " should not exist in the offline cache"); + } + entry.close(); + } else { + if (status == NS_ERROR_CACHE_KEY_NOT_FOUND) { + if (expectEntry) { + OfflineTest.ok(false, url + " should exist in the offline cache"); + } else { + OfflineTest.ok(true, url + " should not exist in the offline cache"); + } + } else if (status == NS_ERROR_CACHE_KEY_WAIT_FOR_VALIDATION) { + // There was a cache key that we couldn't access yet, that's good enough. + if (expectEntry) { + OfflineTest.ok(!mustBeValid, url + " should exist in the offline cache"); + } else { + OfflineTest.ok(mustBeValid, url + " should not exist in the offline cache"); + } + } else { + OfflineTest.ok(false, "got invalid error for " + url); + } + } + if (callback) setTimeout(OfflineTest.priv(callback), 0); + } + }; + + cacheStorage.asyncOpenURI(CommonUtils.makeURI(url), "", Ci.nsICacheStorage.OPEN_READONLY, _checkCacheListener); +}, + +setSJSState: function(sjsPath, stateQuery) +{ + var client = new XMLHttpRequest(); + client.open("GET", sjsPath + "?state=" + stateQuery, false); + + var appcachechannel = SpecialPowers.wrap(client).channel.QueryInterface(Ci.nsIApplicationCacheChannel); + appcachechannel.chooseApplicationCache = false; + appcachechannel.inheritApplicationCache = false; + appcachechannel.applicationCache = null; + + client.send(); + + if (stateQuery == "") + delete this._SJSsStated[sjsPath]; + else + this._SJSsStated.push(sjsPath); +} + +}; diff --git a/dom/tests/mochitest/ajax/offline/onwhitelist.html b/dom/tests/mochitest/ajax/offline/onwhitelist.html new file mode 100644 index 000000000..9e40cadbf --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/onwhitelist.html @@ -0,0 +1,9 @@ + + +Page on whitelist + + + +Page on whitelist + + diff --git a/dom/tests/mochitest/ajax/offline/onwhitelist.html^headers^ b/dom/tests/mochitest/ajax/offline/onwhitelist.html^headers^ new file mode 100644 index 000000000..9e23c73b7 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/onwhitelist.html^headers^ @@ -0,0 +1 @@ +Cache-Control: no-cache diff --git a/dom/tests/mochitest/ajax/offline/overlap.cacheManifest b/dom/tests/mochitest/ajax/offline/overlap.cacheManifest new file mode 100644 index 000000000..e75e48aff --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/overlap.cacheManifest @@ -0,0 +1,12 @@ +CACHE MANIFEST + +CACHE: +http://mochi.test:8888/tests/SimpleTest/SimpleTest.js +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js + +NETWORK: +bogus/specific/ + +FALLBACK: +# Fall back for a bogus namespace +bogus/ fallback.html diff --git a/dom/tests/mochitest/ajax/offline/overlap.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/overlap.cacheManifest^headers^ new file mode 100644 index 000000000..257f2eb60 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/overlap.cacheManifest^headers^ @@ -0,0 +1 @@ +Content-Type: text/cache-manifest diff --git a/dom/tests/mochitest/ajax/offline/redirects.sjs b/dom/tests/mochitest/ajax/offline/redirects.sjs new file mode 100644 index 000000000..08a300157 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/redirects.sjs @@ -0,0 +1,52 @@ +ver1manifest = + "CACHE MANIFEST\n" + + "# v1\n" + + "\n" + + "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs"; + +ver2manifest = + "CACHE MANIFEST\n" + + "# v2\n" + + "\n" + + "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs"; + +ver3manifest = + "CACHE MANIFEST\n" + + "# v3\n" + + "\n" + + "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs"; + +function handleRequest(request, response) +{ + var match = request.queryString.match(/^state=(.*)$/); + if (match) + { + response.setStatusLine(request.httpVersion, 204, "No content"); + setState("state", match[1]); + } + + if (request.queryString == "") + { + response.setStatusLine(request.httpVersion, 200, "Ok"); + response.setHeader("Content-Type", "text/cache-manifest"); + response.setHeader("Cache-Control", "no-cache"); + switch (getState("state")) + { + case "": // The default value + response.write(ver1manifest + "\n#" + getState("state")); + break; + case "second": + response.write(ver2manifest + "\n#" + getState("state")); + break; + case "third": + response.write(ver3manifest + "\n#" + getState("state")); + break; + } + } +} diff --git a/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest b/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest new file mode 100644 index 000000000..aa7bf6335 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest @@ -0,0 +1,7 @@ +CACHE MANIFEST +http://mochi.test:8888/tests/SimpleTest/SimpleTest.js +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js + +# The following item is not a valid URI and will be ignored +bad:/uri/invalid + diff --git a/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/subresource744719.html b/dom/tests/mochitest/ajax/offline/subresource744719.html new file mode 100644 index 000000000..86ba068ec --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/subresource744719.html @@ -0,0 +1 @@ +Dummy subresource \ No newline at end of file diff --git a/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html b/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html new file mode 100644 index 000000000..f7811bcd5 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html @@ -0,0 +1,53 @@ + + +bad manifest magic + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_bug445544.html b/dom/tests/mochitest/ajax/offline/test_bug445544.html new file mode 100644 index 000000000..07929a656 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_bug445544.html @@ -0,0 +1,73 @@ + + + + +Test for Bug 445544 + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_bug460353.html b/dom/tests/mochitest/ajax/offline/test_bug460353.html new file mode 100644 index 000000000..683d53d6a --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_bug460353.html @@ -0,0 +1,100 @@ + + +Bug 460353 + + + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_bug474696.html b/dom/tests/mochitest/ajax/offline/test_bug474696.html new file mode 100644 index 000000000..47b0b5202 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_bug474696.html @@ -0,0 +1,39 @@ + + +Fallback on different origin redirect test + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_bug544462.html b/dom/tests/mochitest/ajax/offline/test_bug544462.html new file mode 100644 index 000000000..1dbf9256c --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_bug544462.html @@ -0,0 +1,53 @@ + + +wildcard in network section test + + + + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html b/dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html new file mode 100644 index 000000000..53955790d --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html @@ -0,0 +1,84 @@ + + +parallel load canceled + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_bug744719.html b/dom/tests/mochitest/ajax/offline/test_bug744719.html new file mode 100644 index 000000000..2c9f5687f --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_bug744719.html @@ -0,0 +1,76 @@ + + +parallel load + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_bug765203.html b/dom/tests/mochitest/ajax/offline/test_bug765203.html new file mode 100644 index 000000000..e55d6d0d5 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_bug765203.html @@ -0,0 +1,73 @@ + + +unknown section + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_bypass.html b/dom/tests/mochitest/ajax/offline/test_bypass.html new file mode 100644 index 000000000..6ed6e2562 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_bypass.html @@ -0,0 +1,37 @@ + + +Bypass test + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_cancelOfflineCache.html b/dom/tests/mochitest/ajax/offline/test_cancelOfflineCache.html new file mode 100644 index 000000000..6a5c5c5bd --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_cancelOfflineCache.html @@ -0,0 +1,58 @@ + + +Cancel offline cache + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_changingManifest.html b/dom/tests/mochitest/ajax/offline/test_changingManifest.html new file mode 100644 index 000000000..2ff365a4a --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_changingManifest.html @@ -0,0 +1,116 @@ + + +changing manifest test + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_fallback.html b/dom/tests/mochitest/ajax/offline/test_fallback.html new file mode 100644 index 000000000..8f0fea4ed --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_fallback.html @@ -0,0 +1,130 @@ + + +Fallback entry test + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_foreign.html b/dom/tests/mochitest/ajax/offline/test_foreign.html new file mode 100644 index 000000000..cb55995e2 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_foreign.html @@ -0,0 +1,59 @@ + + +Foreign test + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_identicalManifest.html b/dom/tests/mochitest/ajax/offline/test_identicalManifest.html new file mode 100644 index 000000000..6e8f4835e --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_identicalManifest.html @@ -0,0 +1,86 @@ + + +identical manifest test + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html new file mode 100644 index 000000000..d03ef5a12 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html @@ -0,0 +1,91 @@ + + +Low device storage + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html new file mode 100644 index 000000000..88a0b4eae --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html @@ -0,0 +1,58 @@ + + +Low device storage during update + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_missingFile.html b/dom/tests/mochitest/ajax/offline/test_missingFile.html new file mode 100644 index 000000000..4a17dee28 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_missingFile.html @@ -0,0 +1,53 @@ + + +missing manifest file test + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_missingManifest.html b/dom/tests/mochitest/ajax/offline/test_missingManifest.html new file mode 100644 index 000000000..1d7bc83ec --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_missingManifest.html @@ -0,0 +1,33 @@ + + +Test missing manifest + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_noManifest.html b/dom/tests/mochitest/ajax/offline/test_noManifest.html new file mode 100644 index 000000000..5f9becf83 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_noManifest.html @@ -0,0 +1,43 @@ + + +bad manifest content type + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_obsolete.html b/dom/tests/mochitest/ajax/offline/test_obsolete.html new file mode 100644 index 000000000..b3d9d76ba --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_obsolete.html @@ -0,0 +1,42 @@ + + +Test obsolete application caches + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_offlineIFrame.html b/dom/tests/mochitest/ajax/offline/test_offlineIFrame.html new file mode 100644 index 000000000..35ca20683 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_offlineIFrame.html @@ -0,0 +1,46 @@ + + +offline iframe test + + + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_offlineMode.html b/dom/tests/mochitest/ajax/offline/test_offlineMode.html new file mode 100644 index 000000000..1d4610fb5 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_offlineMode.html @@ -0,0 +1,164 @@ + + +Offline mode test + + + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_overlap.html b/dom/tests/mochitest/ajax/offline/test_overlap.html new file mode 100644 index 000000000..3dddf16e9 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_overlap.html @@ -0,0 +1,35 @@ + + +overlapping namespaces test + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_redirectManifest.html b/dom/tests/mochitest/ajax/offline/test_redirectManifest.html new file mode 100644 index 000000000..95627e361 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_redirectManifest.html @@ -0,0 +1,44 @@ + + +Fail update on manifest redirection test + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_redirectUpdateItem.html b/dom/tests/mochitest/ajax/offline/test_redirectUpdateItem.html new file mode 100755 index 000000000..a646b33e4 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_redirectUpdateItem.html @@ -0,0 +1,137 @@ + + +Entries redirection handling during update test + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_refetchManifest.html b/dom/tests/mochitest/ajax/offline/test_refetchManifest.html new file mode 100644 index 000000000..a7205b73f --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_refetchManifest.html @@ -0,0 +1,88 @@ + + +refetch manifest test + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_simpleManifest.html b/dom/tests/mochitest/ajax/offline/test_simpleManifest.html new file mode 100644 index 000000000..508bcb516 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_simpleManifest.html @@ -0,0 +1,130 @@ + + +simple manifest test + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_updateCheck.html b/dom/tests/mochitest/ajax/offline/test_updateCheck.html new file mode 100644 index 000000000..1f0634cba --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_updateCheck.html @@ -0,0 +1,87 @@ + + +Cache update test + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_updatingManifest.html b/dom/tests/mochitest/ajax/offline/test_updatingManifest.html new file mode 100644 index 000000000..6d573a926 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_updatingManifest.html @@ -0,0 +1,346 @@ + + +Cache update test + + + + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/test_xhtmlManifest.xhtml b/dom/tests/mochitest/ajax/offline/test_xhtmlManifest.xhtml new file mode 100644 index 000000000..b3c2c30e5 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_xhtmlManifest.xhtml @@ -0,0 +1,32 @@ + + +xhtml manifest test + + + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest b/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest new file mode 100644 index 000000000..ea6da2445 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest @@ -0,0 +1,10 @@ +CACHE MANIFEST +http://mochi.test:8888/tests/SimpleTest/SimpleTest.js + +UNKNOWN-SECTION: +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg +here can be anything the current implementaion +is not able to parse at all and is just silently ignored + +CACHE: +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js diff --git a/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/dom/tests/mochitest/ajax/offline/updatingIframe.sjs b/dom/tests/mochitest/ajax/offline/updatingIframe.sjs new file mode 100644 index 000000000..91325d282 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/updatingIframe.sjs @@ -0,0 +1,45 @@ +ver1iframe = + "\n" + + "\n" + + "Update iframe\n" + + "\n" + + "\n" + + "First version of updating iframe.\n" + + "\n" + + "\n"; + +ver2iframe = + "\n" + + "\n" + + "Update iframe\n" + + "\n" + + "\n" + + "Second version of updating iframe.\n" + + "\n" + + "\n"; + +function handleRequest(request, response) +{ + var match = request.queryString.match(/^state=(.*)$/); + if (match) + { + response.setStatusLine(request.httpVersion, 204, "No content"); + setState("offline.updatingIframe", match[1]); + } + + if (request.queryString == "") + { + response.setStatusLine(request.httpVersion, 200, "Ok"); + response.setHeader("Content-Type", "text/html"); + response.setHeader("Cache-Control", "no-cache"); + switch (getState("offline.updatingIframe")) + { + case "": // The default value + response.write(ver1iframe); + break; + case "second": + response.write(ver2iframe); + break; + } + } +} diff --git a/dom/tests/mochitest/ajax/offline/updatingImplicit.html b/dom/tests/mochitest/ajax/offline/updatingImplicit.html new file mode 100644 index 000000000..6e95b4084 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/updatingImplicit.html @@ -0,0 +1,53 @@ + + +Updating implicit + + + + + + + + + + + diff --git a/dom/tests/mochitest/ajax/offline/updatingManifest.sjs b/dom/tests/mochitest/ajax/offline/updatingManifest.sjs new file mode 100644 index 000000000..3d95bdcd6 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/updatingManifest.sjs @@ -0,0 +1,66 @@ +ver1manifest = + "CACHE MANIFEST\n" + + "# v1\n" + + "\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs\n" + + "\n" + + "FALLBACK:\n" + + "namespace1/ fallback.html\n" + + "\n" + + "NETWORK:\n" + + "onwhitelist.html\n"; + +ver2manifest = + "CACHE MANIFEST\n" + + "# v2\n" + + "\n" + + "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs" + + "\n" + + "FALLBACK:\n" + + "namespace1/ fallback.html\n" + + "namespace1/sub/ fallback2.html\n"; + +ver3manifest = + "CACHE MANIFEST\n" + + "# v3\n" + + "\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs" + + "\n" + + "FALLBACK:\n" + + "namespace1/sub fallback2.html\n" + + "\n" + + "NETWORK:\n" + + "onwhitelist.html\n"; + +function handleRequest(request, response) +{ + var match = request.queryString.match(/^state=(.*)$/); + if (match) + { + response.setStatusLine(request.httpVersion, 204, "No content"); + setState("offline.updatingManifest", match[1]); + } + + if (request.queryString == "") + { + response.setStatusLine(request.httpVersion, 200, "Ok"); + response.setHeader("Content-Type", "text/cache-manifest"); + response.setHeader("Cache-Control", "no-cache"); + switch (getState("offline.updatingManifest")) + { + case "": // The default value + response.write(ver1manifest + "\n#" + getState("offline.updatingManifest")); + break; + case "second": + response.write(ver2manifest + "\n#" + getState("offline.updatingManifest")); + break; + case "third": + response.write(ver3manifest + "\n#" + getState("offline.updatingManifest")); + break; + } + } +} diff --git a/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest b/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest new file mode 100644 index 000000000..558f703bc --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest @@ -0,0 +1,7 @@ +CACHE MANIFEST + +http://mochi.test:8888/tests/SimpleTest/SimpleTest.js +http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js + +NETWORK: +* diff --git a/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest^headers^ new file mode 100644 index 000000000..5efde3c5b --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + -- cgit v1.2.3