Export loadDevToolsExtensions API to use in guest view manager
This commit is contained in:
parent
219d177731
commit
ec8b9e3f35
2 changed files with 12 additions and 11 deletions
|
@ -317,13 +317,13 @@ app.once('ready', function () {
|
||||||
const init = BrowserWindow.prototype._init
|
const init = BrowserWindow.prototype._init
|
||||||
BrowserWindow.prototype._init = function () {
|
BrowserWindow.prototype._init = function () {
|
||||||
init.call(this)
|
init.call(this)
|
||||||
this._loadDevToolsExtensions(this.webContents)
|
exports.loadDevToolsExtensions(this.webContents)
|
||||||
}
|
|
||||||
|
|
||||||
BrowserWindow.prototype._loadDevToolsExtensions = function (webContents) {
|
|
||||||
hookWindowForTabEvents(webContents)
|
|
||||||
webContents.on('devtools-opened', function () {
|
|
||||||
loadDevToolsExtensions(webContents, objectValues(manifestMap))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
exports.loadDevToolsExtensions = function (webContents) {
|
||||||
|
hookWindowForTabEvents(webContents)
|
||||||
|
webContents.on('devtools-opened', function () {
|
||||||
|
loadDevToolsExtensions(webContents, objectValues(manifestMap))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const {BrowserWindow, ipcMain, webContents} = require('electron')
|
const ChromeExtension = require('./chrome-extension')
|
||||||
|
const ipcMain = require('electron').ipcMain
|
||||||
|
const webContents = require('electron').webContents
|
||||||
|
|
||||||
// Doesn't exist in early initialization.
|
// Doesn't exist in early initialization.
|
||||||
let webViewManager = null
|
let webViewManager = null
|
||||||
|
@ -150,8 +152,7 @@ const createGuest = function (embedder, params) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Enable DevTools extensions in guest view
|
// Enable DevTools extensions in guest view
|
||||||
const window = BrowserWindow.fromWebContents(embedder)
|
ChromeExtension.loadDevToolsExtensions(guest)
|
||||||
if (window) window._loadDevToolsExtensions(guest)
|
|
||||||
|
|
||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue