Add "frameName" as paramter for "new-window" event
This commit is contained in:
parent
389e56ce36
commit
fefeb39757
5 changed files with 8 additions and 8 deletions
|
@ -88,7 +88,7 @@ bool WebContents::ShouldCreateWebContents(
|
|||
content::SessionStorageNamespace* session_storage_namespace) {
|
||||
base::ListValue args;
|
||||
args.AppendString(target_url.spec());
|
||||
args.AppendString(partition_id);
|
||||
args.AppendString(frame_name);
|
||||
Emit("new-window", args);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ binding = process.atomBinding 'web_contents'
|
|||
ipc = require 'ipc'
|
||||
|
||||
# Routed window.open messages.
|
||||
ipc.on 'ATOM_SHELL_WEB_CONTENTS_WINDOW_OPEN', (event, url, name, features) ->
|
||||
event.sender.emit 'new-window', url, name, features
|
||||
ipc.on 'ATOM_SHELL_WEB_CONTENTS_WINDOW_OPEN', (event, args...) ->
|
||||
event.sender.emit 'new-window', event, args...
|
||||
|
||||
module.exports.wrap = (webContents) ->
|
||||
return null unless webContents.isAlive()
|
||||
|
|
|
@ -10,7 +10,7 @@ WEB_VIEW_EVENTS =
|
|||
'did-stop-loading': []
|
||||
'did-get-redirect-request': ['oldUrl', 'newUrl', 'isMainFrame']
|
||||
'console-message': ['level', 'message', 'line', 'sourceId']
|
||||
'new-window': ['url', 'partitionId']
|
||||
'new-window': ['url', 'frameName']
|
||||
'close': []
|
||||
'crashed': []
|
||||
'destroyed': []
|
||||
|
|
|
@ -2,13 +2,13 @@ process = global.process
|
|||
ipc = require 'ipc'
|
||||
remote = require 'remote'
|
||||
|
||||
if process.guestInstanceId?
|
||||
unless process.guestInstanceId?
|
||||
# Override default window.close.
|
||||
window.close = ->
|
||||
remote.getCurrentWindow().close()
|
||||
|
||||
# Make the browser window or guest view emit "new-window" event.
|
||||
window.open = (url, name='', features='') ->
|
||||
window.open = (url, frameName='', features='') ->
|
||||
options = {}
|
||||
for feature in features.split ','
|
||||
[name, value] = feature.split '='
|
||||
|
@ -25,7 +25,7 @@ window.open = (url, name='', features='') ->
|
|||
options.width ?= 800
|
||||
options.height ?= 600
|
||||
|
||||
ipc.send 'ATOM_SHELL_WEB_CONTENTS_WINDOW_OPEN', url, name, features
|
||||
ipc.send 'ATOM_SHELL_WEB_CONTENTS_WINDOW_OPEN', url, frameName, options
|
||||
|
||||
# Use the dialog API to implement alert().
|
||||
window.alert = (message, title='') ->
|
||||
|
|
|
@ -237,7 +237,7 @@ webview.addEventListener('console-message', function(e) {
|
|||
### new-window
|
||||
|
||||
* `url` String
|
||||
* `partitionId` String
|
||||
* `frameName` String
|
||||
|
||||
Fired when the guest page attempts to open a new browser window.
|
||||
|
||||
|
|
Loading…
Reference in a new issue