mirror of
https://github.com/electron/electron.git
synced 2026-01-25 23:38:18 -05:00
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:
@@ -43,8 +43,9 @@ BrowserWindow.prototype._init = function () {
|
||||
userGesture, left, top, width,
|
||||
height) => {
|
||||
let urlFrameName = v8Util.getHiddenValue(webContents, 'url-framename')
|
||||
if ((disposition !== 'foreground-tab' && disposition !== 'new-window') ||
|
||||
!urlFrameName) {
|
||||
if ((disposition !== 'foreground-tab' && disposition !== 'new-window' &&
|
||||
disposition !== 'background-tab') || !urlFrameName) {
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user