Only assign opener when not using nativeWindowOpen

This commit is contained in:
Kevin Sawicki 2017-07-10 15:44:07 -07:00
parent 25e1ed97b5
commit 553021bc9c

View file

@ -127,6 +127,10 @@ module.exports = (ipcRenderer, guestInstanceId, openerId, hiddenPage, usesNative
return null return null
} }
} }
if (openerId != null) {
window.opener = getOrCreateProxy(ipcRenderer, openerId)
}
} }
window.alert = function (message, title) { window.alert = function (message, title) {
@ -142,10 +146,6 @@ module.exports = (ipcRenderer, guestInstanceId, openerId, hiddenPage, usesNative
throw new Error('prompt() is and will not be supported.') throw new Error('prompt() is and will not be supported.')
} }
if (openerId != null) {
window.opener = getOrCreateProxy(ipcRenderer, openerId)
}
ipcRenderer.on('ELECTRON_GUEST_WINDOW_POSTMESSAGE', function (event, sourceId, message, sourceOrigin) { ipcRenderer.on('ELECTRON_GUEST_WINDOW_POSTMESSAGE', function (event, sourceId, message, sourceOrigin) {
// Manually dispatch event instead of using postMessage because we also need to // Manually dispatch event instead of using postMessage because we also need to
// set event.source. // set event.source.