Bug 1110928, part 2 - Call PokeGC in nsDocumentViewer::PageHide before the call to OnPageHide. r=smaug

This ensures that the document isn't destroyed when we call PokeGC, which will be useful later.
This commit is contained in:
Andrew McCreight
2017-01-23 19:21:13 +02:00
parent 9b8a0478d7
commit 13f754c9a1

View File

@@ -1337,6 +1337,11 @@ nsDocumentViewer::PageHide(bool aIsUnload)
return NS_ERROR_NULL_POINTER;
}
if (aIsUnload) {
// Poke the GC. The window might be collectable garbage now.
nsJSContext::PokeGC(JS::gcreason::PAGE_HIDE, NS_GC_DELAY * 2);
}
mDocument->OnPageHide(!aIsUnload, nullptr);
// inform the window so that the focus state is reset.
@@ -1346,9 +1351,6 @@ nsDocumentViewer::PageHide(bool aIsUnload)
window->PageHidden();
if (aIsUnload) {
// Poke the GC. The window might be collectable garbage now.
nsJSContext::PokeGC(JS::gcreason::PAGE_HIDE, NS_GC_DELAY * 2);
// if Destroy() was called during OnPageHide(), mDocument is nullptr.
NS_ENSURE_STATE(mDocument);