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,
|
disposition, options,
|
||||||
additionalFeatures, postData) {
|
additionalFeatures, postData) {
|
||||||
options = mergeBrowserWindowOptions(event.sender, options)
|
options = mergeBrowserWindowOptions(event.sender, options)
|
||||||
const newWindowEvent = {
|
event.sender.emit('new-window', event, url, frameName, disposition, options, additionalFeatures)
|
||||||
preventDefault: function () {
|
const newGuest = event.newGuest
|
||||||
this.defaultPrevented = true
|
if ((event.sender.isGuest() && !event.sender.allowPopups) || event.defaultPrevented) {
|
||||||
}
|
|
||||||
}
|
|
||||||
event.sender.emit('new-window', newWindowEvent, url, frameName, disposition, options, additionalFeatures)
|
|
||||||
const newGuest = newWindowEvent.newGuest
|
|
||||||
if ((event.sender.isGuest() && !event.sender.allowPopups) || newWindowEvent.defaultPrevented) {
|
|
||||||
if (newGuest !== undefined && newGuest !== null) {
|
if (newGuest !== undefined && newGuest !== null) {
|
||||||
|
event.defaultPrevented = false
|
||||||
event.returnValue = setupGuest(event.sender, frameName, newGuest, options)
|
event.returnValue = setupGuest(event.sender, frameName, newGuest, options)
|
||||||
} else {
|
} else {
|
||||||
event.preventDefault()
|
|
||||||
event.returnValue = null
|
event.returnValue = null
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue