Skip to content

Commit

Permalink
Merge branch 'main' into support-more-color-formats
Browse files Browse the repository at this point in the history
  • Loading branch information
jkleinsc authored and codebytere committed Jan 13, 2022
2 parents e684198 + 3834aaf commit e5097a6
Show file tree
Hide file tree
Showing 519 changed files with 2,550 additions and 2,181 deletions.
16 changes: 10 additions & 6 deletions .circleci/config.yml
Expand Up @@ -447,16 +447,20 @@ step-install-npm-deps-on-mac: &step-install-npm-deps-on-mac
# This step handles the differences between the linux "gclient sync"
# and the expected state on macOS
step-fix-sync-on-mac: &step-fix-sync-on-mac
step-fix-sync: &step-fix-sync
run:
name: Fix Sync on macOS
name: Fix Sync
command: |
if [ "`uname`" == "Darwin" ]; then
# Fix Clang Install (wrong binary)
rm -rf src/third_party/llvm-build
python src/tools/clang/scripts/update.py
python3 src/tools/clang/scripts/update.py
fi
cd src/third_party/angle
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
git fetch
step-install-signing-cert-on-mac: &step-install-signing-cert-on-mac
run:
name: Import and trust self-signed codesigning cert on MacOS
Expand Down Expand Up @@ -1118,7 +1122,7 @@ steps-electron-ts-compile-for-doc-change: &steps-electron-ts-compile-for-doc-cha
- *step-setup-goma-for-build
- *step-get-more-space-on-mac
- *step-install-npm-deps-on-mac
- *step-fix-sync-on-mac
- *step-fix-sync
- *step-gn-gen-default

#Compile ts/js to verify doc change didn't break anything
Expand Down Expand Up @@ -1473,7 +1477,7 @@ commands:
- *step-setup-env-for-build
- *step-setup-goma-for-build
- *step-get-more-space-on-mac
- *step-fix-sync-on-mac
- *step-fix-sync
- *step-delete-git-directories

