Skip to content

Commit d31e67d

Browse files
committed
Bug 2004407 - Get policy container for initial about:blank from entry global. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D275622
1 parent 0b71afe commit d31e67d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

toolkit/components/windowwatcher/nsWindowWatcher.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,10 +959,16 @@ nsresult nsWindowWatcher::OpenWindowInternal(
959959
activeDocsSandboxFlags = parentDoc->GetSandboxFlags();
960960

961961
if (!aForceNoOpener) {
962+
// Inherit from the entry global, e.g. for window.open and fall
963+
// back to the parent, e.g. for link clicks.
964+
Document* creator = GetEntryDocument();
965+
if (!creator) {
966+
creator = parentDoc;
967+
}
962968
openWindowInfo->mPolicyContainerToInheritForAboutBlank =
963-
parentDoc->GetPolicyContainer();
969+
creator->GetPolicyContainer();
964970
openWindowInfo->mCoepToInheritForAboutBlank =
965-
parentDoc->GetEmbedderPolicy();
971+
creator->GetEmbedderPolicy();
966972
}
967973

968974
// Check to see if this frame is allowed to navigate, but don't check if

0 commit comments

Comments
 (0)