Merge pull request #8189 from electron/undefined-browser-window-in-dialog
Undefined browser causes error in dialog APIs
This commit is contained in:
commit
8ae7d01d1a
2 changed files with 3 additions and 3 deletions
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
Loading…
Reference in a new issue