From: Kevin Sawicki Date: Tue, 14 Jun 2016 16:30:06 +0000 (-0700) Subject: Only add extensions to windows and webviews X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee09c7534a37e01a8589ab82ac028aa4ba4d6421;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Only add extensions to windows and webviews --- 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]) } }