mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1221279 Don't crash while clearing imgLoader cache when disconnected document is destroyed. r=smaug
This commit is contained in:
parent
67758796f9
commit
31e57f37fa
@ -8894,16 +8894,6 @@ nsDocument::Destroy()
|
||||
|
||||
mRegistry = nullptr;
|
||||
|
||||
using mozilla::dom::workers::ServiceWorkerManager;
|
||||
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
||||
if (swm) {
|
||||
ErrorResult error;
|
||||
if (swm->IsControlled(this, error)) {
|
||||
nsContentUtils::GetImgLoaderForDocument(this)->ClearCacheForControlledDocument(this);
|
||||
}
|
||||
swm->MaybeStopControlling(this);
|
||||
}
|
||||
|
||||
// XXX We really should let cycle collection do this, but that currently still
|
||||
// leaks (see https://bugzilla.mozilla.org/show_bug.cgi?id=406684).
|
||||
ReleaseWrapper(static_cast<nsINode*>(this));
|
||||
@ -8915,6 +8905,19 @@ nsDocument::RemovedFromDocShell()
|
||||
if (mRemovedFromDocShell)
|
||||
return;
|
||||
|
||||
using mozilla::dom::workers::ServiceWorkerManager;
|
||||
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
||||
if (swm) {
|
||||
ErrorResult error;
|
||||
if (swm->IsControlled(this, error)) {
|
||||
imgLoader* loader = nsContentUtils::GetImgLoaderForDocument(this);
|
||||
if (loader) {
|
||||
loader->ClearCacheForControlledDocument(this);
|
||||
}
|
||||
}
|
||||
swm->MaybeStopControlling(this);
|
||||
}
|
||||
|
||||
mRemovedFromDocShell = true;
|
||||
EnumerateActivityObservers(NotifyActivityChanged, nullptr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user