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

57 lines
1.3 KiB
HTML
Raw Normal View History

<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);
// Now add the manifest that the test frame will use.
var manifest =
"CACHE MANIFEST\n" +
"obsolete.html\n";
var req = new XMLHttpRequest();
req.open("PUT", "obsolete.cacheManifest");
req.setRequestHeader("Content-Type", "text/cache-manifest");
req.send(manifest);
req.onreadystatechange = function() {
if (req.readyState == 4) {
// now this will properly load the manifest.
gTestWin = window.open("obsolete.html");
}
}
function finish()
{
gTestWin.close();
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body>
</body>
</html>