Merge branch 'master' into breaking-changes

This commit is contained in:
Charles Kerr 2018-05-31 12:12:02 +02:00
commit c7d1f95240
41 changed files with 267 additions and 298 deletions

View file

@ -309,7 +309,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
canvas features. Default is `false`.
* `scrollBounce` Boolean (optional) - Enables scroll bounce (rubber banding) effect on
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
strings can be found in the [RuntimeEnabledFeatures.json5][runtime-enabled-features]
file.

View file

@ -22,7 +22,7 @@ win.loadURL('https://github.com')
```
**Note:** For the reverse (access the renderer process from the main process),
you can use [webContents.executeJavascript](web-contents.md#contentsexecutejavascriptcode-usergesture-callback).
you can use [webContents.executeJavaScript](web-contents.md#contentsexecutejavascriptcode-usergesture-callback).
## Remote Objects

View file

@ -95,10 +95,6 @@ Returns [`Point`](structures/point.md)
The current absolute position of the mouse pointer.
### `screen.getMenuBarHeight()` _macOS_
Returns `Integer` - The height of the menu bar in pixels.
### `screen.getPrimaryDisplay()`
Returns [`Display`](structures/display.md) - The primary display.

View file

@ -81,16 +81,6 @@ webFrame.setSpellCheckProvider('en-US', true, {
})
```
### `webFrame.registerURLSchemeAsSecure(scheme)`
* `scheme` String
Registers the `scheme` as secure scheme.
Secure schemes do not trigger mixed content warnings. For example, `https` and
`data` are secure schemes because they cannot be corrupted by active network
attackers.
### `webFrame.registerURLSchemeAsBypassingCSP(scheme)`
* `scheme` String

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.
Special values `yes` and `1` are interpreted as `true`, while `no` and `0` are interpreted as `false`.
### `blinkfeatures`
### `enableblinkfeatures`
```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 `,`.

View file

@ -0,0 +1,93 @@
# Build Instructions (experimental GN build)
Follow the guidelines below for building Electron with the experimental GN
build.
> **NOTE**: The GN build system is in _experimental_ status, and currently only
> works on macOS and Linux, in debug mode, as a component build.
## Prerequisites
See the [macOS](build-instructions-osx.md#prerequisites) or
[Linux](build-instructions-linux.md#prerequisites) build instructions for the
requirements for your platform. In addition, you'll need to install
[`depot_tools`][depot-tools], the toolset used for fetching Chromium and its
dependencies.
[depot-tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
## Getting the Code
```sh
$ mkdir electron-gn && cd electron-gn
$ cat > .gclient <<-GCLIENT
solutions = [
{
"url": "https://github.com/electron/electron",
"managed": False,
"name": "src/electron",
},
]
GCLIENT
$ gclient sync --with_branch_heads --with_tags
# This will take a while, go get a coffee.
```
## Building
```sh
$ cd src
$ export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools
$ gn gen out/Default --args='root_extra_deps=["//electron"] is_electron_build=true is_component_build=true use_jumbo_build=true v8_promise_internal_field_count=1 v8_typed_array_max_size_in_heap=0'
```
This will generate all the ninja files needed for the build. You shouldn't have
to run `gn gen` again—if you want to change the build arguments you can run `gn
args out/Default` to bring up an editor.
To build, run `ninja` with the `electron:electron_app` target:
```sh
$ ninja -C out/Default electron:electron_app
# This will also take a while and probably heat up your lap.
```
This will build all of what was previously 'libchromiumcontent' (i.e. the
`content/` directory of `chromium` and its dependencies, incl. WebKit and V8),
so it will take a while.
To speed up subsequent builds, you can use [sccache][sccache]. Add the GN arg
`cc_wrapper="sccache"` by running `gn args out/Default` to bring up an editor.
[sccache]: https://github.com/mozilla/sccache
The built executable will be under `./out/Default`:
```sh
$ ./out/Default/Electron.app/Contents/MacOS/Electron
# or, on Linux
$ ./out/Default/electron
```
## Tests
To run the tests, you'll first need to build the test modules against the
same version of node.js that was built as part of the build process.
```sh
$ (cd electron/spec && npm i --nodedir=../../third_party/electron_node)
```
Then, run Electron with `electron/spec` as the argument:
```sh
$ ./out/Default/Electron.app/Contents/MacOS/Electron electron/spec
```
If you're debugging something, it can be helpful to pass some extra flags to
the Electron binary:
```sh
$ ./out/Default/Electron.app/Contents/MacOS/Electron electron/spec \
--ci --enable-logging -g 'BrowserWindow module'
```

View file

@ -12,7 +12,7 @@ Follow the guidelines below for building Electron on Linux.
For a quick test, run the following script:
```sh
$ python ./script/check-tls.py
$ python ./script/tls.py
```
If the script returns that your configuration is using an outdated security

View file

@ -15,7 +15,7 @@ Please also ensure that your system and Python version support at least TLS 1.2.
This depends on both your version of macOS and Python. For a quick test, run:
```sh
$ python ./script/check-tls.py
$ python ./script/tls.py
```
If the script returns that your configuration is using an outdated security

View file

@ -61,7 +61,7 @@ the notification away.
## macOS
Notifications are straight-forward on macOS, but you should be aware of
[Apple's Human Interface guidelines regarding notifications](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/NotificationCenter.html).
[Apple's Human Interface guidelines regarding notifications](https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/).
Note that notifications are limited to 256 bytes in size and will be truncated
if you exceed that limit.

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.
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)
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)
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_
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.
### Why?
@ -473,7 +473,7 @@ no circumstances should you enable features speculatively.
// Bad
const mainWindow = new BrowserWindow({
webPreferences: {
blinkFeatures: ['ExecCommandInJavaScript']
enableBlinkFeatures: ['ExecCommandInJavaScript']
}
})
```