diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/ajax/offline/obsolete.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/ajax/offline/obsolete.html')
-rw-r--r-- | dom/tests/mochitest/ajax/offline/obsolete.html | 69 |
1 files changed, 69 insertions, 0 deletions
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 @@ +<html manifest="obsoletingManifest.sjs"> +<head> +<title>obsolete test</title> +<script type="text/javascript"> + +function obsolete(evt) +{ + window.opener.ok(true, "Got an 'obsolete' event"); + + // The cache status is switched immediately AFTER sending the event, + // make sure that it isn't OBSOLETE yet... + window.opener.isnot(applicationCache.status, 5, + "Status should not yet be 5 (obsolete)"); + + // But check that it is after the event is fired. + setTimeout(function(){ + window.opener.is(applicationCache.status, 5, + "Status should be 5 (obsolete)"); + + // Now swapCache(), and our new status should be UNCACHED. + applicationCache.swapCache(); + window.opener.is(applicationCache.status, 0, + "Status should be 0 (UNCACHED)"); + window.opener.finish(); + }, 0); +} + +function fail(evt) +{ + window.opener.ok(false, "Got an unexpected event: " + evt.type) + window.opener.finish(); +} + +applicationCache.oncached = function() { + // ok, we've successfully loaded from the initial cache. + try { + applicationCache.swapCache(); + window.opener.todo(false, "We shouldn't have to swapCache in the oncached handler (bug 443023)"); + } catch(e) { + } + + // Now delete the manifest and refresh, we should get an "obsolete" message. + applicationCache.oncached = fail; + applicationCache.onupdateready = fail; + applicationCache.onnoupdate = fail; + applicationCache.onerror = fail; + applicationCache.onobsolete = obsolete; + + // Make the obsoleting.sjs return 404 NOT FOUND code + var req = new XMLHttpRequest(); + req.open("GET", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state="); + var channel = SpecialPowers.wrap(req).channel + .QueryInterface(SpecialPowers.Ci.nsIApplicationCacheChannel); + channel.chooseApplicationCache = false; + channel.inheritApplicationCache = false; + req.send(""); + req.onreadystatechange = function() { + if (req.readyState == 4) { + applicationCache.update(); + } + } +} + +</script> +</head> + +<body> +<h1></h1> +</body> </html> |