mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 918864. r=bz
This commit is contained in:
parent
ae06dc3af5
commit
7e45225636
@ -132,6 +132,7 @@ public:
|
||||
: mService(aService)
|
||||
, mManifestURI(aManifestURI)
|
||||
, mDocumentURI(aDocumentURI)
|
||||
, mDidReleaseThis(false)
|
||||
{
|
||||
mDocument = do_GetWeakReference(aDocument);
|
||||
}
|
||||
@ -141,6 +142,7 @@ private:
|
||||
nsCOMPtr<nsIURI> mManifestURI;
|
||||
nsCOMPtr<nsIURI> mDocumentURI;
|
||||
nsCOMPtr<nsIWeakReference> mDocument;
|
||||
bool mDidReleaseThis;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsOfflineCachePendingUpdate,
|
||||
@ -169,11 +171,16 @@ nsOfflineCachePendingUpdate::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
uint32_t progressStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
if (mDidReleaseThis) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocument> updateDoc = do_QueryReferent(mDocument);
|
||||
if (!updateDoc) {
|
||||
// The document that scheduled this update has gone away,
|
||||
// we don't need to listen anymore.
|
||||
aWebProgress->RemoveProgressListener(this);
|
||||
MOZ_ASSERT(!mDidReleaseThis);
|
||||
mDidReleaseThis = true;
|
||||
NS_RELEASE_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
@ -209,9 +216,14 @@ nsOfflineCachePendingUpdate::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
mService->Schedule(mManifestURI, mDocumentURI,
|
||||
updateDoc, window, nullptr,
|
||||
appId, isInBrowserElement, getter_AddRefs(update));
|
||||
if (mDidReleaseThis) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
aWebProgress->RemoveProgressListener(this);
|
||||
MOZ_ASSERT(!mDidReleaseThis);
|
||||
mDidReleaseThis = true;
|
||||
NS_RELEASE_THIS();
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user