Reuse existing event

This commit is contained in:
Ryohei Ikegami 2017-03-21 16:09:53 +09:00
parent 4d61d071b2
commit d3252e0eb1

View file

@ -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 {