Merge pull request #8148 from electron/clear-interval-before-done
Clear interval before done
This commit is contained in:
commit
6c214ed386
1 changed files with 10 additions and 7 deletions
|
@ -1503,7 +1503,7 @@ describe('browser-window module', function () {
|
||||||
|
|
||||||
describe('dev tool extensions', function () {
|
describe('dev tool extensions', function () {
|
||||||
describe('BrowserWindow.addDevToolsExtension', function () {
|
describe('BrowserWindow.addDevToolsExtension', function () {
|
||||||
let showPanelIntevalId
|
let showPanelIntervalId
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
BrowserWindow.removeDevToolsExtension('foo')
|
BrowserWindow.removeDevToolsExtension('foo')
|
||||||
|
@ -1514,7 +1514,7 @@ describe('browser-window module', function () {
|
||||||
assert.equal(BrowserWindow.getDevToolsExtensions().hasOwnProperty('foo'), true)
|
assert.equal(BrowserWindow.getDevToolsExtensions().hasOwnProperty('foo'), true)
|
||||||
|
|
||||||
w.webContents.on('devtools-opened', function () {
|
w.webContents.on('devtools-opened', function () {
|
||||||
showPanelIntevalId = setInterval(function () {
|
showPanelIntervalId = setInterval(function () {
|
||||||
if (w && w.devToolsWebContents) {
|
if (w && w.devToolsWebContents) {
|
||||||
var showLastPanel = function () {
|
var showLastPanel = function () {
|
||||||
var lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id
|
var lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id
|
||||||
|
@ -1522,7 +1522,7 @@ describe('browser-window module', function () {
|
||||||
}
|
}
|
||||||
w.devToolsWebContents.executeJavaScript(`(${showLastPanel})()`)
|
w.devToolsWebContents.executeJavaScript(`(${showLastPanel})()`)
|
||||||
} else {
|
} else {
|
||||||
clearInterval(showPanelIntevalId)
|
clearInterval(showPanelIntervalId)
|
||||||
}
|
}
|
||||||
}, 100)
|
}, 100)
|
||||||
})
|
})
|
||||||
|
@ -1531,7 +1531,7 @@ describe('browser-window module', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
clearInterval(showPanelIntevalId)
|
clearInterval(showPanelIntervalId)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('throws errors for missing manifest.json files', function () {
|
it('throws errors for missing manifest.json files', function () {
|
||||||
|
@ -1599,8 +1599,10 @@ describe('browser-window module', function () {
|
||||||
BrowserWindow.removeDevToolsExtension('foo')
|
BrowserWindow.removeDevToolsExtension('foo')
|
||||||
BrowserWindow.addDevToolsExtension(extensionPath)
|
BrowserWindow.addDevToolsExtension(extensionPath)
|
||||||
|
|
||||||
w.webContents.on('devtools-opened', function () {
|
let showPanelIntervalId = null
|
||||||
var showPanelIntevalId = setInterval(function () {
|
|
||||||
|
w.webContents.once('devtools-opened', function () {
|
||||||
|
showPanelIntervalId = setInterval(function () {
|
||||||
if (w && w.devToolsWebContents) {
|
if (w && w.devToolsWebContents) {
|
||||||
var showLastPanel = function () {
|
var showLastPanel = function () {
|
||||||
var lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id
|
var lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id
|
||||||
|
@ -1608,7 +1610,7 @@ describe('browser-window module', function () {
|
||||||
}
|
}
|
||||||
w.devToolsWebContents.executeJavaScript(`(${showLastPanel})()`)
|
w.devToolsWebContents.executeJavaScript(`(${showLastPanel})()`)
|
||||||
} else {
|
} else {
|
||||||
clearInterval(showPanelIntevalId)
|
clearInterval(showPanelIntervalId)
|
||||||
}
|
}
|
||||||
}, 100)
|
}, 100)
|
||||||
})
|
})
|
||||||
|
@ -1617,6 +1619,7 @@ describe('browser-window module', function () {
|
||||||
w.webContents.openDevTools({mode: 'bottom'})
|
w.webContents.openDevTools({mode: 'bottom'})
|
||||||
|
|
||||||
ipcMain.once('answer', function (event, message) {
|
ipcMain.once('answer', function (event, message) {
|
||||||
|
clearInterval(showPanelIntervalId)
|
||||||
assert.equal(message.runtimeId, 'foo')
|
assert.equal(message.runtimeId, 'foo')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue