Load extensions for all web contents

This commit is contained in:
Kevin Sawicki 2016-06-07 10:52:03 -07:00
parent 4f7bde38a9
commit 219d177731
2 changed files with 5 additions and 2 deletions

View file

@ -1365,6 +1365,8 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
dict.SetMethod("_setWrapWebContents", &atom::api::SetWrapWebContents);
dict.SetMethod("fromId",
&mate::TrackableObject<atom::api::WebContents>::FromWeakMapID);
dict.SetMethod("getAllWebContents",
&mate::TrackableObject<atom::api::WebContents>::GetAll);
}
} // namespace

View file

@ -1,4 +1,5 @@
const {app, ipcMain, protocol, webContents, BrowserWindow} = require('electron')
const WebContents = process.atomBinding('web_contents')
const renderProcessPreferences = process.atomBinding('render_process_preferences').forAllBrowserWindow()
const fs = require('fs')
@ -295,8 +296,8 @@ app.once('ready', function () {
BrowserWindow.addDevToolsExtension = function (srcDirectory) {
const manifest = getManifestFromPath(srcDirectory)
if (manifest) {
for (const win of BrowserWindow.getAllWindows()) {
loadDevToolsExtensions(win, [manifest])
for (const webContents of WebContents.getAllWebContents()) {
loadDevToolsExtensions(webContents, [manifest])
}
return manifest.name
}