mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Bug 1265795 P4 Always call nsDocument::SetScriptGlobalObject(nullptr) from nsDocument::Destroy(). r=bz
Currently there are certain paths in nsDocumentViewer that can call nsDocument::Destroy(), but fail to call SetScriptGlobalObject(nullptr). This results in the global never being cleared. This patch refactors things so nsDocument::Destroy() always clears the global. This ensures a more consistent document teardown since we don't rely on external callers to get multiple method calls correct.
This commit is contained in:
parent
d78f4aec16
commit
67cfa5a9ee
@ -8943,6 +8943,7 @@ nsDocument::Destroy()
|
||||
|
||||
mIsGoingAway = true;
|
||||
|
||||
SetScriptGlobalObject(nullptr);
|
||||
RemovedFromDocShell();
|
||||
|
||||
bool oldVal = mInUnlinkOrDeletion;
|
||||
|
@ -1758,7 +1758,6 @@ nsDocumentViewer::SetDocumentInternal(nsIDocument* aDocument,
|
||||
}
|
||||
|
||||
if (mDocument->IsStaticDocument()) {
|
||||
mDocument->SetScriptGlobalObject(nullptr);
|
||||
mDocument->Destroy();
|
||||
}
|
||||
|
||||
@ -4306,7 +4305,6 @@ nsDocumentViewer::OnDonePrinting()
|
||||
}
|
||||
} else if (mClosingWhilePrinting) {
|
||||
if (mDocument) {
|
||||
mDocument->SetScriptGlobalObject(nullptr);
|
||||
mDocument->Destroy();
|
||||
mDocument = nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user