rename blinkFeatures to enableBlinkFeatures

This commit is contained in:
Shelley Vohr 2018-05-23 14:01:34 -07:00
parent bc10be3de6
commit 5f5322c64e
No known key found for this signature in database
GPG key ID: F13993A75599653C
9 changed files with 19 additions and 47 deletions

View file

@ -127,8 +127,7 @@ const char kOpenerID[] = "openerId";
const char kScrollBounce[] = "scrollBounce"; const char kScrollBounce[] = "scrollBounce";
// Enable blink features. // Enable blink features.
// TODO(kevinsawicki) Rename to enableBlinkFeatures in 2.0 const char kBlinkFeatures[] = "enableBlinkFeatures";
const char kBlinkFeatures[] = "blinkFeatures";
// Disable blink features. // Disable blink features.
const char kDisableBlinkFeatures[] = "disableBlinkFeatures"; const char kDisableBlinkFeatures[] = "disableBlinkFeatures";

View file

@ -64,7 +64,7 @@ extern const char kExperimentalFeatures[];
extern const char kExperimentalCanvasFeatures[]; extern const char kExperimentalCanvasFeatures[];
extern const char kOpenerID[]; extern const char kOpenerID[];
extern const char kScrollBounce[]; extern const char kScrollBounce[];
extern const char kBlinkFeatures[]; extern const char kEnableBlinkFeatures[];
extern const char kDisableBlinkFeatures[]; extern const char kDisableBlinkFeatures[];
extern const char kNodeIntegrationInWorker[]; extern const char kNodeIntegrationInWorker[];
extern const char kWebviewTag[]; extern const char kWebviewTag[];

View file

@ -309,7 +309,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
canvas features. Default is `false`. canvas features. Default is `false`.
* `scrollBounce` Boolean (optional) - Enables scroll bounce (rubber banding) effect on * `scrollBounce` Boolean (optional) - Enables scroll bounce (rubber banding) effect on
macOS. Default is `false`. macOS. Default is `false`.
* `blinkFeatures` String (optional) - A list of feature strings separated by `,`, like * `enableBlinkFeatures` String (optional) - A list of feature strings separated by `,`, like
`CSSVariables,KeyboardEventKey` to enable. The full list of supported feature `CSSVariables,KeyboardEventKey` to enable. The full list of supported feature
strings can be found in the [RuntimeEnabledFeatures.json5][runtime-enabled-features] strings can be found in the [RuntimeEnabledFeatures.json5][runtime-enabled-features]
file. file.

View file

@ -214,10 +214,10 @@ A name by itself is given a `true` boolean value.
A preference can be set to another value by including an `=`, followed by the value. A preference can be set to another value by including an `=`, followed by the value.
Special values `yes` and `1` are interpreted as `true`, while `no` and `0` are interpreted as `false`. Special values `yes` and `1` are interpreted as `true`, while `no` and `0` are interpreted as `false`.
### `blinkfeatures` ### `enableblinkfeatures`
```html ```html
<webview src="https://www.github.com/" blinkfeatures="PreciseMemoryInfo, CSSVariables"></webview> <webview src="https://www.github.com/" enableblinkfeatures="PreciseMemoryInfo, CSSVariables"></webview>
``` ```
A list of strings which specifies the blink features to be enabled separated by `,`. A list of strings which specifies the blink features to be enabled separated by `,`.

View file

