Bug 477692: applicationCache sending obsolete on new cache groups. r+sr=jst

This commit is contained in:
Dave Camp 2009-02-09 22:40:40 -08:00
parent 39c2dd6d73
commit fa06c787d2
4 changed files with 77 additions and 1 deletions

View File

@ -108,6 +108,8 @@ _TEST_FILES = \
changingManifest.cacheManifest^headers^ \
offlineChild.html \
test_xhtmlManifest.xhtml \
test_missingManifest.html \
missing.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,24 @@
<html manifest="missing.cacheManifest">
<head>
<title>missing test</title>
<script type="text/javascript">
function obsolete(evt)
{
window.opener.ok(false, "Got an 'obsolete' event");
window.opener.finish();
}
function error(evt) {
window.opener.ok(true, "Got an 'error' event");
window.opener.finish();
}
applicationCache.onobsolete = obsolete;
applicationCache.onerror = error;
</script>
</head>
<body>
<h1></h1>
</body> </html>

View File

@ -0,0 +1,46 @@
<html>
<head>
<title>Test missing manifest</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 this will properly load the manifest.
gTestWin = window.open("missing.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>

View File

@ -1315,7 +1315,11 @@ nsOfflineCacheUpdate::LoadCompleted()
if (status == 404 || status == 410) {
mSucceeded = PR_FALSE;
mObsolete = PR_TRUE;
NotifyObsolete();
if (mPreviousApplicationCache) {
NotifyObsolete();
} else {
NotifyError();
}
Finish();
return;
}