commit c6acc0cb971f8d0c32f65a573f12b5c5a6a0cffc
parent 9fb37e4b9b00bd58bd05252357e9b7bd0e466140
Author: Henri Sivonen <hsivonen@hsivonen.fi>
Date: Mon, 8 Dec 2025 10:50:17 +0000
Bug 2003244 - Defer the notification for the global creation for the initial about:blank. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D275032
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp
@@ -1961,9 +1961,15 @@ mozilla::ipc::IPCResult ContentChild::RecvConstructBrowser(
RefPtr<nsOpenWindowInfo> openWindowInfo = new nsOpenWindowInfo();
openWindowInfo->mPrincipalToInheritForAboutBlank = aWindowInit.principal();
- if (NS_WARN_IF(NS_FAILED(browserChild->Init(/* aOpener */ nullptr,
- windowChild, openWindowInfo)))) {
- return IPC_FAIL(browserChild, "BrowserChild::Init failed");
+ {
+ // Block the script runner that notifies about the creation of the script
+ // global for the initial about:blank.
+ nsAutoScriptBlocker blockScripts;
+
+ if (NS_WARN_IF(NS_FAILED(browserChild->Init(
+ /* aOpener */ nullptr, windowChild, openWindowInfo)))) {
+ return IPC_FAIL(browserChild, "BrowserChild::Init failed");
+ }
}
nsCOMPtr<nsIObserverService> os = services::GetObserverService();