From ee09c7534a37e01a8589ab82ac028aa4ba4d6421 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 14 Jun 2016 09:30:06 -0700 Subject: [PATCH] Only add extensions to windows and webviews --- lib/browser/chrome-extension.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/browser/chrome-extension.js b/lib/browser/chrome-extension.js index 78d6516..9a5e8e9 100644 --- a/lib/browser/chrome-extension.js +++ b/lib/browser/chrome-extension.js @@ -19,6 +19,11 @@ const generateExtensionIdFromName = function (name) { return name.replace(/[\W_]+/g, '-').toLowerCase() } +const isWindowOrWebView = function (webContents) { + const type = webContents.getType() + return type === 'window' || type === 'webview' +} + // Create or get manifest object from |srcDirectory|. const getManifestFromPath = function (srcDirectory) { let manifest @@ -238,7 +243,7 @@ const loadDevToolsExtensions = function (win, manifests) { } app.on('web-contents-created', function (event, webContents) { - if (webContents.getType() === 'remote') return + if (!isWindowOrWebView(webContents)) return hookWebContentsForTabEvents(webContents) webContents.on('devtools-opened', function () { @@ -323,7 +328,7 @@ app.once('ready', function () { const manifest = getManifestFromPath(srcDirectory) if (manifest) { for (const webContents of getAllWebContents()) { - if (webContents.getType() !== 'remote') { + if (isWindowOrWebView(webContents)) { loadDevToolsExtensions(webContents, [manifest]) } } -- 2.7.4