From 81d6efa641b6a1d4b3a161e47448609bf64e2074 Mon Sep 17 00:00:00 2001 From: Paul Zuehlcke Date: Sat, 18 Jan 2025 17:10:55 +0000 Subject: [PATCH] Bug 1932555, a=RyanVM Original Revision: https://phabricator.services.mozilla.com/D231928 Differential Revision: https://phabricator.services.mozilla.com/D234663 --- dom/ipc/ContentParent.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index a309bba661f1..692ed9aa19de 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -5623,8 +5623,15 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow( } // If we haven't found a chrome window to open in, just use the most recently - // opened one. + // opened non PBM window. if (!outerWin) { + // The parent was a private window but it's no longer available. + if (aOriginAttributes.mPrivateBrowsingId != + nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID) { + aResult = NS_ERROR_FAILURE; + return IPC_OK(); + } + outerWin = nsContentUtils::GetMostRecentNonPBWindow(); if (NS_WARN_IF(!outerWin)) { aResult = NS_ERROR_FAILURE;