From ca6e3ed1efd7c480644070f257a9c7a2e158b871 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 13:49:31 -0700 Subject: [PATCH] Add webview support for disabled blink features --- lib/browser/guest-view-manager.js | 3 ++- lib/renderer/web-view/web-view-attributes.js | 8 ++++++++ lib/renderer/web-view/web-view-constants.js | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/browser/guest-view-manager.js b/lib/browser/guest-view-manager.js index c5c075b28bb7..604e1785fe92 100644 --- a/lib/browser/guest-view-manager.js +++ b/lib/browser/guest-view-manager.js @@ -182,7 +182,8 @@ var attachGuest = function (embedder, elementInstanceId, guestInstanceId, params plugins: params.plugins, zoomFactor: params.zoomFactor, webSecurity: !params.disablewebsecurity, - blinkFeatures: params.blinkfeatures + blinkFeatures: params.blinkfeatures, + disableBlinkFeatures: params.disableBlinkFeatures, } if (params.preload) { diff --git a/lib/renderer/web-view/web-view-attributes.js b/lib/renderer/web-view/web-view-attributes.js index c76e0d26f953..d62c496f4228 100644 --- a/lib/renderer/web-view/web-view-attributes.js +++ b/lib/renderer/web-view/web-view-attributes.js @@ -264,6 +264,13 @@ class BlinkFeaturesAttribute extends WebViewAttribute { } } +// Attribute that specifies the blink features to be disabled. +class DisableBlinkFeaturesAttribute extends WebViewAttribute { + constructor (webViewImpl) { + super(webViewConstants.ATTRIBUTE_DISBLEBLINKFEATURES, webViewImpl) + } +} + // Sets up all of the webview attributes. WebViewImpl.prototype.setupWebViewAttributes = function () { this.attributes = {} @@ -278,6 +285,7 @@ WebViewImpl.prototype.setupWebViewAttributes = function () { this.attributes[webViewConstants.ATTRIBUTE_ALLOWPOPUPS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_ALLOWPOPUPS, this) this.attributes[webViewConstants.ATTRIBUTE_PRELOAD] = new PreloadAttribute(this) this.attributes[webViewConstants.ATTRIBUTE_BLINKFEATURES] = new BlinkFeaturesAttribute(this) + this.attributes[webViewConstants.ATTRIBUTE_DISBLEBLINKFEATURES] = new DisableBlinkFeaturesAttribute(this) const autosizeAttributes = [webViewConstants.ATTRIBUTE_MAXHEIGHT, webViewConstants.ATTRIBUTE_MAXWIDTH, webViewConstants.ATTRIBUTE_MINHEIGHT, webViewConstants.ATTRIBUTE_MINWIDTH] autosizeAttributes.forEach((attribute) => { diff --git a/lib/renderer/web-view/web-view-constants.js b/lib/renderer/web-view/web-view-constants.js index 5501f4f3599b..7cce4708ef32 100644 --- a/lib/renderer/web-view/web-view-constants.js +++ b/lib/renderer/web-view/web-view-constants.js @@ -16,6 +16,7 @@ module.exports = { ATTRIBUTE_PRELOAD: 'preload', ATTRIBUTE_USERAGENT: 'useragent', ATTRIBUTE_BLINKFEATURES: 'blinkfeatures', + ATTRIBUTE_DISBLEBLINKFEATURES: 'disableblinkfeatures', // Internal attribute. ATTRIBUTE_INTERNALINSTANCEID: 'internalinstanceid',