From c1080881100359b0086c537b7b6fa064da9938e6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 12 Dec 2016 16:25:08 -0800 Subject: [PATCH 1/2] Test with some null/undefined windows --- spec/api-dialog-spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/api-dialog-spec.js b/spec/api-dialog-spec.js index 5d6c54083b8d..9b90b0353dc2 100644 --- a/spec/api-dialog-spec.js +++ b/spec/api-dialog-spec.js @@ -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(() => { From 2bd8ef83d182b6c697d03cde92f4c5ecab5396f5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 12 Dec 2016 16:25:56 -0800 Subject: [PATCH 2/2] Use != null to handle undefined --- lib/browser/api/dialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/browser/api/dialog.js b/lib/browser/api/dialog.js index 0966c81245a5..e57eb41b83ce 100644 --- a/lib/browser/api/dialog.js +++ b/lib/browser/api/dialog.js @@ -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] }