Schedule function after executeJavaScript completes
This commit is contained in:
parent
eb6d92d427
commit
76e5589a31
1 changed files with 10 additions and 12 deletions
|
@ -1663,35 +1663,33 @@ describe('BrowserWindow module', function () {
|
|||
})
|
||||
|
||||
describe('dev tool extensions', function () {
|
||||
let showPanelIntervalId
|
||||
let showPanelTimeoutId
|
||||
|
||||
const showLastDevToolsPanel = () => {
|
||||
w.webContents.once('devtools-opened', function () {
|
||||
clearInterval(showPanelIntervalId)
|
||||
|
||||
showPanelIntervalId = setInterval(function () {
|
||||
const show = function () {
|
||||
if (w == null || w.isDestroyed()) {
|
||||
clearInterval(showLastDevToolsPanel)
|
||||
return
|
||||
}
|
||||
|
||||
const {devToolsWebContents} = w
|
||||
if (devToolsWebContents == null || devToolsWebContents.isDestroyed()) {
|
||||
clearInterval(showLastDevToolsPanel)
|
||||
return
|
||||
}
|
||||
|
||||
var showLastPanel = function () {
|
||||
var lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id
|
||||
const showLastPanel = function () {
|
||||
const lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id
|
||||
WebInspector.inspectorView.showPanel(lastPanelId)
|
||||
}
|
||||
devToolsWebContents.executeJavaScript(`(${showLastPanel})()`)
|
||||
}, 100)
|
||||
devToolsWebContents.executeJavaScript(`(${showLastPanel})()`, false, () => {
|
||||
showPanelTimeoutId = setTimeout(show, 100)
|
||||
})
|
||||
}
|
||||
showPanelTimeoutId = setTimeout(show, 100)
|
||||
})
|
||||
}
|
||||
|
||||
afterEach(function () {
|
||||
clearInterval(showPanelIntervalId)
|
||||
clearTimeout(showPanelTimeoutId)
|
||||
})
|
||||
|
||||
describe('BrowserWindow.addDevToolsExtension', function () {
|
||||
|
|
Loading…
Reference in a new issue