mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: set nativeWindowOpen when sandboxed (#18273)
This commit is contained in:
committed by
Alexey Kuzmin
parent
4ed989587b
commit
ac002b3c3c
@@ -112,7 +112,6 @@ const createGuest = function (embedder, params) {
|
||||
}
|
||||
this.loadURL(params.src, opts)
|
||||
}
|
||||
guest.allowPopups = params.allowpopups
|
||||
embedder.emit('did-attach-webview', event, guest)
|
||||
})
|
||||
|
||||
@@ -207,6 +206,7 @@ const attachGuest = function (event, embedderFrameId, elementInstanceId, guestIn
|
||||
enableRemoteModule: params.enableremotemodule,
|
||||
plugins: params.plugins,
|
||||
zoomFactor: embedder.getZoomFactor(),
|
||||
disablePopups: !params.allowpopups,
|
||||
webSecurity: !params.disablewebsecurity,
|
||||
enableBlinkFeatures: params.blinkfeatures,
|
||||
disableBlinkFeatures: params.disableblinkfeatures
|
||||
@@ -228,11 +228,6 @@ const attachGuest = function (event, embedderFrameId, elementInstanceId, guestIn
|
||||
webPreferences.preloadURL = params.preload
|
||||
}
|
||||
|
||||
// Return null from native window.open if allowpopups is unset
|
||||
if (webPreferences.nativeWindowOpen === true && !params.allowpopups) {
|
||||
webPreferences.disablePopups = true
|
||||
}
|
||||
|
||||
// Security options that guest will always inherit from embedder
|
||||
const inheritedWebPreferences = new Map([
|
||||
['contextIsolation', true],
|
||||
|
||||
@@ -244,7 +244,7 @@ ipcMainInternal.on('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', functio
|
||||
options = mergeBrowserWindowOptions(event.sender, options)
|
||||
event.sender.emit('new-window', event, url, frameName, disposition, options, additionalFeatures, referrer)
|
||||
const { newGuest } = event
|
||||
if ((event.sender.getType() === 'webview' && !event.sender.allowPopups) || event.defaultPrevented) {
|
||||
if ((event.sender.getType() === 'webview' && event.sender.getLastWebPreferences().disablePopups) || event.defaultPrevented) {
|
||||
if (newGuest != null) {
|
||||
if (options.webContents === newGuest.webContents) {
|
||||
// the webContents is not changed, so set defaultPrevented to false to
|
||||
|
||||
Reference in New Issue
Block a user