From f2fa0e96ebcfc4b9876662d53d82a8742c24aa9b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 22 Sep 2015 23:39:31 +0800 Subject: [PATCH] Pass options in "new-window" event --- atom/browser/lib/guest-window-manager.coffee | 7 ++++--- atom/renderer/lib/web-view/guest-view-internal.coffee | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/atom/browser/lib/guest-window-manager.coffee b/atom/browser/lib/guest-window-manager.coffee index 2dc5056a57ea..9a5c0ca349ae 100644 --- a/atom/browser/lib/guest-window-manager.coffee +++ b/atom/browser/lib/guest-window-manager.coffee @@ -22,7 +22,7 @@ createGuest = (embedder, url, frameName, options) -> guest.loadUrl url return guest.id - guest = new BrowserWindow(mergeBrowserWindowOptions(embedder, options)) + guest = new BrowserWindow(options) guest.loadUrl url # Remember the embedder, will be used by window.opener methods. @@ -51,11 +51,12 @@ createGuest = (embedder, url, frameName, options) -> # Routed window.open messages. ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, args...) -> [url, frameName, options] = args - event.sender.emit 'new-window', event, url, frameName, 'new-window' + options = mergeBrowserWindowOptions event.sender, options + event.sender.emit 'new-window', event, url, frameName, 'new-window', options if (event.sender.isGuest() and not event.sender.allowPopups) or event.defaultPrevented event.returnValue = null else - event.returnValue = createGuest event.sender, args... + event.returnValue = createGuest event.sender, url, frameName, options ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_CLOSE', (event, guestId) -> BrowserWindow.fromId(guestId)?.destroy() diff --git a/atom/renderer/lib/web-view/guest-view-internal.coffee b/atom/renderer/lib/web-view/guest-view-internal.coffee index b491184fb8d7..2852d1122874 100644 --- a/atom/renderer/lib/web-view/guest-view-internal.coffee +++ b/atom/renderer/lib/web-view/guest-view-internal.coffee @@ -16,7 +16,7 @@ WEB_VIEW_EVENTS = 'did-get-redirect-request': ['oldUrl', 'newUrl', 'isMainFrame'] 'dom-ready': [] 'console-message': ['level', 'message', 'line', 'sourceId'] - 'new-window': ['url', 'frameName', 'disposition'] + 'new-window': ['url', 'frameName', 'disposition', 'options'] 'close': [] 'crashed': [] 'gpu-crashed': []