mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
72 lines
2.1 KiB
HTML
72 lines
2.1 KiB
HTML
<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() {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
// 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 = req.channel
|
|
.QueryInterface(Components.interfaces.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>
|