Bug 918880 - Followup - gracefully recover from scheduleUpdate() failure r=fabrice

This commit is contained in:
Honza Bambas 2013-12-22 18:31:15 -08:00
parent 1b076c9518
commit 6a17879fd1
3 changed files with 14 additions and 2 deletions

View File

@ -1559,8 +1559,12 @@ TabParent::AllocPOfflineCacheUpdateParent(const URIParams& aManifestURI,
IsBrowserElement());
nsresult rv = update->Schedule(aManifestURI, aDocumentURI, stickDocument);
if (NS_FAILED(rv))
return nullptr;
if (NS_FAILED(rv)) {
// Must dispatch since the parent is not at this moment ready yet.
nsRefPtr<nsRunnableMethod<mozilla::docshell::OfflineCacheUpdateParent> > event =
NS_NewRunnableMethod(update, &mozilla::docshell::OfflineCacheUpdateParent::Kill);
NS_DispatchToCurrentThread(event);
}
POfflineCacheUpdateParent* result = update.get();
update.forget();

View File

@ -141,6 +141,12 @@ OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
return NS_OK;
}
void
OfflineCacheUpdateParent::Kill()
{
unused << SendFinish(false, false);
}
NS_IMETHODIMP
OfflineCacheUpdateParent::UpdateStateChanged(nsIOfflineCacheUpdate *aUpdate, uint32_t state)
{

View File

@ -40,6 +40,8 @@ public:
const URIParams& documentURI,
const bool& stickDocument);
void Kill();
OfflineCacheUpdateParent(uint32_t aAppId, bool aIsInBrowser);
~OfflineCacheUpdateParent();