browser: fix disposition value for new-window event
This commit is contained in:
parent
7353fb4296
commit
7016fbe258
4 changed files with 10 additions and 7 deletions
|
@ -326,10 +326,12 @@ bool WebContents::ShouldCreateWebContents(
|
|||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
content::SessionStorageNamespace* session_storage_namespace) {
|
||||
auto disposition = (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND)
|
||||
? "background-tab" : "new-window";
|
||||
if (type_ == BROWSER_WINDOW)
|
||||
Emit("-new-window", target_url, frame_name, NEW_FOREGROUND_TAB);
|
||||
Emit("-new-window", target_url, frame_name, disposition);
|
||||
else
|
||||
Emit("new-window", target_url, frame_name, NEW_FOREGROUND_TAB);
|
||||
Emit("new-window", target_url, frame_name, disposition);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,14 +21,14 @@ BrowserWindow.prototype._init = function () {
|
|||
}
|
||||
|
||||
// Make new windows requested by links behave like "window.open"
|
||||
this.webContents.on('-new-window', (event, url, frameName) => {
|
||||
this.webContents.on('-new-window', (event, url, frameName, disposition) => {
|
||||
var options
|
||||
options = {
|
||||
show: true,
|
||||
width: 800,
|
||||
height: 600
|
||||
}
|
||||
return ipcMain.emit('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', event, url, frameName, options)
|
||||
return ipcMain.emit('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', event, url, frameName, disposition, options)
|
||||
})
|
||||
|
||||
// window.resizeTo(...)
|
||||
|
|
|
@ -80,9 +80,9 @@ var createGuest = function (embedder, url, frameName, options) {
|
|||
}
|
||||
|
||||
// Routed window.open messages.
|
||||
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', function (event, url, frameName, options) {
|
||||
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', function (event, url, frameName, disposition, options) {
|
||||
options = mergeBrowserWindowOptions(event.sender, options)
|
||||
event.sender.emit('new-window', event, url, frameName, 'new-window', options)
|
||||
event.sender.emit('new-window', event, url, frameName, disposition, options)
|
||||
if ((event.sender.isGuest() && !event.sender.allowPopups) || event.defaultPrevented) {
|
||||
event.returnValue = null
|
||||
} else {
|
||||
|
|
|
@ -100,6 +100,7 @@ window.open = function (url, frameName, features) {
|
|||
// TODO remove hyphenated options in both of the following arrays for 1.0
|
||||
const ints = ['x', 'y', 'width', 'height', 'min-width', 'minWidth', 'max-width', 'maxWidth', 'min-height', 'minHeight', 'max-height', 'maxHeight', 'zoom-factor', 'zoomFactor']
|
||||
const webPreferences = ['zoom-factor', 'zoomFactor', 'node-integration', 'nodeIntegration', 'preload']
|
||||
const disposition = 'new-window'
|
||||
|
||||
// Make sure to get rid of excessive whitespace in the property name
|
||||
ref1 = features.split(/,\s*/)
|
||||
|
@ -146,7 +147,7 @@ window.open = function (url, frameName, features) {
|
|||
options[name] = parseInt(options[name], 10)
|
||||
}
|
||||
}
|
||||
guestId = ipcRenderer.sendSync('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, frameName, options)
|
||||
guestId = ipcRenderer.sendSync('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, frameName, disposition, options)
|
||||
if (guestId) {
|
||||
return BrowserWindowProxy.getOrCreate(guestId)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue