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
|
||||
BrowserWindow.prototype._init = function () {
|
||||
init.call(this)
|
||||
this._loadDevToolsExtensions(this.webContents)
|
||||
}
|
||||
|
||||
BrowserWindow.prototype._loadDevToolsExtensions = function (webContents) {
|
||||
hookWindowForTabEvents(webContents)
|
||||
webContents.on('devtools-opened', function () {
|
||||
loadDevToolsExtensions(webContents, objectValues(manifestMap))
|
||||
})
|
||||
exports.loadDevToolsExtensions(this.webContents)
|
||||
}
|
||||
})
|
||||
|
||||
exports.loadDevToolsExtensions = function (webContents) {
|
||||
hookWindowForTabEvents(webContents)
|
||||
webContents.on('devtools-opened', function () {
|
||||
loadDevToolsExtensions(webContents, objectValues(manifestMap))
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
'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.
|
||||
let webViewManager = null
|
||||
|
@ -150,8 +152,7 @@ const createGuest = function (embedder, params) {
|
|||
})
|
||||
|
||||
// Enable DevTools extensions in guest view
|
||||
const window = BrowserWindow.fromWebContents(embedder)
|
||||
if (window) window._loadDevToolsExtensions(guest)
|
||||
ChromeExtension.loadDevToolsExtensions(guest)
|
||||
|
||||
return id
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue