Reuse existing event
This commit is contained in:
parent
4d61d071b2
commit
d3252e0eb1
1 changed files with 4 additions and 9 deletions
|
@ -242,18 +242,13 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', function (event
|
|||
disposition, options,
|
||||
additionalFeatures, postData) {
|
||||
options = mergeBrowserWindowOptions(event.sender, options)
|
||||
const newWindowEvent = {
|
||||
preventDefault: function () {
|
||||
this.defaultPrevented = true
|
||||
}
|
||||
}
|
||||
event.sender.emit('new-window', newWindowEvent, url, frameName, disposition, options, additionalFeatures)
|
||||
const newGuest = newWindowEvent.newGuest
|
||||
if ((event.sender.isGuest() && !event.sender.allowPopups) || newWindowEvent.defaultPrevented) {
|
||||
event.sender.emit('new-window', event, url, frameName, disposition, options, additionalFeatures)
|
||||
const newGuest = event.newGuest
|
||||
if ((event.sender.isGuest() && !event.sender.allowPopups) || event.defaultPrevented) {
|
||||
if (newGuest !== undefined && newGuest !== null) {
|
||||
event.defaultPrevented = false
|
||||
event.returnValue = setupGuest(event.sender, frameName, newGuest, options)
|
||||
} else {
|
||||
event.preventDefault()
|
||||
event.returnValue = null
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue