More logging for bug 471227.

This commit is contained in:
Dave Camp 2009-02-25 21:57:28 -08:00
parent 1ed8dcbb19
commit 462ee8fcf0
3 changed files with 38 additions and 0 deletions

View File

@ -1077,6 +1077,22 @@ nsContentSink::ProcessOfflineManifest(nsIContent *aElement)
return;
}
{
nsCAutoString spec;
if (mDocument->GetDocumentURI()) {
mDocument->GetDocumentURI()->GetSpec(spec);
}
nsCAutoString group;
if (applicationCache) {
applicationCache->GetGroupID(group);
}
nsCOMPtr<nsIApplicationCacheContainer> container =
do_QueryInterface(mDocument);
printf("(Bug 471227) Processing manifest for document >%p< (%s) which was "
"loaded from app cache %p (%s)\n",
container.get(), spec.get(), applicationCache.get(), group.get());
}
CacheSelectionAction action = CACHE_SELECTION_NONE;
nsCOMPtr<nsIURI> manifestURI;
@ -1099,6 +1115,7 @@ nsContentSink::ProcessOfflineManifest(nsIContent *aElement)
else {
// Only continue if the document has permission to use offline APIs.
if (!nsContentUtils::OfflineAppAllowed(mDocument->NodePrincipal())) {
printf("(Bug 471227) No permission.\n");
return;
}
@ -1131,8 +1148,10 @@ nsContentSink::ProcessOfflineManifest(nsIContent *aElement)
switch (action)
{
case CACHE_SELECTION_NONE:
printf("(Bug 471227) Taking no action.\n");
break;
case CACHE_SELECTION_UPDATE: {
printf("(Bug 471227) Scheduling an update.\n");
nsCOMPtr<nsIOfflineCacheUpdateService> updateService =
do_GetService(NS_OFFLINECACHEUPDATESERVICE_CONTRACTID);
@ -1143,6 +1162,7 @@ nsContentSink::ProcessOfflineManifest(nsIContent *aElement)
break;
}
case CACHE_SELECTION_RELOAD: {
printf("(Bug 471227) Reloading.\n");
// This situation occurs only for toplevel documents, see bottom
// of SelectDocAppCache method.
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mDocShell);

View File

@ -100,6 +100,9 @@ setup: function()
var uri = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(window.location.href, null, null);
if (pm.testPermission(uri, "offline-app") != 0) {
dump("Previous test failed to clear offline-app permission! Expect failures.\n");
}
pm.add(uri, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
// Tests must run as toplevel windows. Open a slave window to run

View File

@ -1337,6 +1337,7 @@ nsOfflineCacheUpdate::LoadCompleted()
mSucceeded = PR_FALSE;
for (PRInt32 i = 0; i < mDocuments.Count(); i++) {
printf("(Bug 471227) Associating from noupdate\n");
AssociateDocument(mDocuments[i]);
}
@ -1424,6 +1425,7 @@ nsOfflineCacheUpdate::ManifestCheckCompleted(nsresult aStatus,
Finish();
if (NS_FAILED(aStatus) && mRescheduleCount < kRescheduleLimit) {
printf("(Bug 471227) Rescheduling for manifest failure\n");
// Reschedule this update.
nsRefPtr<nsOfflineCacheUpdate> newUpdate =
new nsOfflineCacheUpdate();
@ -1853,6 +1855,18 @@ nsOfflineCacheUpdate::AssociateDocument(nsIDOMDocument *aDocument)
if (!existingCache) {
LOG(("Update %p: associating app cache %s to document %p", this, mClientID.get(), aDocument));
{
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDocument);
nsCAutoString spec;
if (doc->GetDocumentURI()) {
doc->GetDocumentURI()->GetSpec(spec);
}
printf("(Bug 471227) Associating app cache %p (%s) to document >%p< (%s)\n",
mApplicationCache.get(), mClientID.get(),
container.get(), spec.get());
}
rv = container->SetApplicationCache(mApplicationCache);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -1890,6 +1904,7 @@ nsOfflineCacheUpdate::Finish()
}
for (PRInt32 i = 0; i < mDocuments.Count(); i++) {
printf("(Bug 471227) Associating documents from Finish()\n");
AssociateDocument(mDocuments[i]);
}
}