feat: remove BrowserWindow option inheritance (#28550)
This commit is contained in:
parent
c4931ff70e
commit
4ca518468d
13 changed files with 128 additions and 118 deletions
|
@ -270,7 +270,24 @@ export const windowSetup = (
|
|||
if (contextIsolationEnabled) internalContextBridge.overrideGlobalValueWithDynamicPropsFromIsolatedWorld(['open'], window.open);
|
||||
}
|
||||
|
||||
if (openerId != null) {
|
||||
// If this window uses nativeWindowOpen, but its opener window does not, we
|
||||
// need to proxy window.opener in order to let the page communicate with its
|
||||
// opener.
|
||||
// Additionally, windows opened from a nativeWindowOpen child of a
|
||||
// non-nativeWindowOpen parent will initially have their WebPreferences
|
||||
// copied from their opener before having them updated, meaning openerId is
|
||||
// initially incorrect. We detect this situation by checking for
|
||||
// window.opener, which will be non-null for a natively-opened child, so we
|
||||
// can ignore the openerId in that case, since it's incorrectly copied from
|
||||
// the parent. This is, uh, confusing, so here's a diagram that will maybe
|
||||
// help?
|
||||
//
|
||||
// [ grandparent window ] --> [ parent window ] --> [ child window ]
|
||||
// n.W.O = false n.W.O = true n.W.O = true
|
||||
// id = 1 id = 2 id = 3
|
||||
// openerId = null openerId = 1 openerId = 1 <- !!wrong!!
|
||||
// opener = null opener = null opener = [parent window]
|
||||
if (openerId != null && !window.opener) {
|
||||
window.opener = getOrCreateProxy(openerId);
|
||||
if (contextIsolationEnabled) internalContextBridge.overrideGlobalValueWithDynamicPropsFromIsolatedWorld(['opener'], window.opener);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue