Merge pull request #8189 from electron/undefined-browser-window-in-dialog

Undefined browser causes error in dialog APIs
This commit is contained in:
Kevin Sawicki 2016-12-12 16:44:16 -08:00 committed by GitHub
commit 8ae7d01d1a
2 changed files with 3 additions and 3 deletions

View file

@ -19,7 +19,7 @@ const messageBoxOptions = {
}
const parseArgs = function (window, options, callback, ...args) {
if (window !== null && window.constructor !== BrowserWindow) {
if (window != null && window.constructor !== BrowserWindow) {
// Shift.
[callback, options, window] = [options, window, null]
}

View file

@ -41,11 +41,11 @@ describe('dialog module', () => {
describe('showMessageBox', () => {
it('throws errors when the options are invalid', () => {
assert.throws(() => {
dialog.showMessageBox({type: 'not-a-valid-type'})
dialog.showMessageBox(undefined, {type: 'not-a-valid-type'})
}, /Invalid message box type/)
assert.throws(() => {
dialog.showMessageBox({buttons: false})
dialog.showMessageBox(null, {buttons: false})
}, /Buttons must be an array/)
assert.throws(() => {