Fix sandbox crash when opening a background tab
When a link is clicked with the middle mouse button, chrome opens a window with "background-tab" disposition. This is not currently handled in sandbox mode, causing an api::WebContents to leak leading to eventual crash(since it has no wrapper). Also fix the event handler for "-add-new-contents" by having it call `event.preventDefault()` when the window creation should be cancelled.
This commit is contained in:
parent
a419fe75ca
commit
1709b8e39d
1 changed files with 3 additions and 2 deletions
|
@ -43,8 +43,9 @@ BrowserWindow.prototype._init = function () {
|
||||||
userGesture, left, top, width,
|
userGesture, left, top, width,
|
||||||
height) => {
|
height) => {
|
||||||
let urlFrameName = v8Util.getHiddenValue(webContents, 'url-framename')
|
let urlFrameName = v8Util.getHiddenValue(webContents, 'url-framename')
|
||||||
if ((disposition !== 'foreground-tab' && disposition !== 'new-window') ||
|
if ((disposition !== 'foreground-tab' && disposition !== 'new-window' &&
|
||||||
!urlFrameName) {
|
disposition !== 'background-tab') || !urlFrameName) {
|
||||||
|
event.preventDefault()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue