From ae71cf3df139bd1373b60effc23e5715094a922a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 13:42:42 -0700 Subject: [PATCH 01/10] Add disableBlinkFeatures option --- atom/browser/web_contents_preferences.cc | 7 +++++++ atom/common/options_switches.cc | 3 +++ atom/common/options_switches.h | 1 + 3 files changed, 11 insertions(+) diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index a32e23de68f5..8a7eee09201f 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -166,6 +166,13 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches( command_line->AppendSwitchASCII(::switches::kEnableBlinkFeatures, blink_features); + // Disable blink features. + std::string disable_blink_features; + if (web_preferences.GetString(options::kDisableBlinkFeatures, + &disable_blink_features)) + command_line->AppendSwitchASCII(::switches::kDisableBlinkFeatures, + disable_blink_features); + // The initial visibility state. NativeWindow* window = NativeWindow::FromWebContents(web_contents); diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index de130eee13eb..2447d7324b99 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -109,6 +109,9 @@ const char kScrollBounce[] = "scrollBounce"; // Enable blink features. const char kBlinkFeatures[] = "blinkFeatures"; +// Disable blink features. +const char kDisableBlinkFeatures[] = "disableBlinkFeatures"; + } // namespace options namespace switches { diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index fadde79f18c8..0f75e56dcb30 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -58,6 +58,7 @@ extern const char kExperimentalCanvasFeatures[]; extern const char kOpenerID[]; extern const char kScrollBounce[]; extern const char kBlinkFeatures[]; +extern const char kDisableBlinkFeatures[]; } // namespace options From ca6e3ed1efd7c480644070f257a9c7a2e158b871 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 13:49:31 -0700 Subject: [PATCH 02/10] 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', From b941e25bf569dc02d1ba8f04161995d11a618e43 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 13:55:44 -0700 Subject: [PATCH 03/10] Link to RuntimeEnabledFeatures.in --- docs/api/browser-window.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index e6ff43ca234d..2351c0d404f0 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -176,8 +176,7 @@ The `webPreferences` option is an object that can have following properties: OS X. Default is `false`. * `blinkFeatures` String - A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`. The full list of supported feature strings - can be found in the [setFeatureEnabledFromString][blink-feature-string] - function. + can be found in the [RuntimeEnabledFeatures.in][blink-feature-string] file. * `defaultFontFamily` Object - Sets the default font for the font-family. * `standard` String - Defaults to `Times New Roman`. * `serif` String - Defaults to `Times New Roman`. @@ -938,4 +937,4 @@ All mouse events happened in this window will be passed to the window bellow this window, but if this window has focus, it will still receive keyboard events. -[blink-feature-string]: https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/blink/platform/RuntimeEnabledFeatures.cpp&sq=package:chromium&type=cs&l=576 +[blink-feature-string]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in From 636e356977fb580bba6204b546d1a4c95f172133 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 13:56:33 -0700 Subject: [PATCH 04/10] Document disableBlinkFeatures option --- docs/api/browser-window.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 2351c0d404f0..b89daa877f64 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -177,6 +177,10 @@ The `webPreferences` option is an object that can have following properties: * `blinkFeatures` String - A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`. The full list of supported feature strings can be found in the [RuntimeEnabledFeatures.in][blink-feature-string] file. +* `disableBlinkFeatures` String - A list of feature strings separated by `,`, + like `CSSVariables,KeyboardEventKey`. The full list of supported feature + strings can be found in the [RuntimeEnabledFeatures.in][blink-feature-string] + file. * `defaultFontFamily` Object - Sets the default font for the font-family. * `standard` String - Defaults to `Times New Roman`. * `serif` String - Defaults to `Times New Roman`. From 1b6a95adcb2f767534ba25729fbade274cf44d64 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 13:57:54 -0700 Subject: [PATCH 05/10] Document disableblinkfeatures attribute --- docs/api/web-view-tag.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index d00f64d4eb53..1c9edcecaa75 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -205,7 +205,17 @@ If "on", the guest page will be allowed to open new windows. A list of strings which specifies the blink features to be enabled separated by `,`. The full list of supported feature strings can be found in the -[setFeatureEnabledFromString][blink-feature-string] function. +[RuntimeEnabledFeatures.in][blink-feature-string] file. + +### `disableblinkfeatures` + +```html + +``` + +A list of strings which specifies the blink features to be disabled separated by `,`. +The full list of supported feature strings can be found in the +[RuntimeEnabledFeatures.in][blink-feature-string] file. ## Methods @@ -802,4 +812,4 @@ Emitted when DevTools is closed. Emitted when DevTools is focused / opened. -[blink-feature-string]: https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/blink/platform/RuntimeEnabledFeatures.cpp&sq=package:chromium&type=cs&l=527 +[blink-feature-string]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in From c7f2c25bc90f081b79aca9ec478f0b663d7203a8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 13:59:30 -0700 Subject: [PATCH 06/10] Mention enabling/disabling --- docs/api/browser-window.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index b89daa877f64..e20d17b8e772 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -175,12 +175,13 @@ The `webPreferences` option is an object that can have following properties: * `scrollBounce` Boolean - Enables scroll bounce (rubber banding) effect on OS X. Default is `false`. * `blinkFeatures` String - A list of feature strings separated by `,`, like - `CSSVariables,KeyboardEventKey`. The full list of supported feature strings - can be found in the [RuntimeEnabledFeatures.in][blink-feature-string] file. -* `disableBlinkFeatures` String - A list of feature strings separated by `,`, - like `CSSVariables,KeyboardEventKey`. The full list of supported feature + `CSSVariables,KeyboardEventKey` to enable. The full list of supported feature strings can be found in the [RuntimeEnabledFeatures.in][blink-feature-string] file. +* `disableBlinkFeatures` String - A list of feature strings separated by `,`, + like `CSSVariables,KeyboardEventKey` to disable. The full list of supported + feature strings can be found in the + [RuntimeEnabledFeatures.in][blink-feature-string] file. * `defaultFontFamily` Object - Sets the default font for the font-family. * `standard` String - Defaults to `Times New Roman`. * `serif` String - Defaults to `Times New Roman`. From f7b0bb2bf3b15df34543b963979945c7528c8263 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 16:23:09 -0700 Subject: [PATCH 07/10] Add TODO about blinkFeatures -> enableBlinkFeatures --- atom/common/options_switches.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index 2447d7324b99..22cdc3c63aef 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -107,6 +107,7 @@ const char kOpenerID[] = "openerId"; const char kScrollBounce[] = "scrollBounce"; // Enable blink features. +// TODO(kevinsawicki) Rename to enableBlinkFeatures in 2.0 const char kBlinkFeatures[] = "blinkFeatures"; // Disable blink features. From 96012d6523c6ffd187608ec7b264c77ea87d1253 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 16:24:05 -0700 Subject: [PATCH 08/10] Remove trailing comma --- lib/browser/guest-view-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/browser/guest-view-manager.js b/lib/browser/guest-view-manager.js index 604e1785fe92..4e7721c40aa3 100644 --- a/lib/browser/guest-view-manager.js +++ b/lib/browser/guest-view-manager.js @@ -183,7 +183,7 @@ var attachGuest = function (embedder, elementInstanceId, guestInstanceId, params zoomFactor: params.zoomFactor, webSecurity: !params.disablewebsecurity, blinkFeatures: params.blinkfeatures, - disableBlinkFeatures: params.disableBlinkFeatures, + disableBlinkFeatures: params.disableBlinkFeatures } if (params.preload) { From cd2041375b7fc17d417979c20d525d3e1b9276a2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 16:26:53 -0700 Subject: [PATCH 09/10] Add missing A in constant name --- lib/renderer/web-view/web-view-attributes.js | 4 ++-- lib/renderer/web-view/web-view-constants.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/renderer/web-view/web-view-attributes.js b/lib/renderer/web-view/web-view-attributes.js index d62c496f4228..e918578900cd 100644 --- a/lib/renderer/web-view/web-view-attributes.js +++ b/lib/renderer/web-view/web-view-attributes.js @@ -267,7 +267,7 @@ class BlinkFeaturesAttribute extends WebViewAttribute { // Attribute that specifies the blink features to be disabled. class DisableBlinkFeaturesAttribute extends WebViewAttribute { constructor (webViewImpl) { - super(webViewConstants.ATTRIBUTE_DISBLEBLINKFEATURES, webViewImpl) + super(webViewConstants.ATTRIBUTE_DISABLEBLINKFEATURES, webViewImpl) } } @@ -285,7 +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) + this.attributes[webViewConstants.ATTRIBUTE_DISABLEBLINKFEATURES] = 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 7cce4708ef32..96ee289831e9 100644 --- a/lib/renderer/web-view/web-view-constants.js +++ b/lib/renderer/web-view/web-view-constants.js @@ -16,7 +16,7 @@ module.exports = { ATTRIBUTE_PRELOAD: 'preload', ATTRIBUTE_USERAGENT: 'useragent', ATTRIBUTE_BLINKFEATURES: 'blinkfeatures', - ATTRIBUTE_DISBLEBLINKFEATURES: 'disableblinkfeatures', + ATTRIBUTE_DISABLEBLINKFEATURES: 'disableblinkfeatures', // Internal attribute. ATTRIBUTE_INTERNALINSTANCEID: 'internalinstanceid', From 02e0ca60efac035adfd00e6884cccbd4e61f2b30 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Jun 2016 16:35:23 -0700 Subject: [PATCH 10/10] Use lowercase param key --- lib/browser/guest-view-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/browser/guest-view-manager.js b/lib/browser/guest-view-manager.js index 4e7721c40aa3..b7a93b068a58 100644 --- a/lib/browser/guest-view-manager.js +++ b/lib/browser/guest-view-manager.js @@ -183,7 +183,7 @@ var attachGuest = function (embedder, elementInstanceId, guestInstanceId, params zoomFactor: params.zoomFactor, webSecurity: !params.disablewebsecurity, blinkFeatures: params.blinkfeatures, - disableBlinkFeatures: params.disableBlinkFeatures + disableBlinkFeatures: params.disableblinkfeatures } if (params.preload) {