# Electron app
Expand Down Expand Up @@ -1577,7 +1581,7 @@ commands:
- *step-gclient-sync
- *step-delete-git-directories
- *step-minimize-workspace-size-from-checkout
- *step-fix-sync-on-mac
- *step-fix-sync
- *step-setup-env-for-build
- *step-setup-goma-for-build
- *step-gn-gen-default
Expand Down
7 changes: 6 additions & 1 deletion BUILD.gn
Expand Up @@ -538,14 +538,19 @@ source_set("electron_lib") {
"//build/config/linux/gtk",
"//dbus",
"//device/bluetooth",
"//ui/base/ime/linux",
"//ui/events/devices/x11",
"//ui/events/platform/x11",
"//ui/gtk",
"//ui/views/controls/webview",
"//ui/wm",
]
if (use_x11) {
if (ozone_platform_x11) {
sources += filenames.lib_sources_linux_x11
public_deps += [
"//ui/base/x",
"//ui/platform_window/x11",
]
}
configs += [ ":gio_unix" ]
defines += [
Expand Down
2 changes: 1 addition & 1 deletion DEPS
Expand Up @@ -15,7 +15,7 @@ gclient_gn_args = [

vars = {
'chromium_version':
'96.0.4664.4',
'98.0.4706.0',
'node_version':
'v16.13.0',
'nan_version':
Expand Down
2 changes: 1 addition & 1 deletion ELECTRON_VERSION
@@ -1 +1 @@
17.0.0-nightly.20211115
18.0.0-nightly.20211124
5 changes: 4 additions & 1 deletion build/args/all.gn
Expand Up @@ -2,7 +2,7 @@ is_electron_build = true
root_extra_deps = [ "//electron" ]

# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
node_module_version = 101
node_module_version = 103

v8_promise_internal_field_count = 1
v8_typed_array_max_size_in_heap = 0
Expand All @@ -11,6 +11,9 @@ v8_embedder_string = "-electron.0"
# TODO: this breaks mksnapshot
v8_enable_snapshot_native_code_counters = false

# TODO(codebytere): remove when Node.js handles https://chromium-review.googlesource.com/c/v8/v8/+/3211575
v8_scriptormodule_legacy_lifetime = true

enable_cdm_host_verification = false
proprietary_codecs = true
ffmpeg_branding = "Chrome"
Expand Down
2 changes: 0 additions & 2 deletions chromium_src/BUILD.gn
Expand Up @@ -69,8 +69,6 @@ static_library("chrome") {
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.h",
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.cc",
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.h",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.cc",
Expand Down
4 changes: 2 additions & 2 deletions docs/development/creating-api.md
Expand Up @@ -50,8 +50,8 @@ In your `api_name.h` file:

```cpp title='api_name.h'

#ifndef SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_
#define SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_

#include "gin/handle.h"
#include "gin/wrappable.h"
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/application-distribution.md
Expand Up @@ -56,7 +56,7 @@ will then be your distribution to deliver to users.

### With an app source code archive

Instead of from shipping your app by copying all of its source files, you can
Instead of shipping your app by copying all of its source files, you can
package your app into an [asar] archive to improve the performance of reading
files on platforms like Windows, if you are not already using a bundler such
as Parcel or Webpack.
Expand Down
148 changes: 146 additions & 2 deletions docs/tutorial/automated-testing.md
Expand Up @@ -58,8 +58,6 @@ To run your tests:
$ npx wdio run wdio.conf.js
```

[chrome-driver]: https://sites.google.com/chromium.org/driver/

### With Selenium

[Selenium](https://www.selenium.dev/) is a web automation framework that
Expand Down Expand Up @@ -116,6 +114,142 @@ driver.wait(() => {
driver.quit()
```

## Using Playwright

[Microsoft Playwright](https://playwright.dev) is an end-to-end testing framework built
using browser-specific remote debugging protocols, similar to the [Puppeteer] headless
Node.js API but geared towards end-to-end testing. Playwright has experimental Electron
support via Electron's support for the [Chrome DevTools Protocol] (CDP).

### Install dependencies

You can install Playwright through your preferred Node.js package manager. The Playwright team
recommends using the `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` environment variable to avoid
unnecessary browser downloads when testing an Electron app.

```sh npm2yarn
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install --save-dev playwright
```

Playwright also comes with its own test runner, Playwright Test, which is built for end-to-end
testing. You can also install it as a dev dependency in your project:

```sh npm2yarn
npm install --save-dev @playwright/test
```

:::caution Dependencies
This tutorial was written `playwright@1.16.3` and `@playwright/test@1.16.3`. Check out
[Playwright's releases][playwright-releases] page to learn about
changes that might affect the code below.
:::

:::info Using third-party test runners
If you're interested in using an alternative test runner (e.g. Jest or Mocha), check out
Playwright's [Third-Party Test Runner][playwright-test-runners] guide.
:::

### Write your tests

Playwright launches your app in development mode through the `_electron.launch` API.
To point this API to your Electron app, you can pass the path to your main process
entry point (here, it is `main.js`).

```js {5}
const { _electron: electron } = require('playwright')
const { test } = require('@playwright/test')

test('launch app', async () => {
const electronApp = await electron.launch({ args: ['main.js'] })
// close app
await electronApp.close()
})
```

After that, you will access to an instance of Playwright's `ElectronApp` class. This
is a powerful class that has access to main process modules for example:

```js {6-11}
const { _electron: electron } = require('playwright')
const { test } = require('@playwright/test')

test('get isPackaged', async () => {
const electronApp = await electron.launch({ args: ['main.js'] })
const isPackaged = await electronApp.evaluate(async ({ app }) => {
// This runs in Electron's main process, parameter here is always
// the result of the require('electron') in the main app script.
return app.isPackaged
})
console.log(isPackaged) // false (because we're in development mode)
// close app
await electronApp.close()
})
```

It can also create individual [Page][playwright-page] objects from Electron BrowserWindow instances.
For example, to grab the first BrowserWindow and save a screenshot:

```js {6-7}
const { _electron: electron } = require('playwright')
const { test } = require('@playwright/test')

test('save screenshot', async () => {
const electronApp = await electron.launch({ args: ['main.js'] })
const window = await electronApp.firstWindow()
await window.screenshot({ path: 'intro.png' })
// close app
await electronApp.close()
})
```

Putting all this together using the PlayWright Test runner, let's create a `example.spec.js`
test file with a single test and assertion:

```js title='example.spec.js'
const { _electron: electron } = require('playwright')
const { test, expect } = require('@playwright/test')

test('example test', async () => {
const electronApp = await electron.launch({ args: ['.'] })
const isPackaged = await electronApp.evaluate(async ({ app }) => {
// This runs in Electron's main process, parameter here is always
// the result of the require('electron') in the main app script.
return app.isPackaged;
});

expect(isPackaged).toBe(false);

// Wait for the first BrowserWindow to open
// and return its Page object
const window = await electronApp.firstWindow()
await window.screenshot({ path: 'intro.png' })

// close app
await electronApp.close()
});
```

Then, run Playwright Test using `npx playwright test`. You should see the test pass in your
console, and have an `intro.png` screenshot on your filesystem.

```console
☁ $ npx playwright test

Running 1 test using 1 worker

✓ example.spec.js:4:1 › example test (1s)
```

:::info
Playwright Test will automatically run any files matching the `.*(test|spec)\.(js|ts|mjs)` regex.
You can customize this match in the [Playwright Test configuration options][playwright-test-config].
:::

:::tip Further reading
Check out Playwright's documentation for the full [Electron][playwright-electron]
and [ElectronApplication][playwright-electronapplication] class APIs.
:::

## Using a custom test driver

It's also possible to write your own custom driver using Node.js' built-in IPC-over-STDIO.
Expand Down Expand Up @@ -263,3 +397,13 @@ test.after.always('cleanup', async t => {
await app.stop()
})
```

[chrome-driver]: https://sites.google.com/chromium.org/driver/
[Puppeteer]: https://github.com/puppeteer/puppeteer
[playwright-electron]: https://playwright.dev/docs/api/class-electron/
[playwright-electronapplication]: https://playwright.dev/docs/api/class-electronapplication
[playwright-page]: https://playwright.dev/docs/api/class-page
[playwright-releases]: https://github.com/microsoft/playwright/releases
[playwright-test-config]: https://playwright.dev/docs/api/class-testconfig#test-config-test-match
[playwright-test-runners]: https://playwright.dev/docs/test-runners/
[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/
26 changes: 4 additions & 22 deletions docs/tutorial/installation.md
Expand Up @@ -112,30 +112,12 @@ cache also in `~/.electron`.
You can also override the local cache location by providing a `electron_config_cache`
environment variable.

The cache contains the version's official zip file as well as a checksum, stored as
a text file. A typical cache might look like this:
The cache contains the version's official zip file as well as a checksum, and is stored as
`[checksum]/[filename]`. A typical cache might look like this:

```sh
├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9electron-v1.7.9-darwin-x64.zip
│ └── electron-v1.7.9-darwin-x64.zip
├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9SHASUMS256.txt
│ └── SHASUMS256.txt
├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1electron-v1.8.1-darwin-x64.zip
│ └── electron-v1.8.1-darwin-x64.zip
├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1SHASUMS256.txt
│ └── SHASUMS256.txt
├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1electron-v1.8.2-beta.1-darwin-x64.zip
│ └── electron-v1.8.2-beta.1-darwin-x64.zip
├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1SHASUMS256.txt
│ └── SHASUMS256.txt
├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2electron-v1.8.2-beta.2-darwin-x64.zip
│ └── electron-v1.8.2-beta.2-darwin-x64.zip
├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2SHASUMS256.txt
│ └── SHASUMS256.txt
├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3electron-v1.8.2-beta.3-darwin-x64.zip
│ └── electron-v1.8.2-beta.3-darwin-x64.zip
└── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3SHASUMS256.txt
└── SHASUMS256.txt
├── a91b089b5dc5b1279966511344b805ec84869b6cd60af44f800b363bba25b915
│ └── electron-v15.3.1-darwin-x64.zip
```

## Skip binary download
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/support.md
Expand Up @@ -70,10 +70,10 @@ until the maintainers feel the maintenance burden is too high to continue doing

### Currently supported versions

* 18.x.y
* 17.x.y
* 16.x.y
* 15.x.y
* 14.x.y

### End-of-life

Expand Down
17 changes: 17 additions & 0 deletions electron_strings.grdp
Expand Up @@ -33,6 +33,23 @@
{SCREEN_INDEX, plural, =1{Screen #} other{Screen #}}
</message>

<!-- File Select Helper-->
<message name="IDS_IMAGE_FILES" desc="The description of the image file extensions in the select file dialog.">
Image Files
</message>
<message name="IDS_AUDIO_FILES" desc="The description of the audio file extensions in the select file dialog.">
Audio Files
</message>
<message name="IDS_VIDEO_FILES" desc="The description of the video file extensions in the select file dialog.">
Video Files
</message>
<message name="IDS_CUSTOM_FILES" desc="The description of the custom file extensions in the select file dialog.">
Custom Files
</message>
<message name="IDS_DEFAULT_DOWNLOAD_FILENAME" desc="Default name for downloaded files when we have no idea what they could be.">
download
</message>

<!-- Picture-in-Picture -->
<if expr="is_macosx">
<message name="IDS_PICTURE_IN_PICTURE_TITLE_TEXT" desc="Title of the Picture-in-Picture window. This appears in the system tray and window header.">
Expand Down
6 changes: 3 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "17.0.0-nightly.20211115",
"version": "18.0.0-nightly.20211124",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {
Expand Down Expand Up @@ -31,7 +31,7 @@
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"asar": "^3.1.0",
"aws-sdk": "^2.727.1",
"aws-sdk": "^2.814.0",
"check-for-leaks": "^1.2.1",
"colors": "^1.4.0",
"dotenv-safe": "^4.0.4",
Expand Down Expand Up @@ -141,4 +141,4 @@
"node script/gen-hunspell-filenames.js"
]
}
}
}
1 change: 0 additions & 1 deletion patches/boringssl/.patches
Expand Up @@ -2,4 +2,3 @@ expose_ripemd160.patch
expose_aes-cfb.patch
expose_des-ede3.patch
fix_sync_evp_get_cipherbynid_and_evp_get_cipherbyname.patch
enable_x509_v_flag_trusted_first_flag.patch

0 comments on commit e5097a6

Please sign in to comment.