From 58cae1d8de2f9ff7528ba46e07d50713735ad671 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 6 Dec 2016 09:22:08 -0800 Subject: [PATCH 1/3] Clear interval before destroying window --- spec/api-browser-window-spec.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index dad48d5497a..ea4d48efd6b 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -1599,8 +1599,10 @@ describe('browser-window module', function () { BrowserWindow.removeDevToolsExtension('foo') BrowserWindow.addDevToolsExtension(extensionPath) - w.webContents.on('devtools-opened', function () { - var showPanelIntevalId = setInterval(function () { + let showPanelIntervalId = null + + w.webContents.once('devtools-opened', function () { + showPanelIntervalId = setInterval(function () { if (w && w.devToolsWebContents) { var showLastPanel = function () { var lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id @@ -1608,7 +1610,7 @@ describe('browser-window module', function () { } w.devToolsWebContents.executeJavaScript(`(${showLastPanel})()`) } else { - clearInterval(showPanelIntevalId) + clearInterval(showPanelIntervalId) } }, 100) }) @@ -1618,6 +1620,7 @@ describe('browser-window module', function () { ipcMain.once('answer', function (event, message) { assert.equal(message.runtimeId, 'foo') + clearInterval(showPanelIntervalId) done() }) }) From c2f516067f61a051edab85540b763e3b5668cf0c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 6 Dec 2016 09:22:29 -0800 Subject: [PATCH 2/3] Add missing r in variable name --- spec/api-browser-window-spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index ea4d48efd6b..e161cc08bf2 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -1503,7 +1503,7 @@ describe('browser-window module', function () { describe('dev tool extensions', function () { describe('BrowserWindow.addDevToolsExtension', function () { - let showPanelIntevalId + let showPanelIntervalId beforeEach(function () { BrowserWindow.removeDevToolsExtension('foo') @@ -1514,7 +1514,7 @@ describe('browser-window module', function () { assert.equal(BrowserWindow.getDevToolsExtensions().hasOwnProperty('foo'), true) w.webContents.on('devtools-opened', function () { - showPanelIntevalId = setInterval(function () { + showPanelIntervalId = setInterval(function () { if (w && w.devToolsWebContents) { var showLastPanel = function () { var lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id @@ -1522,7 +1522,7 @@ describe('browser-window module', function () { } w.devToolsWebContents.executeJavaScript(`(${showLastPanel})()`) } else { - clearInterval(showPanelIntevalId) + clearInterval(showPanelIntervalId) } }, 100) }) @@ -1531,7 +1531,7 @@ describe('browser-window module', function () { }) afterEach(function () { - clearInterval(showPanelIntevalId) + clearInterval(showPanelIntervalId) }) it('throws errors for missing manifest.json files', function () { From b29f7b9acb243d3a487b102164b0e6f43af1f16d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 6 Dec 2016 09:25:55 -0800 Subject: [PATCH 3/3] Clear interval before assert --- spec/api-browser-window-spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index e161cc08bf2..b80de7f9de5 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -1619,8 +1619,8 @@ describe('browser-window module', function () { w.webContents.openDevTools({mode: 'bottom'}) ipcMain.once('answer', function (event, message) { - assert.equal(message.runtimeId, 'foo') clearInterval(showPanelIntervalId) + assert.equal(message.runtimeId, 'foo') done() }) })