gecko/dom/tests/mochitest/ajax/offline/test_obsolete.html

56 lines
1.4 KiB
HTML

<html>
<head>
<title>Test obsolete application caches</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript">
var gTestWin;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var Cc = Components.classes;
var Ci = Components.interfaces;
// Enable the offline-app permission before loading the new window
var pm = Cc["@mozilla.org/permissionmanager;1"]
.getService(Ci.nsIPermissionManager);
var uri = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(window.location.href, null, null);
pm.add(uri, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
// Make the obsoleting.sjs return a valid manifest
var req = new XMLHttpRequest();
req.open("GET", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state=manifestPresent");
req.setRequestHeader("Content-Type", "text/cache-manifest");
req.send("");
req.onreadystatechange = function() {
if (req.readyState == 4) {
// now this will properly load the manifest.
gTestWin = window.open("obsolete.html");
}
}
function finish()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
pm.remove(uri.asciiHost, "offline-app");
gTestWin.close();
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body>
</body>
</html>