Load extensions for all web contents
This commit is contained in:
parent
4f7bde38a9
commit
219d177731
2 changed files with 5 additions and 2 deletions
|
@ -1365,6 +1365,8 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
||||||
dict.SetMethod("_setWrapWebContents", &atom::api::SetWrapWebContents);
|
dict.SetMethod("_setWrapWebContents", &atom::api::SetWrapWebContents);
|
||||||
dict.SetMethod("fromId",
|
dict.SetMethod("fromId",
|
||||||
&mate::TrackableObject<atom::api::WebContents>::FromWeakMapID);
|
&mate::TrackableObject<atom::api::WebContents>::FromWeakMapID);
|
||||||
|
dict.SetMethod("getAllWebContents",
|
||||||
|
&mate::TrackableObject<atom::api::WebContents>::GetAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const {app, ipcMain, protocol, webContents, BrowserWindow} = require('electron')
|
const {app, ipcMain, protocol, webContents, BrowserWindow} = require('electron')
|
||||||
|
const WebContents = process.atomBinding('web_contents')
|
||||||
const renderProcessPreferences = process.atomBinding('render_process_preferences').forAllBrowserWindow()
|
const renderProcessPreferences = process.atomBinding('render_process_preferences').forAllBrowserWindow()
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
@ -295,8 +296,8 @@ app.once('ready', function () {
|
||||||
BrowserWindow.addDevToolsExtension = function (srcDirectory) {
|
BrowserWindow.addDevToolsExtension = function (srcDirectory) {
|
||||||
const manifest = getManifestFromPath(srcDirectory)
|
const manifest = getManifestFromPath(srcDirectory)
|
||||||
if (manifest) {
|
if (manifest) {
|
||||||
for (const win of BrowserWindow.getAllWindows()) {
|
for (const webContents of WebContents.getAllWebContents()) {
|
||||||
loadDevToolsExtensions(win, [manifest])
|
loadDevToolsExtensions(webContents, [manifest])
|
||||||
}
|
}
|
||||||
return manifest.name
|
return manifest.name
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue