Bug 1730120, close ContentViewer properly if initialization fails, r=nika

Differential Revision: https://phabricator.services.mozilla.com/D130211
This commit is contained in:
Olli Pettay 2021-11-09 22:09:48 +00:00
Родитель eaeec96d4b
Коммит 91122391ce
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -8107,7 +8107,11 @@ nsresult nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer,
mContentViewer->SetNavigationTiming(mTiming);
if (NS_FAILED(mContentViewer->Init(widget, bounds, aWindowActor))) {
nsCOMPtr<nsIContentViewer> viewer = mContentViewer;
viewer->Close(nullptr);
viewer->Destroy();
mContentViewer = nullptr;
mCurrentURI = nullptr;
NS_WARNING("ContentViewer Initialization failed");
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -1597,8 +1597,6 @@ static void DetachContainerRecurse(nsIDocShell* aShell) {
NS_IMETHODIMP
nsDocumentViewer::Destroy() {
NS_ASSERTION(mDocument, "No document in Destroy()!");
// Don't let the document get unloaded while we are printing.
// this could happen if we hit the back button during printing.
// We also keep the viewer from being cached in session history, since