commit d31e67d0063a798e426e81fb3b7e1ea8ee0dac83 parent 0b71afe1dd77749c6174b597d8327e28e59cfea3 Author: Vincent Hilla <vhilla@mozilla.com> Date: Thu, 11 Dec 2025 11:01:18 +0000 Bug 2004407 - Get policy container for initial about:blank from entry global. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D275622 Diffstat:
| M | toolkit/components/windowwatcher/nsWindowWatcher.cpp | | | 10 | ++++++++-- |
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/toolkit/components/windowwatcher/nsWindowWatcher.cpp b/toolkit/components/windowwatcher/nsWindowWatcher.cpp @@ -959,10 +959,16 @@ nsresult nsWindowWatcher::OpenWindowInternal( activeDocsSandboxFlags = parentDoc->GetSandboxFlags(); if (!aForceNoOpener) { + // Inherit from the entry global, e.g. for window.open and fall + // back to the parent, e.g. for link clicks. + Document* creator = GetEntryDocument(); + if (!creator) { + creator = parentDoc; + } openWindowInfo->mPolicyContainerToInheritForAboutBlank = - parentDoc->GetPolicyContainer(); + creator->GetPolicyContainer(); openWindowInfo->mCoepToInheritForAboutBlank = - parentDoc->GetEmbedderPolicy(); + creator->GetEmbedderPolicy(); } // Check to see if this frame is allowed to navigate, but don't check if