summaryrefslogtreecommitdiff
path: root/docshell
diff options
context:
space:
mode:
authorOlli Pettay <Olli.Pettay@helsinki.fi>2021-12-08 18:56:27 +0000
committerMoonchild <moonchild@palemoon.org>2022-04-07 23:53:44 +0200
commit9a1e152ba30ab26a5f05326dab5dee0fab6e9b32 (patch)
tree3c88ab085412ad000550b679fd4ea7788fa23ce3 /docshell
parenta9046dcd55c721bb3ddedadbbdb217848cb99d8e (diff)
downloaduxp-9a1e152ba30ab26a5f05326dab5dee0fab6e9b32.tar.gz
[Docshell] Close ContentViewer properly if initialization fails.
Diffstat (limited to 'docshell')
-rw-r--r--docshell/base/nsDocShell.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index 0369657004..f2c7443656 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -9284,7 +9284,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;
}