Pass opener ID in command line

This commit is contained in:
Cheng Zhao 2015-12-17 21:27:14 +08:00
parent c7bfd5f09d
commit 0282d424bf
6 changed files with 21 additions and 12 deletions

View file

@ -30,6 +30,9 @@ for arg in process.argv
if arg.indexOf('--guest-instance-id=') == 0
# This is a guest web view.
process.guestInstanceId = parseInt arg.substr(arg.indexOf('=') + 1)
else if arg.indexOf('--opener-id=') == 0
# This is a guest BrowserWindow.
process.openerId = parseInt arg.substr(arg.indexOf('=') + 1)
else if arg.indexOf('--node-integration=') == 0
nodeIntegration = arg.substr arg.indexOf('=') + 1
else if arg.indexOf('--preload=') == 0

View file

@ -91,8 +91,8 @@ window.confirm = (message, title='') ->
window.prompt = ->
throw new Error('prompt() is and will not be supported.')
openerId = ipcRenderer.sendSync 'ATOM_SHELL_GUEST_WINDOW_MANAGER_GET_OPENER_ID'
window.opener = BrowserWindowProxy.getOrCreate(openerId) if openerId?
if process.openerId?
window.opener = BrowserWindowProxy.getOrCreate process.openerId
ipcRenderer.on 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', (event, sourceId, message, sourceOrigin) ->
# Manually dispatch event instead of using postMessage because we also need to