This reverts commit 8f35198bfb
.
This commit is contained in:
parent
46c2953edb
commit
57d2ae1aec
10 changed files with 196 additions and 339 deletions
|
@ -118,12 +118,28 @@ const createGuest = function (embedder, url, referrer, frameName, options, postD
|
|||
}
|
||||
|
||||
guest = new BrowserWindow(options)
|
||||
if (!options.webContents) {
|
||||
if (!options.webContents || url !== 'about:blank') {
|
||||
// We should not call `loadURL` if the window was constructed from an
|
||||
// existing webContents (window.open in a sandboxed renderer).
|
||||
// existing webContents(window.open in a sandboxed renderer) and if the url
|
||||
// is not 'about:blank'.
|
||||
//
|
||||
// Navigating to the url when creating the window from an existing
|
||||
// webContents is not necessary (it will navigate there anyway).
|
||||
// webContents would not be necessary(it will navigate there anyway), but
|
||||
// apparently there's a bug that allows the child window to be scripted by
|
||||
// the opener, even when the child window is from another origin.
|
||||
//
|
||||
// That's why the second condition(url !== "about:blank") is required: to
|
||||
// force `OverrideSiteInstanceForNavigation` to be called and consequently
|
||||
// spawn a new renderer if the new window is targeting a different origin.
|
||||
//
|
||||
// If the URL is "about:blank", then it is very likely that the opener just
|
||||
// wants to synchronously script the popup, for example:
|
||||
//
|
||||
// let popup = window.open()
|
||||
// popup.document.body.write('<h1>hello</h1>')
|
||||
//
|
||||
// The above code would not work if a navigation to "about:blank" is done
|
||||
// here, since the window would be cleared of all changes in the next tick.
|
||||
const loadOptions = {
|
||||
httpReferrer: referrer
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue