зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1221279 Don't crash while clearing imgLoader cache when disconnected document is destroyed. r=smaug
This commit is contained in:
Родитель
d7c529e1a0
Коммит
4e457a4ca4
|
@ -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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче