Add failing spec for webview devtools extension
This commit is contained in:
parent
82bee12c00
commit
19787544b5
2 changed files with 50 additions and 0 deletions
30
spec/fixtures/pages/webview-devtools.html
vendored
Normal file
30
spec/fixtures/pages/webview-devtools.html
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<webview nodeintegration src="./a.html"></webview>
|
||||||
|
<script>
|
||||||
|
var wv = document.querySelector('webview')
|
||||||
|
wv.addEventListener('dom-ready', () => {
|
||||||
|
const webContents = wv.getWebContents()
|
||||||
|
webContents.on('devtools-opened', function () {
|
||||||
|
var showPanelIntevalId = setInterval(function () {
|
||||||
|
if (webContents.devToolsWebContents) {
|
||||||
|
webContents.devToolsWebContents.executeJavaScript('(' + (function () {
|
||||||
|
var lastPanelId = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id
|
||||||
|
WebInspector.inspectorView.showPanel(lastPanelId)
|
||||||
|
}).toString() + ')()')
|
||||||
|
} else {
|
||||||
|
clearInterval(showPanelIntevalId)
|
||||||
|
}
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
|
|
||||||
|
wv.openDevTools()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -912,4 +912,24 @@ describe('<webview> tag', function () {
|
||||||
|
|
||||||
w.loadURL('file://' + fixtures + '/pages/webview-visibilitychange.html')
|
w.loadURL('file://' + fixtures + '/pages/webview-visibilitychange.html')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('loads devtools extension registered on the parent window', function (done) {
|
||||||
|
this.timeout(10000)
|
||||||
|
|
||||||
|
w = new BrowserWindow({
|
||||||
|
show: false
|
||||||
|
})
|
||||||
|
|
||||||
|
BrowserWindow.removeDevToolsExtension('foo')
|
||||||
|
|
||||||
|
var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo')
|
||||||
|
BrowserWindow.addDevToolsExtension(extensionPath)
|
||||||
|
|
||||||
|
w.loadURL('file://' + fixtures + '/pages/webview-devtools.html')
|
||||||
|
|
||||||
|
ipcMain.once('answer', function (event, message) {
|
||||||
|
assert.equal(message.runtimeId, 'foo')
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue