Load dev tools extensions in webviews
This commit is contained in:
parent
19787544b5
commit
4f46f75d8f
2 changed files with 15 additions and 5 deletions
|
@ -81,8 +81,8 @@ const removeBackgroundPages = function (manifest) {
|
|||
}
|
||||
|
||||
// Dispatch tabs events.
|
||||
const hookWindowForTabEvents = function (win) {
|
||||
const tabId = win.webContents.id
|
||||
const hookWindowForTabEvents = function (win, webContents) {
|
||||
const tabId = webContents.id
|
||||
for (const page of objectValues(backgroundPages)) {
|
||||
page.webContents.sendToAll('CHROME_TABS_ONCREATED', tabId)
|
||||
}
|
||||
|
@ -301,6 +301,7 @@ app.once('ready', function () {
|
|||
return manifest.name
|
||||
}
|
||||
}
|
||||
|
||||
BrowserWindow.removeDevToolsExtension = function (name) {
|
||||
const manifest = manifestNameMap[name]
|
||||
if (!manifest) return
|
||||
|
@ -315,9 +316,13 @@ app.once('ready', function () {
|
|||
const init = BrowserWindow.prototype._init
|
||||
BrowserWindow.prototype._init = function () {
|
||||
init.call(this)
|
||||
hookWindowForTabEvents(this)
|
||||
this.webContents.on('devtools-opened', () => {
|
||||
loadDevToolsExtensions(this, objectValues(manifestMap))
|
||||
this._loadDevToolsExtensions(this.webContents)
|
||||
}
|
||||
|
||||
BrowserWindow.prototype._loadDevToolsExtensions = function (webContents) {
|
||||
hookWindowForTabEvents(this, webContents)
|
||||
webContents.on('devtools-opened', function () {
|
||||
loadDevToolsExtensions(webContents, objectValues(manifestMap))
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue