diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 6a18f0967b53..2c8e0a51c494 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1365,6 +1365,8 @@ void Initialize(v8::Local exports, v8::Local unused, dict.SetMethod("_setWrapWebContents", &atom::api::SetWrapWebContents); dict.SetMethod("fromId", &mate::TrackableObject::FromWeakMapID); + dict.SetMethod("getAllWebContents", + &mate::TrackableObject::GetAll); } } // namespace diff --git a/lib/browser/chrome-extension.js b/lib/browser/chrome-extension.js index c323819a7877..dfab37b4796f 100644 --- a/lib/browser/chrome-extension.js +++ b/lib/browser/chrome-extension.js @@ -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 }