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 () {
|
describe('dev tool extensions', function () {
|
||||||
let showPanelIntervalId
|
let showPanelTimeoutId
|
||||||
|
|
||||||
const showLastDevToolsPanel = () => {
|
const showLastDevToolsPanel = () => {
|
||||||
w.webContents.once('devtools-opened', function () {
|
w.webContents.once('devtools-opened', function () {
|
||||||
clearInterval(showPanelIntervalId)
|
const show = function () {
|
||||||
|
|
||||||
showPanelIntervalId = setInterval(function () {
|
|
||||||
if (w == null || w.isDestroyed()) {
|
if (w == null || w.isDestroyed()) {
|
||||||
clearInterval(showLastDevToolsPanel)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const {devToolsWebContents} = w
|
const {devToolsWebContents} = w
|
||||||
if (devToolsWebContents == null || devToolsWebContents.isDestroyed()) {
|
if (devToolsWebContents == null || devToolsWebContents.isDestroyed()) {
|
||||||
clearInterval(showLastDevToolsPanel)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var showLastPanel = function () {
|
const showLastPanel = function () {
|
||||||
var lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id
|
const lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id
|
||||||
WebInspector.inspectorView.showPanel(lastPanelId)
|
WebInspector.inspectorView.showPanel(lastPanelId)
|
||||||
}
|
}
|
||||||
devToolsWebContents.executeJavaScript(`(${showLastPanel})()`)
|
devToolsWebContents.executeJavaScript(`(${showLastPanel})()`, false, () => {
|
||||||
}, 100)
|
showPanelTimeoutId = setTimeout(show, 100)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
showPanelTimeoutId = setTimeout(show, 100)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
clearInterval(showPanelIntervalId)
|
clearTimeout(showPanelTimeoutId)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('BrowserWindow.addDevToolsExtension', function () {
|
describe('BrowserWindow.addDevToolsExtension', function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue