Fix crash when using file chooser in BrowserView

The crash was a segfault caused by a null `WebDialogHelper::window_`.
This commit is contained in:
Birunthan Mohanathas 2017-06-21 16:21:28 -07:00
parent 3abeb6e2bc
commit eb19562316
6 changed files with 36 additions and 6 deletions

View file

@ -6,7 +6,7 @@ const {closeWindow} = require('./window-helpers')
const {remote} = require('electron')
const {BrowserView, BrowserWindow} = remote
describe('View module', function () {
describe('BrowserView module', function () {
var w = null
var view = null
@ -89,4 +89,15 @@ describe('View module', function () {
w.setBrowserView(view)
})
})
describe('BrowserView.webContents.getOwnerBrowserWindow()', function () {
it('points to owning window', function () {
view = new BrowserView()
assert.ok(!view.webContents.getOwnerBrowserWindow())
w.setBrowserView(view)
assert.equal(view.webContents.getOwnerBrowserWindow(), w)
w.setBrowserView(null)
assert.ok(!view.webContents.getOwnerBrowserWindow())
})
})
})