diff options
author | Olli Pettay <Olli.Pettay@helsinki.fi> | 2021-12-08 18:56:27 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-03 01:04:00 +0200 |
commit | dfdc61ac704bcffe61883b031ece7e0705c1e5ae (patch) | |
tree | 641820a950ccfd3cd58e99d465dc7799485d876d | |
parent | 1886b268d7b572bfd1b3a70b0947a0c79c72f411 (diff) | |
download | uxp-dfdc61ac704bcffe61883b031ece7e0705c1e5ae.tar.gz |
[Docshell] Close ContentViewer properly if initialization fails.
-rw-r--r-- | docshell/base/nsDocShell.cpp | 4 | ||||
-rw-r--r-- | layout/base/nsDocumentViewer.cpp | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index c40fbd7a10..5b89df5116 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -9353,7 +9353,11 @@ nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer) mContentViewer->SetNavigationTiming(mTiming); if (NS_FAILED(mContentViewer->Init(widget, bounds))) { + nsCOMPtr<nsIContentViewer> viewer = mContentViewer; + viewer->Close(nullptr); + viewer->Destroy(); mContentViewer = nullptr; + mCurrentURI = nullptr; NS_WARNING("ContentViewer Initialization failed"); return NS_ERROR_FAILURE; } diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index a0af38c289..ce8ab1c3d0 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1602,8 +1602,6 @@ DetachContainerRecurse(nsIDocShell *aShell) NS_IMETHODIMP nsDocumentViewer::Destroy() { - NS_ASSERTION(mDocument, "No document in Destroy()!"); - #ifdef NS_PRINTING // Here is where we check to see if the document was still being prepared // for printing when it was asked to be destroy from someone externally |