@ -1,30 +1,3 @@
# Planned Breaking API Changes (3.0)
The following list includes the APIs that will be removed in Electron 3.0.
There is no timetable for when this release will occur but deprecation
warnings will be added at least [one major version](electron-versioning.md#semver) beforehand.
## `BrowserWindow`
```js
// Deprecated
let optionsA = {webPreferences: {blinkFeatures: ''}}
let windowA = new BrowserWindow(optionsA)
// Replace with
let optionsB = {webPreferences: {enableBlinkFeatures: ''}}
let windowB = new BrowserWindow(optionsB)
```
## Node Headers URL
This is the URL specified as `disturl` in a `.npmrc` file or as the `--dist-url`
command line flag when building native Node modules.
Deprecated: https://atom.io/download/atom-shell
Replace with: https://atom.io/download/electron
# Planned Breaking API Changes (4.0) # Planned Breaking API Changes (4.0)
The following list includes the APIs that will be removed in Electron 4.0. The following list includes the APIs that will be removed in Electron 4.0.

View file

@ -78,7 +78,7 @@ improve the security of your application.
7. [Override and disable `eval`](#7-override-and-disable-eval), which allows strings to be executed as code. 7. [Override and disable `eval`](#7-override-and-disable-eval), which allows strings to be executed as code.
8. [Do not set `allowRunningInsecureContent` to `true`](#8-do-not-set-allowrunninginsecurecontent-to-true) 8. [Do not set `allowRunningInsecureContent` to `true`](#8-do-not-set-allowrunninginsecurecontent-to-true)
9. [Do not enable experimental features](#9-do-not-enable-experimental-features) 9. [Do not enable experimental features](#9-do-not-enable-experimental-features)
10. [Do not use `blinkFeatures`](#10-do-not-use-blinkfeatures) 10. [Do not use `enableBlinkFeatures`](#10-do-not-use-enableblinkfeatures)
11. [WebViews: Do not use `allowpopups`](#11-do-not-use-allowpopups) 11. [WebViews: Do not use `allowpopups`](#11-do-not-use-allowpopups)
12. [WebViews: Verify the options and params of all `<webview>` tags](#12-verify-webview-options-before-creation) 12. [WebViews: Verify the options and params of all `<webview>` tags](#12-verify-webview-options-before-creation)
@ -452,12 +452,12 @@ const mainWindow = new BrowserWindow({})
``` ```
## 10) Do Not Use `blinkFeatures` ## 10) Do Not Use `enableBlinkFeatures`
_Recommendation is Electron's default_ _Recommendation is Electron's default_
Blink is the name of the rendering engine behind Chromium. As with Blink is the name of the rendering engine behind Chromium. As with
`experimentalFeatures`, the `blinkFeatures` property allows developers to `experimentalFeatures`, the `enableBlinkFeatures` property allows developers to
enable features that have been disabled by default. enable features that have been disabled by default.
### Why? ### Why?
@ -473,7 +473,7 @@ no circumstances should you enable features speculatively.
// Bad // Bad
const mainWindow = new BrowserWindow({ const mainWindow = new BrowserWindow({
webPreferences: { webPreferences: {
blinkFeatures: ['ExecCommandInJavaScript'] enableBlinkFeatures: ['ExecCommandInJavaScript']
} }
}) })
``` ```

View file

@ -217,7 +217,7 @@ const attachGuest = function (event, elementInstanceId, guestInstanceId, params)
plugins: params.plugins, plugins: params.plugins,
zoomFactor: embedder._getZoomFactor(), zoomFactor: embedder._getZoomFactor(),
webSecurity: !params.disablewebsecurity, webSecurity: !params.disablewebsecurity,
blinkFeatures: params.blinkfeatures, enableBlinkFeatures: params.blinkfeatures,
disableBlinkFeatures: params.disableblinkfeatures disableBlinkFeatures: params.disableblinkfeatures
} }

View file

@ -31,7 +31,7 @@ const {
warnAboutDisabledWebSecurity, warnAboutDisabledWebSecurity,
warnAboutInsecureContentAllowed, warnAboutInsecureContentAllowed,
warnAboutExperimentalFeatures, warnAboutExperimentalFeatures,
warnAboutBlinkFeatures, warnAboutEnableBlinkFeatures,
warnAboutInsecureResources, warnAboutInsecureResources,
warnAboutInsecureCSP, warnAboutInsecureCSP,
warnAboutAllowedPopups, warnAboutAllowedPopups,
@ -177,7 +177,7 @@ window.addEventListener('load', function loadHandler () {
warnAboutInsecureResources() warnAboutInsecureResources()
warnAboutInsecureContentAllowed() warnAboutInsecureContentAllowed()
warnAboutExperimentalFeatures() warnAboutExperimentalFeatures()
warnAboutBlinkFeatures() warnAboutEnableBlinkFeatures()
warnAboutInsecureCSP() warnAboutInsecureCSP()
warnAboutAllowedPopups() warnAboutAllowedPopups()
} }

View file

@ -229,23 +229,23 @@ module.exports = {
}, },
/** /**
* #10 on the checklist: Do not use blinkFeatures * #10 on the checklist: Do not use enableBlinkFeatures
* *
* Logs a warning message about blinkFeatures * Logs a warning message about enableBlinkFeatures
*/ */
warnAboutBlinkFeatures: () => { warnAboutEnableBlinkFeatures: () => {
const webPreferences = getWebPreferences() const webPreferences = getWebPreferences()
if (!webPreferences || !webPreferences.blinkFeatures || if (!webPreferences || !webPreferences.enableBlinkFeatures ||
(webPreferences.blinkFeatures.length && webPreferences.blinkFeatures.length === 0)) { (webPreferences.enableBlinkFeatures.length && webPreferences.enableBlinkFeatures.length === 0)) {
return return
} }
let warning = 'This renderer process has additional "blinkFeatures" ' + let warning = 'This renderer process has additional "enableBlinkFeatures" ' +
'enabled. This exposes users of this app to some security risk. ' + 'enabled. This exposes users of this app to some security risk. ' +
'If you do not need this feature, you should disable it.\n' + 'If you do not need this feature, you should disable it.\n' +
moreInformation moreInformation
console.warn('%cElectron Security Warning (blinkFeatures)', console.warn('%cElectron Security Warning (enableBlinkFeatures)',
'font-weight: bold;', warning) 'font-weight: bold;', warning)
}, },