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..22cdc3c63aef 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -107,8 +107,12 @@ 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. +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 diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index e6ff43ca234d..e20d17b8e772 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -175,9 +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 [setFeatureEnabledFromString][blink-feature-string] - function. + `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`. @@ -938,4 +942,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 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 diff --git a/lib/browser/guest-view-manager.js b/lib/browser/guest-view-manager.js index a0bc751813bf..fdd426c229f6 100644 --- a/lib/browser/guest-view-manager.js +++ b/lib/browser/guest-view-manager.js @@ -177,7 +177,8 @@ const attachGuest = function (embedder, elementInstanceId, guestInstanceId, para 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..e918578900cd 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_DISABLEBLINKFEATURES, 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_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 5501f4f3599b..96ee289831e9 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_DISABLEBLINKFEATURES: 'disableblinkfeatures', // Internal attribute. ATTRIBUTE_INTERNALINSTANCEID: 'internalinstanceid',