tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 58f9527f38965e49e7def51d2a964cda10253542
parent b62e07429bc900cd3b964834255d9282910bbc39
Author: Vincent Hilla <vhilla@mozilla.com>
Date:   Mon,  5 Jan 2026 09:12:37 +0000

Bug 2003244 - Don't crash when failing to initialize docshell. r=dom-core,mccr8

Bug 543435 changed nsDocShell::Initialize from always returning true to
returning whether CreateInitialDocumentViewer succeeded. If this fails,
it is propagated up to ContentChild::RecvConstructBrowser where we crash.
The call to CreateDocumentViewerForActor that existed before bug 543435 in
nsWebBrowser::Create would've failed silently.

This commit restores avoids a crash by restoring the silent failure.

Differential Revision: https://phabricator.services.mozilla.com/D277765

Diffstat:
Mdocshell/base/nsDocShell.cpp | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp @@ -443,7 +443,9 @@ nsresult nsDocShell::InitWindow(nsIWidget* aParentWidget, int32_t aX, mozilla::dom::WindowGlobalChild* aWindowActor) { SetParentWidget(aParentWidget); SetPositionAndSize(aX, aY, aWidth, aHeight, 0); - NS_ENSURE_TRUE(Initialize(aOpenWindowInfo, aWindowActor), NS_ERROR_FAILURE); + if (!Initialize(aOpenWindowInfo, aWindowActor)) { + NS_WARNING("Failed to initialize docshell"); + } return NS_OK; }