Compare commits

...

185 Commits

Author SHA1 Message Date
Electron Bot
3651c0411f Bump v13.0.0 2021-05-24 09:04:22 -07:00
Keeley Hammond
cb798f26b8 test: rebuild nan tests with libc++ and libc++abi (#29294)
* test: rebuild nan tests with libc++ and libc++abi (#29281)

* test: re-enable nan test: typedarrays-test.js

Fixes #28414.

I've confirmed this fix wfm on Linux. Pushing into a PR to get CI to run
it out on Win and Mac platforms too.

* chore: clarify comment

* test: fix NAN test string alignment

* test: (wip) add ldflags, archive file for libc++

* test: (wip) add libc++ to CircleCI

* test: (wip) add llvm flags

* test: (wip) change ldflag syntax

* test: (wip) build libc++abi as static

* fix: correct ldflags

* test: add ld env

* fix: do not commit this

* test: add lld from src to circleci

* test: add lld link to ld

* chore: preserve third_party

* seems legit

* sam swears this works kinda sort of sometimes'
:

* build: add gn visibility patch

* chore: update patches

* build: check for flatten_relative_to = false

* build: upload zip files, add to release.js validation

* debug: what the hell gn

* build: add libcxx gni to lint ignore

Linting the file adjusted the licenses array, which only contains
one value, and causes the gn check to fail later

* build: also use nan-spec-runner flags on Windows

* build: add linked flags for win32 only

* build: build libc++ as source on win

* build: clean up patch, add -fPIC for IA32

* build: delete libcxx .a files from root

* build: rename libc++.zip, clean up upload per platform

* build: fix gni lint

* ci: add libcxx gen to circleci config

* build: correct libcxx-object syntax

Co-authored-by: Samuel Attard <sam@electronjs.org>

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>

* build: correct libcxx_objects build action name

* build: only upload libcxx headers on linux

* build: ensure object files are included even if unparsable

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-05-24 11:28:09 -04:00
Electron Bot
215c2d3ec7 Revert "Bump v13.0.0-beta.29"
This reverts commit 9df6131352.
2021-05-24 06:57:12 -07:00
Electron Bot
9df6131352 Bump v13.0.0-beta.29 2021-05-24 06:32:56 -07:00
trop[bot]
4d7188fd2e docs: Update online detection doc and fiddle (#29309)
* rework online detection doc and fiddle

* add footnote

* Update docs/tutorial/online-offline-events.md

Co-authored-by: Erick Zhao <erick@hotmail.ca>

* Update docs/tutorial/online-offline-events.md

Co-authored-by: Erick Zhao <erick@hotmail.ca>

* Update docs/tutorial/online-offline-events.md

* Update docs/tutorial/online-offline-events.md

* Update docs/tutorial/online-offline-events.md

* chore: fix lint error

Co-authored-by: Ethan Arrowood <ethan.arrowood@gmail.com>
Co-authored-by: Ethan Arrowood <ethan@arrowood.dev>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-05-24 20:29:15 +09:00
Keeley Hammond
c69d0eea2e feat: add more info in setWindowOpenHandler details (#28518) (#29277)
* fix: invoke the window open handler for _blank links

* feat: add disposition to setWindowOpenHandler details

* fix: pass postData to new-window event

* postData can be heterogeneous

* fix type of postBody

* fix type of UploadFile and UploadRawData to be discriminated unions

* exclude the empty string from additionalFeatures

* add a test

* add postBody and referrer to setWindowOpenHandler args

* appease typescript

* Update api-browser-window-spec.ts

* update snapshots

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-05-24 16:49:52 +09:00
trop[bot]
1e54d19e8a Use path.join when logging screenshot path. (#29305)
Remove index.html from offscreen-rendering tutorial.
It is not used.

Update offscreen-rendering.md to reflect changes to fiddle.

Co-authored-by: Kevin Hartman <kevin@hart.mn>
2021-05-24 16:47:45 +09:00
trop[bot]
a660598e4c docs: Update docs for keyboard shortcuts (#29303)
* Update docs for keyboard shortcuts

* Add a fiddle for web-apis

* Apply suggestions from code review

Co-authored-by: Erick Zhao <erick@hotmail.ca>

* Cleanup a few formatting errors and missed copies

* Add descriptions to index.html

* Focus on renderer

Co-authored-by: Tony Ferrell <anf@microsoft.com>
Co-authored-by: Tony Ferrell <tonyjf@gmail.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-05-24 16:46:32 +09:00
trop[bot]
1ec2840da0 docs: rework introduction docs (#29301)
* docs: add 'introduction' doc

* note

* wip

* updates

* wip

* wip

* wip

* add missing code

* wip

* add image for chrome processes

* process model wip

* finish line?

* update links

* Update docs/README.md

Co-authored-by: Cheng Zhao <github@zcbenz.com>

* Update docs/tutorial/introduction.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/quick-start.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/process-model.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/process-model.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/process-model.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/quick-start.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/quick-start.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/quick-start.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/quick-start.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* address code review

* Update docs/tutorial/application-distribution.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* remove wip doc

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-05-24 16:35:42 +09:00
electron-roller[bot]
1d3cd106d1 chore: bump chromium to 91.0.4472.69 (13-x-y) (#29158)
* chore: bump chromium in DEPS to 91.0.4472.57

* chore: update patches

* try disabling gpu on WOA to see if it helps with failures

* chore: bump chromium in DEPS to 91.0.4472.69

* update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Electron Bot <electron@github.com>
2021-05-21 17:30:12 -04:00
Robo
5c5f041731 fix: dnd for some wm that does not set _NET_CLIENT_LIST_STACKING (#29233)
Backports https://chromium-review.googlesource.com/c/chromium/src/+/2844104
2021-05-20 22:33:43 -07:00
Electron Bot
325df5afcf Bump v13.0.0-beta.28 2021-05-20 06:32:42 -07:00
trop[bot]
e261519469 fix: pdf viewer permissions (#29252) 2021-05-20 07:29:11 +02:00
trop[bot]
042c04f95f docs: option title for showSaveDialog is not supported for some platforms (#29232) 2021-05-19 16:06:20 +02:00
trop[bot]
7a78506a7d docs: update style guide (#29228)
* clearer heading rules

* docs: clarify documentation style guide rules

* Update docs/styleguide.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* fixes

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-05-19 16:19:41 +09:00
trop[bot]
75b4db49df fix: window bounds not scaled from screen coordinates (#29227)
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-05-19 16:19:11 +09:00
trop[bot]
0f8ac92b09 fix: AdjustAmountOfExternalAllocatedMemory regression in NativeImage destructor (#29223)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-05-19 11:55:07 +09:00
trop[bot]
119ce7d6da docs: Update the macos Dock Instructions (#29220)
* Update the macos Dock Instructions

* Remove preload and ;'s

* Mixed ;s

* Update dock doc

* Add informational text to index.html

Co-authored-by: Tony Ferrell <anf@microsoft.com>
2021-05-19 11:54:22 +09:00
trop[bot]
daa075d020 docs: Update macos-dark-mode fiddle and guide content (#29219)
* update macos dark mode docs for Electron v12

* pr review fixes

* more pr review fixes

* reorg paragraphs for better flow

* Update docs/tutorial/dark-mode.md

Co-authored-by: Erick Zhao <erick@hotmail.ca>

* pr fixes

Co-authored-by: Ethan Arrowood <ethan.arrowood@gmail.com>
Co-authored-by: Ethan Arrowood <ethan@arrowood.dev>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-05-19 11:53:56 +09:00
trop[bot]
8d6b9155fb docs: update drag and drop tutorial (#29216)
* Working

* Working

* Make the native-file drag and drop documents use context bridge

* Add per-file sections

* Use the updated link format

* Use path.join instead of string interpolation.

Co-authored-by: Antón Molleda <molant@users.noreply.github.com>

* Use fs.promises

Co-authored-by: Antón Molleda <molant@users.noreply.github.com>

* Update docs/tutorial/native-file-drag-drop.md

Co-authored-by: Antón Molleda <molant@users.noreply.github.com>

* fix formatting

Co-authored-by: Antón Molleda <molant@users.noreply.github.com>

* Update docs/tutorial/native-file-drag-drop.md

Co-authored-by: Antón Molleda <molant@users.noreply.github.com>

* Use more path.join instead of interpolation

* Update with PR suggestions

* Remove process.cwd() and add more example elements

* Minor text fix

* Fix typo

Co-authored-by: Erick Zhao <erick@hotmail.ca>

Co-authored-by: Tony Ferrell <anf@microsoft.com>
Co-authored-by: Tony Ferrell <tonyjf@gmail.com>
Co-authored-by: Antón Molleda <molant@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-05-19 11:53:17 +09:00
trop[bot]
cec2bfb9ec docs: mention Meta key in Accelerator (#29215)
`Meta` is a valid alternative for `Super` and should be listed as an available modifier.

Co-authored-by: Thomas Kainrad <7394822+tkainrad@users.noreply.github.com>
2021-05-19 11:52:52 +09:00
trop[bot]
ff1cc3c60b docs: Improve description of findInPage options (#29146)
* docs: improve webContents.findInPage description

* docs: improve webview.findInPage description

Co-authored-by: PalmerAL <PalmerAL@users.noreply.github.com>
2021-05-19 10:32:51 +09:00
trop[bot]
b4bba38862 docs: revise Mac App Store Submission Guide (#29142)
* docs: revise Mac App Store Submission Guide

* chore: update repo URL

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* chore: apply suggestions from code review

Co-authored-by: Erick Zhao <erick@hotmail.ca>

* chore: update to match style guide

* chore: add cross reference

* chore: fix inaccurate places

* chore: apply reviews

* chore: add link to provisioning profile

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-05-17 14:50:15 -04:00
trop[bot]
278ff8566c build: make patch auto fixes come from PatchUp rather than Electron Bot (#29156)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-05-17 14:44:55 -04:00
Electron Bot
323de2fbe7 Bump v13.0.0-beta.27 2021-05-17 06:31:57 -07:00
trop[bot]
cd673a3697 docs: --force-fieldtrials was h2 rather than h3 (#29181)
All the other argument headers were h3 (`###`) but `--force-fieldtrials` was h2 (`##`) for some reason.
I changed it to make it consistent with the others.

Co-authored-by: Noelle Leigh <5957867+noelleleigh@users.noreply.github.com>
2021-05-16 18:15:39 -07:00
trop[bot]
0097a370e3 fix: remove background color hack in vibrancy (#29165)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-05-14 18:30:27 -07:00
trop[bot]
692c510867 fix: illegal access errors with nodeIntegrationInSubFrames (#29170) 2021-05-14 17:43:18 +02:00
trop[bot]
e6f15c4380 fix: ensure extensions w/o a background page have file access (#29171)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-05-14 17:42:55 +02:00
Electron Bot
cce8dda92f Bump v13.0.0-beta.26 2021-05-13 06:32:01 -07:00
trop[bot]
034f750c46 Create README.md (#29149)
Co-authored-by: Ondreas <74183220+OndreasCZ@users.noreply.github.com>
2021-05-12 23:40:50 -07:00
Erick Zhao
120a8acfd0 docs: rework sandbox guide (#29104)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Biru Mohanathas <birunthan@mohanathas.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Biru Mohanathas <birunthan@mohanathas.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-05-13 11:08:01 +09:00
trop[bot]
01992fd65c chore: remove no-op EnableWebComponentsV0 feature (#29127)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-05-13 11:07:09 +09:00
trop[bot]
af6a5e6c30 fix: Menu.setApplicationMenu can return a useless array 29088 (#29129)
Co-authored-by: tabishmahfuz1 <tabish.mahfuz1@gmail.com>
2021-05-12 17:35:23 -07:00
trop[bot]
caac2e8fc7 fix: prevent crash on web-contents creation when error is thrown (#29106)
* fix: prevent crash when error occurs during event emitter CallMethod

* wip: emit error event within trycatch

* fix: handle uncaught exceptions within node on web_contents init

* fix: create gin_helper::CallMethodCatchException

* test: add web-contents create crash to test cases

* test: clean up test data for web-contents crash

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

* fix: convert CatchException to WebContents static helper method

* fix: restore try_catch to callsite

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-05-12 12:03:34 -07:00
Jeremy Rose
9a4a049498 chore: cherry-pick 8089dbfc616f from chromium (#29109)
* chore: cherry-pick 8089dbfc616f from chromium

* resolve conflicts
2021-05-12 12:03:09 -07:00
trop[bot]
68059d69a5 build: merge double space in SHASUM validation logic (#29120)
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-05-12 01:53:51 -07:00
Electron Bot
0f7334a77e Bump v13.0.0-beta.25 2021-05-11 18:10:53 -07:00
Electron Bot
eee8bee71b Revert "Bump v13.0.0-beta.25"
This reverts commit 2795185d46.
2021-05-11 17:19:54 -07:00
Electron Bot
2795185d46 Bump v13.0.0-beta.25 2021-05-11 13:59:38 -07:00
trop[bot]
877f096d6b build: offload hash checking logic to lambda worker during release (#29105)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-05-11 13:57:32 -07:00
trop[bot]
b33bb3a860 fix: update NSView radii on fullscreen transition (#29099)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-05-11 16:44:18 +02:00
Milan Burda
86f4126051 fix: webFrame spell checker APIs crashing in sandboxed renderers (#29053) (#29087) 2021-05-10 16:42:30 -07:00
Electron Bot
f895162234 Bump v13.0.0-beta.24 2021-05-10 12:16:53 -07:00
Electron Bot
05e41f89b4 chore: bump chromium to 91.0.4472.38 (13-x-y) (#29045) 2021-05-07 09:29:33 -07:00
Electron Bot
d7378f953a Bump v13.0.0-beta.23 2021-05-07 00:28:38 -07:00
trop[bot]
ed0b654fee chore: cherry-pick 7abc7e45b2 from node (#29048)
Backports: https://github.com/nodejs/node/pull/38506

Co-authored-by: Fedor Indutny <fedor@indutny.com>
2021-05-07 00:19:03 -07:00
Electron Bot
c1c8cbf995 Bump v13.0.0-beta.22 2021-05-06 06:31:26 -07:00
trop[bot]
ab3aa3581a fix: drag region BrowserView calculations on macOS (#29017)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-05-06 20:29:06 +09:00
trop[bot]
20a43d9a72 fix: <webview> focus / blur events don't work with contextIsolation enabled (#29025)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-05-06 20:25:18 +09:00
trop[bot]
27d04084c2 docs: menu must be added on whenReady (#29043)
* Add that that menu must be added on whenReady

When an application menu is added before 'whenReady' all items seem to work except 'recent documents'

This causes the issue listed here: https://github.com/electron/electron/issues/17388

* Make example more complete

* Remove semicolons

* Update docs/tutorial/recent-documents.md

Co-authored-by: Erick Zhao <erick@hotmail.ca>

Co-authored-by: Matthijs Groen <matthijs.groen@gmail.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-05-06 20:23:30 +09:00
trop[bot]
46649965c9 spec: attempt to fix flaky nativeTheme spec (#29036)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-05-05 21:49:48 -07:00
trop[bot]
bea84969d6 docs: link to BrowserView from webview page (#29008)
* docs: Link to `BrowserView` from `webview` page

* fix relative link

Co-authored-by: Hamish Macpherson <hamstu@gmail.com>
2021-05-05 11:30:52 -07:00
trop[bot]
ae67ec24f3 refactor: use "as const" for constant mappings (#29000)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-05-05 15:59:47 +09:00
Electron Bot
d379693967 Bump v13.0.0-beta.21 2021-05-04 14:15:15 -07:00
Keeley Hammond
2fe16c60ea revert: build: fix dump_syms.py to work with python 3 (#28998) 2021-05-04 14:07:32 -07:00
Electron Bot
0853536e04 Revert "Bump v13.0.0-beta.21"
This reverts commit 4e48867af8.
2021-05-04 13:19:01 -07:00
Electron Bot
4e48867af8 Bump v13.0.0-beta.21 2021-05-04 11:49:07 -07:00
Samuel Attard
6bb1d1c5b0 build: import execute method in symbols zip script 2021-05-04 11:40:21 -07:00
Samuel Attard
696cc7c414 build: delete dsyms after they have been zipped in release builds 2021-05-04 11:39:58 -07:00
Samuel Attard
c0c8116a29 build: free up space on macOS some more 2021-05-04 11:39:51 -07:00
trop[bot]
a98ed69874 build: disable pseudolocales in Electron (#28995)
* build: disable pseudolocales in Electron

* Update build/args/all.gn

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-05-04 11:38:43 -07:00
trop[bot]
3c230ad272 build: fix dump_syms.py to work with python 3 (#28996)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-05-04 11:38:30 -07:00
Electron Bot
f93a9607b5 Revert "Bump v13.0.0-beta.21"
This reverts commit e7a944e356.
2021-05-04 09:39:00 -07:00
Electron Bot
e7a944e356 Bump v13.0.0-beta.21 2021-05-04 08:09:51 -07:00
trop[bot]
9131a3216a docs: update REPL guide (#28986)
* docs: update REPL guide

* Update docs/tutorial/repl.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-05-04 09:57:46 -04:00
trop[bot]
288985f032 fix: close attached sheet on window close (#28988)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-05-04 09:31:42 -04:00
trop[bot]
9c1c8787e9 fix: allow Node.js to manage microtasks queue (#28973)
* fix: allow Node.js to manage microtasks queue

When `uv_run()` resulted in invocation of JS functions the microtask
queue checkpoint in Node's CallbackScope was a no-op because the
expected microtask queue policy was `kExplicit` and Electron ran under
`kScoped` policy. This change switches policy to `kExplicit` right
before `uv_run()` and reverts it back to original value after `uv_run()`
completes to provide better compatibility with Node.

* add comment

Co-authored-by: Fedor Indutny <fedor@indutny.com>
2021-05-03 23:00:44 -07:00
trop[bot]
c55cfa7a9c chore: Browser::SetAppUserModelID is Windows only (#28970)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-05-03 18:52:49 -07:00
Electron Bot
f72597be06 chore: bump chromium to 91.0.4472.33 (13-x-y) (#28660)
* chore: bump chromium in DEPS to 91.0.4472.5

* chore: rebuild chromium/dcheck.patch with import-patches -3

Mechanical only; no code changes

(cherry picked from commit 68e369c945)

* chore: remove content_browser_main_loop.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153

The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.

NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.

(cherry picked from commit 5220829748)

* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3

Mechanical only; no code changes

(cherry picked from commit 7613ca268e)

* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3

Mechanical only; no code changes

(cherry picked from commit c0c5f45195)

* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch

Mechanical only; no code changes

(cherry picked from commit ea6f3e096e)

* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3

Mechanical only; no code changes

(cherry picked from commit 8d9aa4f1f2)

* chore: rebuild chromium/ui_gtk_public_header.patch manually

no code changes

(cherry picked from commit 79e84fb72b)

* chore: rebuild chromium/web_contents.patch with import-patches -3

Mechanical only; no code changes

(cherry picked from commit 543fb6dae7)

* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874

This patch has been merged upstream

(cherry picked from commit d36de6e2d6)

* chore: export patches

(cherry picked from commit 7c148e9102)

* chore: update add_trustedauthclient_to_urlloaderfactory.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969

Sync with removal of render_frame_id_

(cherry picked from commit fd954aefd4)

* chore: sync chromium/put_back_deleted_colors_for_autofill.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841

SkColorFromColorId() no longer takes theme, scheme args

(cherry picked from commit f676453fb8)

* chore: sync chromium/put_back_deleted_colors_for_autofill.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143

Change new calls to GetDarkSchemeColor to fit our patched call signature

(cherry picked from commit 27c5d9da5e)

* chore: update add_trustedauthclient_to_urlloaderfactory.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969

Sync with removal of render_frame_id_ in our mojom

(cherry picked from commit 285db29015)

* chore: update chromium/frame_host_manager.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008

UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool

(cherry picked from commit 06ac6c5d6a)

* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314

Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.

(cherry picked from commit 2b0cb2ca2a)

* chore: update permissions_to_register

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074

Replace all uses of APIPermission::ID enum with Mojo type

(cherry picked from commit bfe55a9c68)

* refactor: update return type of PreMainMessageLoopRun()

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153

Used to return void; now returns an int errorcode.

Note: 2725153 also has some nice doc updates about Browser's "stages"
(cherry picked from commit 2622e91c44)

* refactor: sync ElectronBrowserMainParts to MainParts changes

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153

RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.

This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.

(cherry picked from commit 0497272fab)

* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153

BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().

(cherry picked from commit 77eacd8073)

* refactor: stop using CallbackList; it has been removed.

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
(cherry picked from commit 4bcf9d58b0)

* refactor: update use of threadpools.

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408

The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.

(cherry picked from commit 4e33ee0ad3)

* refactor: remove routing_id from CreateLoaderAndStart

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858

NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.

(cherry picked from commit 70759ad342)

* refactor: sync to upstream ParittionOptions churn

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318

PartitionOptions' enums have changed.

(cherry picked from commit 48f437b478)

* refactor: update Manifest::Location usage

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320

tldr: s/Manifest::FOO/ManifestLocation::kFoo/
(cherry picked from commit 866e02999a)

* update patches

(cherry picked from commit 4444596af5)

* refactor: update extensions::Manifest to upstream

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320

-  extensions::Manifest::COMPONENT
+  extensions::mojom::ManifestLocation::kExternalComponent

(cherry picked from commit c97cef7059)

* refactor: sync with upstream UrlInfo ctor changes

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008

UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool

(cherry picked from commit 7effb909b6)

* chore: update invocation of convert_protocol_to_json.py

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623

python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.

(cherry picked from commit a237fc9aff)

* chore: use extensions::mojom::APIPermissionID

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122

tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo

(cherry picked from commit bf9ef3b636)

* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737

Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc

(cherry picked from commit c4558b031d)

* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun

(cherry picked from commit f509f1b8cc)

* chore: Use IDType for permission change subscriptions.

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431

tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).

(cherry picked from commit 11608d2745)

* chore: sync PowerMonitor code to upstream refactor

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635

tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.

(cherry picked from commit 2d4c79413b)

* chore: use PartitionOptions's new Cookies field

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
(cherry picked from commit f69e95824f)

* Revert "refactor: remove routing_id from CreateLoaderAndStart"

This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.

8c9773b was only a partial fix; reverting to start & try again.

(cherry picked from commit 96195f845b)

* update patches

(cherry picked from commit 5d64fa28d5)

* chore: update chromium/accelerator.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472

tldr: sync patch with upstream renamed variable & macro names.
(cherry picked from commit ce541697e5)

* chore: update chromium/gtk_visibility.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200

tldr: no code changes; just updating the diff to apply cleanly.

note: ooh upstream Wayland hacking!
(cherry picked from commit 6ec5c72878)

* chore: update chromium/picture-in-picture.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023

tldr: no code changes; just updating the diff to apply cleanly.
(cherry picked from commit 8ae0b0d740)

* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573

tldr: no code changes; just updating the diff to apply cleanly.
(cherry picked from commit d5b017208b)

* chore: export_all_patches

(cherry picked from commit 218952ec9d)

* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511

tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.

(cherry picked from commit 6fe734f5ca)

* chore: update ElectronBrowserClient w/upstream API

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454

tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.

(cherry picked from commit b760f7162b)

* chore: handle new content::PermissionType::FILE_HANDLING in toV8()

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201

`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc

(cherry picked from commit d9cdb18eb7)

* refactor: remove routing_id from CreateLoaderAndStart pt 1

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858

Part 1: the easiest ones

(cherry picked from commit 6ee282b27a)

* 2796724: Support Python3

https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
(cherry picked from commit fbf5c04716)

* 2668974: WebShare: Implement SharingServicePicker

https://chromium-review.googlesource.com/c/chromium/src/+/2668974
(cherry picked from commit 74577f2156)

* 2802766: Apply modernize-make-unique to media/

https://chromium-review.googlesource.com/c/chromium/src/+/2802766
(cherry picked from commit 409328fc38)

* 2802823: Apply modernize-make-unique to gpu/

https://chromium-review.googlesource.com/c/chromium/src/+/2802823
(cherry picked from commit 43658b0ed3)

* 2803041: Apply modernize-make-unique to remaining files

https://chromium-review.googlesource.com/c/chromium/src/+/2803041
(cherry picked from commit 01f514f537)

* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks

https://chromium-review.googlesource.com/c/chromium/src/+/2798873
(cherry picked from commit 5384398823)

* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed

https://chromium-review.googlesource.com/c/chromium/src/+/2733595
(cherry picked from commit f6cf612ee3)

* chore: update patch indices

(cherry picked from commit f078eddc2b)

* 2795107: Remove unused PermissionRequest IDs.

https://chromium-review.googlesource.com/c/chromium/src/+/2795107
(cherry picked from commit 93077afbfb)

* chore: fixup patch indices

(cherry picked from commit 8f2abcee38)

* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window

https://chromium-review.googlesource.com/c/chromium/src/+/2710023
(cherry picked from commit 4a4da7ad6a)

* fixup! refactor: remove routing_id from CreateLoaderAndStart

(cherry picked from commit a1f0bbb0b5)

* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader

(cherry picked from commit 186528aab9)

* fixup! chore: fixup patch indices

(cherry picked from commit 3129ea403d)

* 2724817: Expand scope of wasm-eval to all URLs

https://chromium-review.googlesource.com/c/chromium/src/+/2724817
(cherry picked from commit dacbf3d60d)

* 2797341: [ozone/x11] Enabled the global shortcut listener.

https://chromium-review.googlesource.com/c/chromium/src/+/2797341
(cherry picked from commit 945890fcf9)

* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1

https://chromium-review.googlesource.com/c/chromium/src/+/2805553
(cherry picked from commit db74b380fd)

* 2804366: PiP 1.5: Label back to tab button with origin and center it

https://chromium-review.googlesource.com/c/chromium/src/+/2804366
(cherry picked from commit deca961382)

* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget

https://chromium-review.googlesource.com/c/chromium/src/+/2784730
(cherry picked from commit 0fac051a0c)

* chore: update patch indices

(cherry picked from commit 01235ba336)

* 2810174: Add PdfAnnotationsEnabled policy.

https://chromium-review.googlesource.com/c/chromium/src/+/2810174
(cherry picked from commit c8a7225cac)

* 2807829: Allow capturers to indicate if they want a WakeLock or not.

https://chromium-review.googlesource.com/c/chromium/src/+/2807829
(cherry picked from commit 39f0c263d7)

* update patches after cherry picks

* chore: icon_util_x11 is now icon_util_linux

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
(cherry picked from commit fa0d3a0f75)

* build: fix missing symbols on linux build

* use_ozone and use_x11 are not exclusive
* new button view to build for pip

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
(cherry picked from commit 28253c6ccc)

* chore: remove patch conflict

(cherry picked from commit 19c9e94014)

* chore: build bttlb on all platforms for pip

(cherry picked from commit ae70252e09)

* build: update linux manifests

(cherry picked from commit 88baf8835c)

* chore: update windows zip manifests

(cherry picked from commit 01a1c37999)

* chore: update mac zip manifests

(cherry picked from commit a203347075)

* chore: update is_media_key patch to handle new ozone impl

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
(cherry picked from commit 9d31092db8)

* build: update sysroots

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
(cherry picked from commit 4985c57685)

* build: add missing base include on windows

(cherry picked from commit ec782c1bde)

* fix: update frame host manager patch for new state transitions

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
(cherry picked from commit 2772241a2c)

* refactor: implement missing URLLoaderNetworkServiceObserver methods

It is against The Mojo Rules to leave hanging callbacks.  These always
have to be called.

Refs: 186528aab9
(cherry picked from commit 2ce2f73a0c)

* spec: fix locale test on local linux

(cherry picked from commit 898f8448f8)

* fix: pass the exit code correctly in new PreMainMessageLoopRun

Refs: 2622e91c44
(cherry picked from commit f8f388573c)

* fix: ensure we early-exit when request_handler_ is not provided

Refs: 93077afbfb
(cherry picked from commit 20cd4cb875)

* fix: strongly set result_code in the BrowserMainLoop

(cherry picked from commit a1d19bc212)

* fix: invalid usage of non-targetted PostTask

You must always either use a host threadpool or specify a target
thread.  In this case we did neither after this refactor.

Refs: 4e33ee0ad3
(cherry picked from commit 3632067c10)

* build: ensure CI is truthy in arm test env

(cherry picked from commit e455f68b64)

* chore: add mojo error code to url loader failure

(cherry picked from commit 60cc150a17)

* fix: handle windowCaptureMacV2 being enabled when fetching media source id

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
(cherry picked from commit f835dd1c2a)

* chore: fix broken gtk_util color patch

(cherry picked from commit e0720df6d4)

* chore: fix gn check

(cherry picked from commit 72ca89b311)

* chore: add node patches for V8 changes

(cherry picked from commit 96027e0186)

* chore: add thread_pool include for views delegate win

(cherry picked from commit 62faa304df)

* chore: remove stray .rej files in patch

(cherry picked from commit 52562150ca)

* chore: bump chromium in DEPS to 91.0.4472.10

* update patches

* Merge branch '13-x-y' into roller/chromium/13-x-y

* update patches

* try to track down WOA failures

* see if this helps websql failure

* chore: debug websql error on WOA

* Revert "chore: debug websql error on WOA"

This reverts commit 572987a15f.

* Revert "see if this helps websql failure"

This reverts commit f771dfe0ab.

* Revert "try to track down WOA failures"

This reverts commit d4eb5efdb3.

* chore: no long disable CalculateNativeWinOcclusion on WOA

This was resolved in https://chromium-review.googlesource.com/c/chromium/src/+/2478082

* run specs separately on WOA

* Update comment

* escape %

* specify files properly

* revert WOA testing changes

* chore: bump chromium in DEPS to 91.0.4472.33

* chore: update patches

* Trigger CI

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-05-03 20:09:30 -04:00
trop[bot]
5c12606b13 feat: add session.storagePath to get path on disk for session data (#28866)
* feat: add session.storagePath to get path on disk for session data

* spec: add session.storagePath tests

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-05-03 12:14:53 -04:00
trop[bot]
f9bf319e66 docs: remove reference to global Electron install (#28969)
* docs: remove reference to global Electron install

This is a pattern that we actively want to discourage.

* docs: update as per review suggestion

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-05-03 11:38:53 -04:00
Electron Bot
b5c3ac3e7b Bump v13.0.0-beta.20 2021-05-03 08:01:43 -07:00
trop[bot]
824028a367 build: add release-env context to publish-macos (#28939)
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2021-04-29 15:24:01 -07:00
trop[bot]
2b23b145d9 docs: uniformize module API doc format (#28926)
This PR ensures that all API modules are present in the README doc,
as there were a couple missing. It also formats all modules to contain
a level-1 heading and a blockquote description.

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-04-29 13:38:32 -07:00
trop[bot]
128106520a build: fix npm-run python bytes error (#28936)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-04-29 13:34:05 -07:00
Electron Bot
7e4a9ebc27 Bump v13.0.0-beta.19 2021-04-29 08:03:10 -07:00
trop[bot]
87d3530d1b fix: provide no-op implementation of app.setUserModelId (#28921)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-04-29 09:56:20 +02:00
trop[bot]
bf9dfa8247 docs: remove api/locales page (#28919)
This page is just a table writing out the contents of an array in
the Chromium source code. We don't actively maintain it, and
it's only referenced in one API, so it makes sense to just
link directly to the code here.

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-04-28 15:39:19 -07:00
trop[bot]
300e902066 fix: emit window-all-closed after closing the window (#28914)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-28 12:47:16 -07:00
trop[bot]
fa0f9e83f5 build: remove dead python methods and helper (#28895)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-04-28 02:13:38 -07:00
trop[bot]
d32aa032cd docs: the tools folder does not exist anymore (#28888)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-04-28 02:13:20 -07:00
trop[bot]
3fe41bb852 build: actually use SSL when downloading things via python (#28893)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-04-28 02:07:05 -07:00
trop[bot]
58b80c2c06 test: disable shell.trashItem in renderer test on win-ia32 (#28877)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-27 19:58:25 -04:00
trop[bot]
2ec3da29d3 build: fix releases that failed halfway through npm publish actions (#28855)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-04-26 20:38:07 -04:00
trop[bot]
499c1a5067 fix: only set backgroundColor in default-app for default index.html (#28842)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-04-26 11:34:48 -04:00
Electron Bot
544ea7a0c8 Bump v13.0.0-beta.18 2021-04-26 08:02:03 -07:00
trop[bot]
eca4a5cf4c fix: shell.trashItem crash when called in renderer (#28788)
* fix: shell.trashItem crash when called in renderer

* Update api-shell-spec.ts

* Update spec-main/api-shell-spec.ts

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-04-26 16:23:01 +09:00
trop[bot]
56fc2bce30 docs: fix unintentional emoji in win.getMediaSourceId description (#28784)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-04-22 13:33:05 -07:00
Electron Bot
4eea01e9b0 Bump v13.0.0-beta.17 2021-04-22 08:01:53 -07:00
Shelley Vohr
232392ffa0 fix: handle async nature of [NSWindow -toggleFullScreen] (#25470) (#28763) 2021-04-22 09:53:46 -04:00
trop[bot]
7816fd240f fix: ensure widget size is set correctly on linux on small screens (#28756)
When creating a widget on linux the bounds are restricted to the screen
size, when calling SetSize / SetBounds they are not.  This fixes this
initialization issue by calling SetBounds after widget creation.

Noticed this issue while running linux tests on xvfb with a screen size
smaller than the default electron window size (resulted in a failed
test).

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-04-21 13:17:33 +02:00
Electron Bot
bcf2d0969c chore: cherry-pick 512cd5e179f4 from v8 (#28753)
* chore: cherry-pick 512cd5e179f4 from v8

* update patches
2021-04-21 12:29:38 +02:00
trop[bot]
ed7f5f3a0b fix: end attached sheet when calling window.hide() (#28694)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-04-21 11:20:31 +02:00
trop[bot]
1937aff793 build: fix docs only change script to pull all files not just 30 (#28744)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-04-19 18:28:58 -07:00
trop[bot]
cf493b995c docs(build-instructions): clarify that these are for building Electron itself (#28728)
Co-authored-by: Mark Lee <electronjs@lazymalevolence.com>
2021-04-19 20:10:37 -04:00
trop[bot]
5bbc64b416 build: read node files as binary files (#28735)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-04-19 20:01:27 -04:00
trop[bot]
287c9eb8c0 chore: clean up some spec things (#28731)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-04-19 12:55:01 -07:00
trop[bot]
f4d77d97e3 fix: do not handle write errors after request is aborted (#28720)
This fixes a flake on linux CI which started recently where the "write"
promise is being rejected after the request has been aborted /
cancelled.  In this case we should drop the error to the floor but
instead we pass it down the stack where it eventually emits a now
unhandled error event.

Example failure: https://app.circleci.com/pipelines/github/electron/electron/38072/workflows/c1faf19b-aa41-4f99-a564-165729222859/jobs/838813

Verified fix by running the test that caused it 10000 times before fix
and 10000 times after.  ~50 failures before, 0 after.

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-04-19 11:26:20 -07:00
Electron Bot
593af18528 Bump v13.0.0-beta.16 2021-04-19 08:01:28 -07:00
trop[bot]
df47f85646 fix: increase corner radius for vibrancy view on big sur (#28679)
* fix: increase corner radius for vibrancy view on big sur

* fix: revert git weirdness

Co-authored-by: Robin Fowler <robinfowler@Robins-MBP.broadband>
2021-04-15 15:58:42 -07:00
Electron Bot
bd3b70a6b5 Bump v13.0.0-beta.15 2021-04-15 08:04:17 -07:00
trop[bot]
9578943848 build: do not require vsts token for releases (#28648)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-14 11:44:43 +02:00
Electron Bot
91de226a62 Bump v13.0.0-beta.14 2021-04-13 13:39:59 -07:00
Electron Bot
7044cb69a8 chore: cherry-pick 02f84c745fc0 from v8 (#28637)
* chore: cherry-pick 02f84c745fc0 from v8

* update patches
2021-04-13 13:29:05 -07:00
Electron Bot
66a2218723 chore: bump chromium to 91.0.4448.0 (13-x-y) (#28127)
* chore: bump chromium in DEPS to 90.0.4430.19

* build: add 'use_rts' definition

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2694187
(cherry picked from commit b820b4078d)

* chore: bump chromium in DEPS to 91.0.4441.0

* chore: update patches

(cherry picked from commit 55e50a0879)

* chore: media_internal_resources becomes resources

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2699022
(cherry picked from commit e715b9c921)

* chore: update patches

(cherry picked from commit c8148febfa)

* refactor: extensions::ViewType moved to mojom

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710351
(cherry picked from commit 87df2766ba)

* chore: might_have_observers has been removed

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2667839
(cherry picked from commit e900271bea)

* refactor: CertVerifier is not in the network namespace anymore

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2689805
(cherry picked from commit eccfa516c5)

* refactor: ExtensionUserScriptManager is now UserScriptManager

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2657617
(cherry picked from commit 2fed02556d)

* refactor: content::SiteInstance::GetSiteForURL was removed

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2680274
(cherry picked from commit 0d94e0d1d9)

* refactor: MenuItemType was moved to mojom

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2071443
(cherry picked from commit 1a296e59c2)

* refactor: extensions::ViewType was moved to mojom

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710351
(cherry picked from commit dc36e8e6fc)

* refacotr: grit::ResourceMap replaced with webui::ResourcePath

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2685601
(cherry picked from commit 59669e99cb)

* refactor: blink::MenuItem::Type was moved to mojom

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2071443
(cherry picked from commit be627568b2)

* refactor: CreateDataPipe deprecated form was removed

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2698090
(cherry picked from commit 77ad17b383)

* refactor: DesktopMediaList::Type replaces content::DesktopMediaType_*

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2700637
(cherry picked from commit 4e02d9407a)

* chore: wire up activation_time in OSR

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2638372
(cherry picked from commit f51f427646)

* chore: remove deleted file from chromium_src list

(cherry picked from commit 59432fe30a)

* chore: fix lint

(cherry picked from commit 54cc68dd7a)

* update patches

(cherry picked from commit e99e6a5a8a)

* chore: update patches

(cherry picked from commit 1e16606524)

* fixup gn check

(cherry picked from commit 8f4e362d8f)

* update to xcode 12.4.0

Needed because of 8008deb41c

(cherry picked from commit fae4d87a5a)

* 2752406: [LSC] Replace base::string16 with std::u16string in //ui

https://chromium-review.googlesource.com/c/chromium/src/+/2752406
(cherry picked from commit d4bec23bde)

* 2752406: [LSC] Replace base::string16 with std::u16string in //ui

https://chromium-review.googlesource.com/c/chromium/src/+/2752406
(cherry picked from commit 9e336f5d0c)

* 2752932: Associate each AwProxyingURLLoaderFactory with a frame tree node id.

https://chromium-review.googlesource.com/c/chromium/src/+/2752932
(cherry picked from commit 08036802cb)

* 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer.

https://chromium-review.googlesource.com/c/chromium/src/+/2651385
(cherry picked from commit 676f74f3dc)

* 2734095: Introduce StoragePartitionId type to wrap current string representation.

https://chromium-review.googlesource.com/c/chromium/src/+/2734095
(cherry picked from commit 76538d2d38)

* chore: bump chromium in DEPS to 90.0.4430.19

* chore: bump chromium in DEPS to 90.0.4430.30

* chore: bump chromium in DEPS to 90.0.4430.40

* chore: bump chromium in DEPS to 90.0.4430.51

* chore: bump chromium in DEPS to 91.0.4446.0

* chore: bump chromium in DEPS to 91.0.4448.0

(cherry picked from commit 003dd6c16c)

* Update patches

(cherry picked from commit 9f5e3f6685)

* 2743594: Remove WebSize from blink.

https://chromium-review.googlesource.com/c/chromium/src/+/2743594
(cherry picked from commit b15b820bca)

* 2725403: Add URLLoaderClient::OnReceiveEarlyHints()

https://chromium-review.googlesource.com/c/chromium/src/+/2725403
(cherry picked from commit 185c343b22)

* 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer.

https://chromium-review.googlesource.com/c/chromium/src/+/2651385
(cherry picked from commit 88bbe2a352)

* 2721718: Move HostID to extensions::mojom::HostID

https://chromium-review.googlesource.com/c/chromium/src/+/2721718
(cherry picked from commit 3010dd93e3)

* 2733070: Rename observer to URLLoaderNetworkServiceObserver

https://chromium-review.googlesource.com/c/chromium/src/+/2733070
(cherry picked from commit d54bee03d0)

* Use nogncheck for content/browser/site_instance_impl.h

This is needed because  //content/browser:browser is not a visible target

(cherry picked from commit 5fc298ee5f)

* 2648046: Introduce alert notification helper .app

https://chromium-review.googlesource.com/c/chromium/src/+/2648046
(cherry picked from commit 2cd53eb46a)

* 2752406: [LSC] Replace base::string16 with std::u16string in //ui

https://chromium-review.googlesource.com/c/chromium/src/+/2752406
(cherry picked from commit f1bb6be4b9)

* only include mac notifications on mac

(cherry picked from commit 3160e608e2)

* add additional skipping of atk toolchain check

(cherry picked from commit 86d23cee40)

* 2757472: Reland "Reland "[LSC] Remove base::string16 alias""

https://chromium-review.googlesource.com/c/chromium/src/+/2757472
(cherry picked from commit 22d8f22cfb)

* 2757472: Reland "Reland "[LSC] Remove base::string16 alias""

https://chromium-review.googlesource.com/c/chromium/src/+/2757472
(cherry picked from commit ec893f8322)

* 2720306: [api] Remove deprecated [Shared]ArrayBuffer API

https://chromium-review.googlesource.com/c/v8/v8/+/2720306
(cherry picked from commit d0989802bd)

* Fixup 2721718: Move HostID to extensions::mojom::HostID

(cherry picked from commit 29dfabadfd)

* fixup 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer

(cherry picked from commit 97b6868e9c)

* Fixup 2752406: [LSC] Replace base::string16 with std::u16string in //ui

(cherry picked from commit b6d2ae0455)

* Fixup 2725403: Add URLLoaderClient::OnReceiveEarlyHints()

(cherry picked from commit 7e961d8a37)

* update node headers

(cherry picked from commit c49bc282d5)

* 2693008: Fix loading non-system cursors on Windows on browser_tests

https://chromium-review.googlesource.com/c/chromium/src/+/2693008
(cherry picked from commit 3b183854ff)

* 2757472: Reland "Reland "[LSC] Remove base::string16 alias""

https://chromium-review.googlesource.com/c/chromium/src/+/2757472
(cherry picked from commit 2d3c65beca)

* undo changes to WebContentsPreferences::GetPreloadPath to fix mac build

(cherry picked from commit deeb2de14b)

* fix StrCat issue

(cherry picked from commit 451e0931bf)

* incantations for WebContentsPreferences::GetPreloadPath wide strings

(cherry picked from commit 205f572181)

* bump nan

(cherry picked from commit 74318705c2)

* fix GetAsString maybe?

(cherry picked from commit ea62ecd188)

* windows build fixes

(cherry picked from commit 5b598037bb)

* more windows build fix

(cherry picked from commit 61cf1abd4d)

* SetAppUserModelID -> wstring

(cherry picked from commit 83d93bcbdc)

* upgrade nan dep in tests

(cherry picked from commit 4f97b9303c)

* update patch

* wstrings are cross-platform

(cherry picked from commit 7f7b1f6c8a)

* linter

(cherry picked from commit aaf03765ed)

* only bind setAppUserModelId on windows

(cherry picked from commit 640a145112)

* well that was an odyssey

(cherry picked from commit dd975328a0)

* backport fcdf35e from v8 to fix nan crash

(cherry picked from commit 606fd87d1e)

* disable typedarrays-test.js

(cherry picked from commit 01ca00ec82)

* don't defer in NSWindow creation

https://chromium-review.googlesource.com/c/chromium/src/+/2707696
(cherry picked from commit 3122820e58)

* use PartitionAllocator for ArrayBuffers in the main process

(cherry picked from commit 1f575ca3af)

* fix patches

(cherry picked from commit 54e72fa8e3)

* chore: omit some unnecessary conversions

(cherry picked from commit 0f3620099a)

* refactor: make LoginItemSettings::path a wstring

(cherry picked from commit 9127cff58b)

* refactor: make ShowTaskDialog take a wstr

(cherry picked from commit 1594c54933)

* Revert "refactor: make LoginItemSettings::path a wstring"

This reverts commit 9127cff58b.

(cherry picked from commit 9684d85101)

* fixup patches

This reverts commit 0cc08813a6.

* update patches after merge

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-04-13 11:29:10 -04:00
trop[bot]
1f95fdd5ca build: better error handling for release builds (#28626)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-04-13 09:49:04 -04:00
trop[bot]
b4e70c72a6 fix: crash on invalid select-serial-port callback (#28619)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-04-12 11:40:24 -04:00
Electron Bot
61bd57f851 Bump v13.0.0-beta.13 2021-04-12 08:02:26 -07:00
trop[bot]
5ab8cb7482 fix: load source maps from custom protocols and asar bundles (#28615)
* fix: load source maps from custom protocols and asar bundles

* chore: fix lint

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-04-12 06:18:34 -07:00
trop[bot]
d1bb54d175 docs: define the name of the preload script (#28609)
Co-authored-by: KSneijders <32707500+KSneijders@users.noreply.github.com>
2021-04-12 00:14:18 -07:00
trop[bot]
c104b510b0 docs: systemPreferences.subscribeWorkspaceNotification return type (#28613)
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2021-04-12 00:12:50 -07:00
trop[bot]
02a2d33edc build: give ASAN tests more memory to avoid SIGKILL or disabling tests (#28592)
* build: give ASAN tests more memory

* test: re-eanble asan tests

Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-04-09 18:53:06 +09:00
trop[bot]
ad8f93517e chore: don't minimize js in development (#28586)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-09 16:09:53 +09:00
trop[bot]
a58b5ec3f0 docs: note that new-window event is deprecated (#28582)
* docs: note that new-window event is deprecated

* Update breaking-changes.md

* Update docs/breaking-changes.md

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-04-08 12:12:45 -04:00
Electron Bot
32e321cec1 Bump v13.0.0-beta.12 2021-04-08 08:01:27 -07:00
trop[bot]
aae1bfde05 fix: support wasm-eval csp behind WebAssemblyCSP flag (#28569)
* feat: support wasm-eval csp behind WebAssemblyCSP flag

* update patches

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-04-08 04:32:39 -07:00
trop[bot]
5be9028c51 fix: allow accessing file:// when web security is disabled (#28557)
* fix: allow accessing file:// when web security is disabled

* test: fix webview tests on web security

* chore: remove unused attributes

* chore: cleanup RegisterURLLoaderFactories method

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-04-07 14:59:54 +09:00
Shelley Vohr
fa5bc2206c fix: errors thrown in functions over the contextBridge (#28446)
* fix: errors thrown in functions over the contextBridge

* spec: add a test

* fix: ensure exception is a v8::Object
2021-04-07 14:57:33 +09:00
trop[bot]
e3cbd70191 fix: call UnregisterIsolate consistently (#28554)
* fix: call `UnregisterIsolate` consistently

`JavascriptEnvironment` is the class that calls `RegisterIsolate()`
so it should be the one to call `UnregisterIsolate`, and this can happen
right before disposing the aforementioned `isolate`.

See: https://github.com/electron/electron/pull/28468

* fix

Co-authored-by: Fedor Indutny <fedor@indutny.com>
2021-04-07 10:07:49 +09:00
trop[bot]
7ce5af334e fix: invoke the window open handler for _blank links (#28536)
* fix: invoke the window open handler for _blank links

* add test

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-07 10:05:12 +09:00
trop[bot]
5605358f99 fix: pass postData to new-window event (#28542)
* fix: pass postData to new-window event

* fix type of postBody

* fix type of UploadFile and UploadRawData to be discriminated unions

* exclude the empty string from additionalFeatures

* add a test

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-07 09:59:34 +09:00
trop[bot]
6f44fa6dbd fix: dialog DCHECK on Linux (#28534)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-04-07 09:49:17 +09:00
trop[bot]
6e66699822 ci: Add goma fallback flag (#28546)
* ci: fallback to local compile if goma auth fails

* use correct flag

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-04-07 09:48:12 +09:00
trop[bot]
71fda62839 test: disable "fs in renderer process" test under ASan (#28541)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-04-07 09:28:54 +09:00
trop[bot]
2b354894b2 fix: enable system maximization for frameless windows except if transparent (#28527)
* fix: move widget maximization check

* fix linting error

* change workaround to only effect transparent windows

* disable menu maximize and restore for transparent windows

* disable double clicking title bar max/unmax for transparent windows

* add docs change and address review

Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2021-04-06 00:54:39 -07:00
trop[bot]
114643a624 fix: reject task append to JumpList when description exceeds 260 characters (#28526)
* fix: reject task when description exceeds 260 characters

* Switched out wcslen() for size() [linear -> constant time]

* Included comment describing the need for the additional check

* Added information about character limit to documentation

* Added newline character to end of jump-list-category.md

Co-authored-by: SushiJackal <weingaben@gmail.com>
2021-04-05 23:57:18 -07:00
trop[bot]
d32f37f549 docs: the minimum supported version of macOS is now 10.11 (#28516)
* chore: the minimum supported version is now 10.11

Chromium bumped this version back in December

* Update support.md

Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-04-06 08:56:09 +09:00
trop[bot]
0cba5d7a71 fix: free IsolateData in ~NodeEnvironment (#28484)
This seems to just have been missing here, leaking memory
(and breaking the API contract for Node.js embedding).

Co-authored-by: Anna Henningsen <anna@addaleax.net>
2021-04-06 08:55:02 +09:00
Electron Bot
d76937f2b9 Bump v13.0.0-beta.11 2021-04-05 08:02:44 -07:00
Electron Bot
2cf6909f48 Bump v13.0.0-beta.10 2021-04-01 08:02:20 -07:00
trop[bot]
fb1a41926a fix: put RemoteCertVerifier upstream from the caching and coalescing layers (#28433)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-03-31 10:26:07 -07:00
trop[bot]
c87ecabf19 chore: update Community link in default menu (#28459)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-03-31 01:31:51 -07:00
trop[bot]
798ef785b4 fix: handle an unparsable pdf manifest (#28453)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-03-30 23:21:17 -07:00
Antón Molleda
89e2fe2079 docs: backport current tutorials to 13-x-y (#28397) 2021-03-30 11:53:10 -07:00
trop[bot]
250438c2d9 refactor: remove more uses of v8::Isolate::GetCurrent() (#28429)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-30 00:29:28 -07:00
Electron Bot
1176449cc9 Bump v13.0.0-beta.9 2021-03-29 08:01:40 -07:00
Cheng Zhao
a06af22b99 test: load minimal dict for spellchecker (#28398) 2021-03-29 19:43:51 +09:00
trop[bot]
bda746f2e6 feat: initialize field trials from command line arguments (#28402)
Fixes: #27877

Co-authored-by: Saúl Ibarra Corretgé <s@saghul.net>
2021-03-29 00:24:59 -07:00
trop[bot]
1f7f60d505 docs: add missing line in web-contents.md (#28399)
* Update web-contents.md

The text block was rendered as part of the `features` property, not the `handler`

* fix linting

Co-authored-by: Alexander Prinzhorn <alexander@prinzhorn.it>
2021-03-29 09:48:39 +09:00
trop[bot]
50cc80c44e fix: disappearing thumbar after win.hide() (#28390)
* fix: disappearing thumbar after win.hide()

* Add descriptive comment

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-25 12:16:13 -07:00
Electron Bot
00367f0b13 Bump v13.0.0-beta.8 2021-03-25 08:02:12 -07:00
Will Anderson
5d1ada085d docs: update Node API renderer example to use contextBridge (#28370) 2021-03-24 20:40:21 -04:00
trop[bot]
5b414b6f93 fix: isolate Pepper plugins (#28372)
* fix: isolate Pepper plugins

Following suit with a recent change to the same method in Chromium, we
should also isloate Pepper plugins.

* docs: add more context to comment

* fix: remove unsupported test flag behavior

Co-authored-by: clavin <cwatford@slack-corp.com>
2021-03-24 19:53:52 -04:00
trop[bot]
831bbc4b55 feat: allow omitting submitURL when uploadToServer is false (#28283)
* feat: allow omitting submitURL when uploadToServer is false

* docs

* fix test

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-03-24 19:52:42 -04:00
trop[bot]
b89b463a63 doc: desktopCapturer menu position (#28365)
desktopCapturer can be used in both main process and renderer process

Co-authored-by: liulun <xland@live.cn>
2021-03-24 16:59:46 +09:00
trop[bot]
32d3e82d88 fix: make sure service worker scheme is registered with allowServiceWorkers (#28354)
* Fix custom scheme not registered as service worker scheme

* ServiceWorker loaders do not have WebContents associated

* Add test for service worker

* Revert "Fix custom scheme not registered as service worker scheme"

This reverts commit a249235b22.

* Add scheme to ServiceWorkerSchemes

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-03-24 16:55:13 +09:00
trop[bot]
38de02c50a fix: window.print() in pdf plugin (#28351)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-24 10:01:33 +09:00
trop[bot]
b8ef450cf6 ci: cleanup directories on arm64 machines after running tests (#28331)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-03-23 09:47:55 -04:00
trop[bot]
168bcaf8f3 fix: libuv hang on Windows (#28335)
* fix: libuv hang on Windows

* test: add a hang test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-23 05:16:04 -07:00
trop[bot]
19d26c4a0c fix: escape URL passed to shell.openExternal on windows (#28342)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-03-23 05:15:33 -07:00
trop[bot]
20bf768517 refactor: prefer embedder-focused InitializeNodeWithArgs (#28325)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-22 12:36:55 -07:00
Electron Bot
71f631641e Bump v13.0.0-beta.7 2021-03-22 08:02:25 -07:00
trop[bot]
5b3c90e6c6 fix: DesktopCapturer gc'd prior to capture completion (#28280)
desktopCapture.getSources() returns a promise which should resolve
when capturing finishes. Internally it creates an instance of
DesktopCapturer which is responsible for resolving or rejecting
the promise.

Between the time DesktopCapturer starts capturing frames and when
it finishes, it's possible for its handle to be GC'd leading to
it never resolving.

These changes pin the instance of DesktopCapturer until it either
finishes or errors.

fixes #25595

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-03-22 11:03:24 +09:00
trop[bot]
fb298ca3db fix: drag region offsets in BrowserViews (#28298)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-22 10:59:47 +09:00
trop[bot]
5f07df4a3d fix: bad menu position when no positioning item specified (#28276)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-03-19 10:20:35 +09:00
trop[bot]
3ecccf2ad3 feat: add process.contextIsolated property (#28252)
* feat: add process.contextIsolation property

* chore: rename process.contextIsolation to process.contextIsolated

* thing

Co-authored-by: Milan Burda <milan.burda@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-03-18 14:01:06 -07:00
Electron Bot
4cafba5e46 Bump v13.0.0-beta.6 2021-03-18 08:01:58 -07:00
trop[bot]
3b049c9074 feat: add process.contextId used by @electron/remote (#28251)
* feat: add process.contextId used by @electron/remote

* Update docs/api/process.md

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: Milan Burda <milan.burda@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-03-18 15:16:46 +09:00
Will Anderson
0c1ee8ae8b docs: Update Quick Start Guide to work with contextIsolation (#28229)
* docs: Update Quick Start Guide for Electron 12

With `contextIsolation` enabled by default in Electron 12, the Getting Started Guide no longer works as it is written. In order for the basic example to display values from `process.versions`, we need to add a `preload.js` to the example.

* Trigger Build

* docs: add missing curly brace to quick start example code
2021-03-18 15:13:46 +09:00
trop[bot]
4cb842d5e3 fix: recalibrate simpleFullscreen when display metrics change (#28216)
* fix: recalibrate simpleFullscreen when display metrics change

* Address review feedback

* fix: compilation issues

* Address feedback from review

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-18 15:11:02 +09:00
trop[bot]
0ab21dfc98 test: disable some tests under ASan which might receive SIGKILL because of OOM (#28225)
* test: running child app under ASan might receive SIGKILL

* test: renderer process of webview might receive SIGKILL under ASan

* test: increase timeout for asan build

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-03-17 09:54:25 +09:00
trop[bot]
e3ef14e784 docs: document the parameter structure of hookWindowMessage (#28213)
Fixes #28178

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-03-16 15:44:00 -07:00
trop[bot]
010c6fd5be fix: revert "refactor: mmap asar files (#24470)" (#28203)
This reverts commit 01a2e23194.

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-03-16 19:21:21 +09:00
Electron Bot
a12d66d25e Bump v13.0.0-beta.5 2021-03-15 08:01:29 -07:00
trop[bot]
faa5d18389 fix: handle a nil backgroundColor in win.getBackgroundColor() (#28187)
* fix: handle a nil backgroundColor in win.getBackgroundColor()

* spec: add crash case

* fix: update to fix native_views transparent color

* chore: fix lint

Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-03-15 11:45:02 +09:00
Cheng Zhao
042e81aecb test: reliably wait for spellchecker to load (#28168) 2021-03-15 10:28:06 +09:00
trop[bot]
a1b46ef8a2 chore: cherry-pick 1fe571a from node (#28110)
Backports https://github.com/nodejs/node/pull/37000

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-03-15 10:25:40 +09:00
trop[bot]
7f4ab06f11 fix: convert system colors to device color space in systemPreferences (#28173)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-03-13 05:00:50 -08:00
trop[bot]
c11d6813e4 fix: ensure child window transparency works (#28112)
* fix: ensure child window transparency works

Windows opened via window.open and intecepted via setWindowOpenHandler
or the `new-window` event should (a) have the correct background color
and (b) that background color should be transparent if specified.

The changes in api_web_contents fix (a) and the changes in
web_contents_preferences fix (b).

Notes: Child windows with specified background colors or transpency now
work as intended

* fix: set background_color in blink prefs apply logic

* chore: update for PR comments

Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-03-12 09:18:41 -08:00
trop[bot]
c10274663c fix: change #if defined(OS_MACOSX) to #if defined(OS_MAC) (#28153)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-03-12 16:44:25 +09:00
trop[bot]
839137c3f4 docs: fix cookies event documentation for type generation (#28140)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-03-11 16:22:45 -08:00
Electron Bot
529e7e7797 Bump v13.0.0-beta.4 2021-03-11 07:01:34 -08:00
John Kleinschmidt
2ce64944ab chore: bump chromium to 90.0.4415.0 (master) (#27694) (#28082)
* chore: bump chromium in DEPS to 520c02b46668fc608927e0fcd79b6a90885a48bf

* chore: bump chromium in DEPS to 90.0.4414.0

* resolve chromium conflicts

* resolve v8 conflicts

* fix node gn files

* 2673502: Remove RenderViewCreated use from ExtensionHost.

https://chromium-review.googlesource.com/c/chromium/src/+/2673502

* 2676903: [mojo] Remove most legacy Binding classes.

https://chromium-review.googlesource.com/c/chromium/src/+/2676903

* 2644847: Move self-deleting URLLoaderFactory base into //services/network.

https://chromium-review.googlesource.com/c/chromium/src/+/2644847

* 2664006: Remove from mojo::DataPipe.

https://chromium-review.googlesource.com/c/chromium/src/+/2664006

* 2674530: Remove CertVerifierService feature

https://chromium-review.googlesource.com/c/chromium/src/+/2674530

* 2668748: Move OnSSLCertificateError to a new interface.

https://chromium-review.googlesource.com/c/chromium/src/+/2668748

* 2672923: Remove RAPPOR reporting infrastructure.

https://chromium-review.googlesource.com/c/chromium/src/+/2672923

* 2673502: Remove RenderViewCreated use from ExtensionHost.

https://chromium-review.googlesource.com/c/chromium/src/+/2673502

* 2655126: Convert FrameHostMsg_ContextMenu and FrameMsg_ContextMenuClosed|CustomContextMenuAction to Mojo

https://chromium-review.googlesource.com/c/chromium/src/+/2655126

* 2628705: Window Placement: Implement screen.isExtended and change event

https://chromium-review.googlesource.com/c/chromium/src/+/2628705

* 2643161: Refactor storage::kFileSystem*Native*

https://chromium-review.googlesource.com/c/chromium/src/+/2643161

* fix build

* only remove the biggest subdir of //ios

* chore: bump chromium in DEPS to 90.0.4415.0

* update patches

* update sysroots

* 2686147: Remove WebContentsObserver::RenderViewCreated().

https://chromium-review.googlesource.com/c/chromium/src/+/2686147

* 2596429: Fixing how extension's split and spanning modes affect OriginAccessList.

https://chromium-review.googlesource.com/c/chromium/src/+/2596429

* 2686026: [mojo] Delete AssociatedInterfacePtr (replaced by AssociatedRemote)

https://chromium-review.googlesource.com/c/chromium/src/+/2686026

* 2651705: Move ui/base/dragdrop/file_info to ui/base/clipboard

https://chromium-review.googlesource.com/c/chromium/src/+/2651705

* 358217: drawBitmap is deprecated

https://skia-review.googlesource.com/c/skia/+/358217

* fix gn check

* 2678098: Use gen/front_end as input to generate_devtools_grd

https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2678098

* 2674530: Remove CertVerifierService feature

https://chromium-review.googlesource.com/c/chromium/src/+/2674530

* fixup 2664006: Remove from mojo::DataPipe.

  https://chromium-review.googlesource.com/c/chromium/src/+/2664006

* fixup build_add_electron_tracing_category.patch

* 2673415: [base] Prepare CrashReporterClient for string16 switch

https://chromium-review.googlesource.com/c/chromium/src/+/2673415

* 2673413: Add CursorFactoryWin to handle Cursors on Windows

https://chromium-review.googlesource.com/c/chromium/src/+/2673413

* 2668748: Move OnSSLCertificateError to a new interface.

https://chromium-review.googlesource.com/c/chromium/src/+/2668748

* fix mas gn check

* update patch after merge

* Update node for .mjs files

* build: load v8_prof_processor dependencies as ESM

* chore: add patch to fix linux 32bit

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
(cherry picked from commit ca75bca667)

Co-authored-by: Electron Bot <electron@github.com>
2021-03-10 10:24:58 -08:00
trop[bot]
e6e1372ea7 fix: capturePage not resolving with hidden windows (#28076)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-09 13:13:33 -08:00
trop[bot]
9e723746e9 test: show full object diff (#28069)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-03-09 19:52:20 +09:00
trop[bot]
9a2ea12d71 chore: remove obsolete native node module patch (#28055)
* chore: remove obsolete native node module patch

* update patches

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-03-09 17:05:15 +09:00
trop[bot]
877013efe4 build: call goma_ctl.py ensure_start directly (#28061)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-03-08 19:18:24 -08:00
trop[bot]
4c9317aea0 test: ignore the ready event from PDF Viewer (#28048)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-03-08 16:30:18 -05:00
trop[bot]
cc9b4dd968 docs: setWindowOpenHandler should show object return (#28035)
* Should use object return

* Fix lint

Co-authored-by: Domenic Horner <domenic@tgxn.net>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-03-08 11:49:02 -05:00
Electron Bot
747842c930 Bump v13.0.0-beta.3 2021-03-08 07:01:55 -08:00
trop[bot]
174e939b26 test: exit after app.relaunch is called (#28031)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-03-07 19:45:31 +09:00
trop[bot]
f8df8ea9d5 test: fix contextIsolation value for later added test (#28004)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-03-05 10:10:59 +09:00
Electron Bot
da5e0e5ac2 Bump v13.0.0-beta.2 2021-03-04 07:01:51 -08:00
Electron Bot
b136c51747 Bump v13.0.0-beta.1 2021-03-03 13:38:42 -08:00
522 changed files with 7667 additions and 5089 deletions

View File

@@ -85,17 +85,17 @@ machine-linux-2xlarge: &machine-linux-2xlarge
machine-mac: &machine-mac
macos:
xcode: "12.2.0"
xcode: "12.4.0"
machine-mac-large: &machine-mac-large
resource_class: large
macos:
xcode: "12.2.0"
xcode: "12.4.0"
machine-mac-large-arm: &machine-mac-large-arm
resource_class: large
macos:
xcode: "12.2.0"
xcode: "12.4.0"
machine-mac-arm64: &machine-mac-arm64
resource_class: electronjs/macos-arm64
@@ -230,6 +230,18 @@ step-maybe-notify-slack-success: &step-maybe-notify-slack-success
fi
when: on_success
step-maybe-cleanup-arm64-mac: &step-maybe-cleanup-arm64-mac
run:
name: Cleanup after testing
command: |
if [ "$TARGET_ARCH" == "arm64" ] &&[ "`uname`" == "Darwin" ]; then
killall Electron || echo "No Electron processes left running"
killall Safari || echo "No Safari processes left running"
rm -rf ~/Library/Application\ Support/Electron*
rm -rf ~/Library/Application\ Support/electron*
fi
when: always
step-checkout-electron: &step-checkout-electron
checkout:
path: src/electron
@@ -266,7 +278,7 @@ step-gclient-sync: &step-gclient-sync
if ! git diff-index --quiet HEAD --; then
# There are changes to the patches. Make a git commit with the updated patches
git add patches
GIT_COMMITTER_NAME="Electron Bot" GIT_COMMITTER_EMAIL="electron@github.com" git commit -m "update patches" --author="Electron Bot <electron@github.com>"
GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
# Export it
mkdir -p ../../patches
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
@@ -313,9 +325,10 @@ step-setup-goma-for-build: &step-setup-goma-for-build
npm install
mkdir third_party
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
node -e "require('./src/utils/goma.js').ensure()"
third_party/goma/goma_ctl.py ensure_start
echo 'export GN_GOMA_FILE='`node -e "console.log(require('./src/utils/goma.js').gnFilePath)"` >> $BASH_ENV
echo 'export LOCAL_GOMA_DIR='`node -e "console.log(require('./src/utils/goma.js').dir)"` >> $BASH_ENV
echo 'export GOMA_FALLBACK_ON_AUTH_FAILURE=true' >> $BASH_ENV
cd ..
step-restore-brew-cache: &step-restore-brew-cache
@@ -492,6 +505,7 @@ step-gn-check: &step-gn-check
gn check out/Default //electron/shell/common/api:mojo
# Check the hunspell filenames
node electron/script/gen-hunspell-filenames.js --check
node electron/script/gen-libc++-filenames.js --check
step-electron-build: &step-electron-build
run:
@@ -517,7 +531,9 @@ step-electron-build: &step-electron-build
ninja -C out/Default electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
ninja -C out/Default tools/v8_context_snapshot -j $NUMBER_OF_NINJA_PROCESSES
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
rm -rf out/Default/clang_x64_v8_arm64/gen
rm -rf out/Default/clang_x64_v8_arm64/obj
rm -rf out/Default/clang_x64/obj
# Regenerate because we just deleted some ninja files
gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
@@ -672,6 +688,11 @@ step-persist-data-for-tests: &step-persist-data-for-tests
- src/third_party/electron_node
- src/third_party/nan
- src/cross-arch-snapshots
- src/third_party/llvm-build
- src/build/linux
- src/buildtools/third_party/libc++
- src/buildtools/third_party/libc++abi
- src/out/Default/obj/buildtools/third_party
step-electron-dist-unzip: &step-electron-dist-unzip
run:
@@ -822,6 +843,17 @@ step-hunspell-store: &step-hunspell-store
path: src/out/Default/hunspell_dictionaries.zip
destination: hunspell_dictionaries.zip
step-maybe-generate-libcxx: &step-maybe-generate-libcxx
run:
name: maybe generate libcxx
command: |
cd src
if [ "`uname`" == "Linux" ]; then
ninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
ninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
ninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
fi
step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols
run:
name: Generate breakpad symbols
@@ -840,7 +872,7 @@ step-maybe-zip-symbols: &step-maybe-zip-symbols
export BUILD_PATH="$PWD/out/Default"
ninja -C out/Default electron:licenses
ninja -C out/Default electron:electron_version
electron/script/zip-symbols.py -b $BUILD_PATH
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
step-symbols-store: &step-symbols-store
store_artifacts:
@@ -1018,7 +1050,7 @@ step-minimize-workspace-size-from-checkout: &step-minimize-workspace-size-from-c
name: Remove some unused data to avoid storing it in the workspace/cache
command: |
rm -rf src/android_webview
rm -rf src/ios
rm -rf src/ios/chrome
rm -rf src/third_party/blink/web_tests
rm -rf src/third_party/blink/perf_tests
rm -rf src/third_party/WebKit/LayoutTests
@@ -1340,6 +1372,8 @@ steps-tests: &steps-tests
- *step-maybe-notify-slack-failure
- *step-maybe-cleanup-arm64-mac
steps-test-nan: &steps-test-nan
steps:
- attach_workspace:
@@ -1670,6 +1704,9 @@ commands:
- *step-hunspell-build
- *step-hunspell-store
# libcxx
- *step-maybe-generate-libcxx
# typescript defs
- *step-maybe-generate-typescript-defs
@@ -2311,7 +2348,7 @@ jobs:
<<: *steps-tests
linux-x64-testing-asan-tests:
<<: *machine-linux-medium
<<: *machine-linux-xlarge
environment:
<<: *env-linux-medium
<<: *env-headless-testing
@@ -2595,15 +2632,19 @@ workflows:
- osx-publish-x64-skip-checkout:
requires:
- mac-checkout
context: release-env
- mas-publish-x64-skip-checkout:
requires:
- mac-checkout
context: release-env
- osx-publish-arm64-skip-checkout:
requires:
- mac-checkout
context: release-env
- mas-publish-arm64-skip-checkout:
requires:
- mac-checkout
context: release-env
lint:
when: << pipeline.parameters.run-lint >>

View File

@@ -4,4 +4,3 @@
APPVEYOR_CLOUD_TOKEN=
CIRCLE_TOKEN=
ELECTRON_GITHUB_TOKEN=
VSTS_TOKEN=

4
.gitignore vendored
View File

@@ -68,4 +68,6 @@ ts-gen
.depshash-target
# Used to accelerate builds after sync
patches/mtime-cache.json
patches/mtime-cache.json
spec/fixtures/logo.png

View File

@@ -25,6 +25,8 @@ import("electron_paks.gni")
import("filenames.auto.gni")
import("filenames.gni")
import("filenames.hunspell.gni")
import("filenames.libcxx.gni")
import("filenames.libcxxabi.gni")
if (is_mac) {
import("//build/config/mac/rules.gni")
@@ -402,7 +404,10 @@ source_set("electron_lib") {
}
if (!is_mas_build) {
deps += [ "//components/crash/core/app" ]
deps += [
"//components/crash/core/app",
"//components/crash/core/browser",
]
}
sources = filenames.lib_sources
@@ -440,6 +445,7 @@ source_set("electron_lib") {
if (is_mac) {
deps += [
"//components/remote_cocoa/app_shim",
"//components/remote_cocoa/browser",
"//content/common:mac_helpers",
"//ui/accelerated_widget_mac",
]
@@ -619,6 +625,9 @@ source_set("electron_lib") {
"//chrome/services/printing/public/mojom",
"//components/printing/common:mojo_interfaces",
]
if (is_mac) {
deps += [ "//chrome/services/mac_notifications/public/mojom" ]
}
}
if (enable_electron_extensions) {
@@ -632,6 +641,7 @@ source_set("electron_lib") {
"//components/zoom",
"//extensions/browser",
"//extensions/browser:core_api_provider",
"//extensions/browser/updater",
"//extensions/common",
"//extensions/common:core_api_provider",
"//extensions/renderer",
@@ -1284,13 +1294,18 @@ template("dist_zip") {
"testonly",
])
flatten = false
flatten_relative_to = false
if (defined(invoker.flatten)) {
flatten = invoker.flatten
if (defined(invoker.flatten_relative_to)) {
flatten_relative_to = invoker.flatten_relative_to
}
}
args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
target_cpu,
target_os,
"$flatten",
"$flatten_relative_to",
]
}
}
@@ -1381,6 +1396,43 @@ dist_zip("hunspell_dictionaries_zip") {
outputs = [ "$root_build_dir/hunspell_dictionaries.zip" ]
}
copy("libcxx_headers") {
sources = libcxx_headers + libcxx_licenses
outputs = [ "$target_gen_dir/electron_libcxx_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
}
dist_zip("libcxx_headers_zip") {
data_deps = [ ":libcxx_headers" ]
flatten = true
flatten_relative_to = rebase_path(
"$target_gen_dir/electron_libcxx_include/buildtools/third_party/libc++/trunk",
"$root_out_dir")
outputs = [ "$root_build_dir/libcxx_headers.zip" ]
}
copy("libcxxabi_headers") {
sources = libcxxabi_headers + libcxxabi_licenses
outputs = [ "$target_gen_dir/electron_libcxxabi_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
}
dist_zip("libcxxabi_headers_zip") {
data_deps = [ ":libcxxabi_headers" ]
flatten = true
flatten_relative_to = rebase_path(
"$target_gen_dir/electron_libcxxabi_include/buildtools/third_party/libc++abi/trunk",
"$root_out_dir")
outputs = [ "$root_build_dir/libcxxabi_headers.zip" ]
}
action("libcxx_objects_zip") {
deps = [ "//buildtools/third_party/libc++" ]
script = "build/zip_libcxx.py"
outputs = [ "$root_build_dir/libcxx_objects.zip" ]
args = rebase_path(outputs)
}
group("electron") {
public_deps = [ ":electron_app" ]
}

6
DEPS
View File

@@ -14,11 +14,11 @@ gclient_gn_args = [
vars = {
'chromium_version':
'1f252b391a40e2681b0d9aff6497b7401863d1fc',
'91.0.4472.69',
'node_version':
'v14.16.0',
'nan_version':
'2c4ee8a32a299eada3cd6e468bbd0a473bfea96d',
'v2.14.2',
'squirrel.mac_version':
'cdc0729c8bf8576bfef18629186e1e9ecf1b0d9f',
@@ -48,6 +48,8 @@ vars = {
# It's only needed to parse the native tests configurations.
'checkout_pyyaml': False,
'use_rts': False,
'mac_xcode_version': 'default',
# To allow running hooks without parsing the DEPS tree

View File

@@ -1 +1 @@
13.0.0-nightly.20210303
13.0.0

View File

@@ -5,7 +5,7 @@
[![devDependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron?type=dev)
[![Electron Discord Invite](https://img.shields.io/discord/745037351163527189?color=%237289DA&label=chat&logo=discord&logoColor=white)](https://discord.com/invite/electron)
:memo: Available Translations: 🇨🇳 🇹🇼 🇧🇷 🇪🇸 🇰🇷 🇯🇵 🇷🇺 🇫🇷 🇹🇭 🇳🇱 🇹🇷 🇮🇩 🇺🇦 🇨🇿 🇮🇹 🇵🇱.
:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪.
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).
The Electron framework lets you write cross-platform desktop applications

View File

@@ -36,6 +36,7 @@ environment:
ELECTRON_ENABLE_STACK_DUMPING: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
GOMA_FALLBACK_ON_AUTH_FAILURE: true
notifications:
- provider: Webhook
url: https://electron-mission-control.herokuapp.com/rest/appveyor-hook

View File

@@ -64,7 +64,7 @@ steps:
set npm_config_arch=arm64
cd electron
# CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
node script/yarn test -- --enable-logging --verbose --disable-features=CalculateNativeWinOcclusion
node script/yarn test -- --enable-logging --verbose --disable-features=CalculateNativeWinOcclusion --disable-gpu
displayName: 'Run Electron tests'
env:
ELECTRON_OUT_DIR: Default

View File

@@ -19,4 +19,12 @@ enable_basic_printing = true
angle_enable_vulkan_validation_layers = false
dawn_enable_vulkan_validation_layers = false
# This breaks native node modules
libcxx_abi_unstable = false
# These are disabled because they cause the zip manifest to differ between
# testing and release builds.
# See https://chromium-review.googlesource.com/c/chromium/src/+/2774898.
enable_pseudolocales = false
is_cfi = false

View File

@@ -8,6 +8,7 @@
# require any direct Cocoa locale support.
import os
import errno
import sys
@@ -16,7 +17,7 @@ def main(args):
try:
os.makedirs(dirname)
except OSError as e:
if e.errno == os.errno.EEXIST:
if e.errno == errno.EEXIST:
# It's OK if it already exists
pass
else:

View File

@@ -15,12 +15,6 @@ args = [cmd, "run",
try:
subprocess.check_output(args, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
print(
"NPM script '"
+ sys.argv[2]
+ "' failed with code '"
+ str(e.returncode)
+ "':\n"
+ e.output
)
error_msg = "NPM script '{}' failed with code '{}':\n".format(sys.argv[2], e.returncode)
print(error_msg + e.output.decode('ascii'))
sys.exit(e.returncode)

View File

@@ -163,7 +163,7 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
setImmediate: false
},
optimization: {
minimize: true,
minimize: env.mode === 'production',
minimizer: [
new TerserPlugin({
terserOptions: {

View File

@@ -22,6 +22,11 @@ template("webpack_build") {
"//electron/typings/internal-electron.d.ts",
] + invoker.inputs
mode = "development"
if (is_official_build) {
mode = "production"
}
args = [
"--config",
rebase_path(invoker.config_file),
@@ -29,6 +34,7 @@ template("webpack_build") {
"--output-path=" + rebase_path(get_path_info(invoker.out_file, "dir")),
"--env.buildflags=" +
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
"--env.mode=" + mode,
]
deps += [ "buildflags" ]

View File

@@ -39,6 +39,7 @@ PATHS_TO_SKIP = [
'./crashpad_handler',
# Skip because these are outputs that we don't need.
'resources/inspector',
'gen/third_party/devtools-frontend/src'
]
def skip_path(dep, dist_zip, target_cpu):
@@ -70,7 +71,7 @@ def execute(argv):
raise e
def main(argv):
dist_zip, runtime_deps, target_cpu, _, flatten_val = argv
dist_zip, runtime_deps, target_cpu, _, flatten_val, flatten_relative_to = argv
should_flatten = flatten_val == "true"
dist_files = set()
with open(runtime_deps) as f:
@@ -97,11 +98,18 @@ def main(argv):
if basename == 'chrome_sandbox'
else dep
)
name_to_write = arcname
if should_flatten:
if flatten_relative_to:
if name_to_write.startswith(flatten_relative_to):
name_to_write = name_to_write[len(flatten_relative_to):]
else:
name_to_write = os.path.basename(arcname)
else:
name_to_write = os.path.basename(arcname)
z.write(
dep,
os.path.basename(arcname)
if should_flatten
else arcname,
name_to_write,
)
if __name__ == '__main__':

47
build/zip_libcxx.py Normal file
View File

@@ -0,0 +1,47 @@
#!/usr/bin/env python
from __future__ import print_function
import os
import subprocess
import sys
import zipfile
def execute(argv):
try:
output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
return output
except subprocess.CalledProcessError as e:
print(e.output)
raise e
def get_object_files(base_path, archive_name):
archive_file = os.path.join(base_path, archive_name)
output = execute(['nm', '-g', archive_file]).decode('ascii')
object_files = set()
lines = output.split("\n")
for line in lines:
if line.startswith(base_path):
object_file = line.split(":")[0]
object_files.add(object_file)
if line.startswith('nm: '):
object_file = line.split(":")[1].lstrip()
object_files.add(object_file)
return list(object_files) + [archive_file]
def main(argv):
dist_zip, = argv
out_dir = os.path.dirname(dist_zip)
base_path_libcxx = os.path.join(out_dir, 'obj/buildtools/third_party/libc++')
base_path_libcxxabi = os.path.join(out_dir, 'obj/buildtools/third_party/libc++abi')
object_files_libcxx = get_object_files(base_path_libcxx, 'libc++.a')
object_files_libcxxabi = get_object_files(base_path_libcxxabi, 'libc++abi.a')
with zipfile.ZipFile(
dist_zip, 'w', zipfile.ZIP_DEFLATED, allowZip64=True
) as z:
object_files_libcxx.sort()
for object_file in object_files_libcxx:
z.write(object_file, os.path.relpath(object_file, base_path_libcxx))
for object_file in object_files_libcxxabi:
z.write(object_file, os.path.relpath(object_file, base_path_libcxxabi))
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))

View File

@@ -2,6 +2,7 @@
# Use of this source code is governed by the MIT license that can be
# found in the LICENSE file.
import("//build/config/ozone.gni")
import("//build/config/ui.gni")
import("//components/spellcheck/spellcheck_build_features.gni")
import("//electron/buildflags/buildflags.gni")
@@ -16,8 +17,6 @@ static_library("chrome") {
"//chrome/browser/accessibility/accessibility_ui.h",
"//chrome/browser/browser_process.cc",
"//chrome/browser/browser_process.h",
"//chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc",
"//chrome/browser/crash_upload_list/crash_upload_list_crashpad.h",
"//chrome/browser/devtools/devtools_contents_resizing_strategy.cc",
"//chrome/browser/devtools/devtools_contents_resizing_strategy.h",
"//chrome/browser/devtools/devtools_embedder_message_dispatcher.cc",
@@ -46,7 +45,6 @@ static_library("chrome") {
"//chrome/browser/predictors/resolve_host_client_impl.h",
"//chrome/browser/ssl/security_state_tab_helper.cc",
"//chrome/browser/ssl/security_state_tab_helper.h",
"//chrome/browser/ssl/tls_deprecation_config.cc",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h",
"//extensions/browser/app_window/size_constraints.cc",
@@ -95,12 +93,18 @@ static_library("chrome") {
if (is_linux) {
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
if (use_x11 || use_ozone) {
sources +=
[ "//chrome/browser/extensions/global_shortcut_listener_linux.cc" ]
}
if (use_x11) {
sources += [
"//chrome/browser/extensions/global_shortcut_listener_x11.cc",
"//chrome/browser/extensions/global_shortcut_listener_x11.h",
]
} else if (use_ozone) {
}
if (use_ozone) {
deps += [ "//ui/ozone" ]
sources += [
"//chrome/browser/extensions/global_shortcut_listener_ozone.cc",
"//chrome/browser/extensions/global_shortcut_listener_ozone.h",
@@ -191,7 +195,7 @@ static_library("chrome") {
}
if (is_linux) {
sources += [ "//chrome/browser/media/webrtc/window_icon_util_x11.cc" ]
sources += [ "//chrome/browser/media/webrtc/window_icon_util_linux.cc" ]
}
}
@@ -253,8 +257,12 @@ static_library("chrome") {
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
"//chrome/browser/ui/views/overlay/back_to_tab_image_button.cc",
"//chrome/browser/ui/views/overlay/back_to_tab_image_button.h",
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
"//chrome/browser/ui/views/overlay/close_image_button.cc",
"//chrome/browser/ui/views/overlay/close_image_button.h",
"//chrome/browser/ui/views/overlay/constants.h",
"//chrome/browser/ui/views/overlay/hang_up_button.cc",
"//chrome/browser/ui/views/overlay/hang_up_button.h",
"//chrome/browser/ui/views/overlay/overlay_window_views.cc",
"//chrome/browser/ui/views/overlay/overlay_window_views.h",
"//chrome/browser/ui/views/overlay/playback_image_button.cc",
@@ -263,6 +271,10 @@ static_library("chrome") {
"//chrome/browser/ui/views/overlay/resize_handle_button.h",
"//chrome/browser/ui/views/overlay/skip_ad_label_button.cc",
"//chrome/browser/ui/views/overlay/skip_ad_label_button.h",
"//chrome/browser/ui/views/overlay/toggle_camera_button.cc",
"//chrome/browser/ui/views/overlay/toggle_camera_button.h",
"//chrome/browser/ui/views/overlay/toggle_microphone_button.cc",
"//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
"//chrome/browser/ui/views/overlay/track_image_button.cc",
"//chrome/browser/ui/views/overlay/track_image_button.h",
]

View File

@@ -90,7 +90,7 @@ CertificateManagerModel::~CertificateManagerModel() = default;
int CertificateManagerModel::ImportFromPKCS12(
PK11SlotInfo* slot_info,
const std::string& data,
const base::string16& password,
const std::u16string& password,
bool is_extractable,
net::ScopedCERTCertificateList* imported_certs) {
return cert_db_->ImportFromPKCS12(slot_info, data, password, is_extractable,

View File

@@ -12,7 +12,6 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
#include "net/cert/nss_cert_database.h"
namespace content {
@@ -46,7 +45,7 @@ class CertificateManagerModel {
// Returns a net error code on failure.
int ImportFromPKCS12(PK11SlotInfo* slot_info,
const std::string& data,
const base::string16& password,
const std::u16string& password,
bool is_extractable,
net::ScopedCERTCertificateList* imported_certs);

View File

@@ -41,14 +41,14 @@ ipcMain.handle('bootstrap', (event) => {
return isTrustedSender(event.sender) ? electronPath : null;
});
async function createWindow () {
async function createWindow (backgroundColor?: string) {
await app.whenReady();
const options: Electron.BrowserWindowConstructorOptions = {
width: 960,
height: 620,
autoHideMenuBar: true,
backgroundColor: '#2f3241',
backgroundColor,
webPreferences: {
preload: path.resolve(__dirname, 'preload.js'),
contextIsolation: true,
@@ -96,7 +96,7 @@ export const loadURL = async (appUrl: string) => {
};
export const loadFile = async (appPath: string) => {
mainWindow = await createWindow();
mainWindow = await createWindow(appPath === 'index.html' ? '#2f3241' : undefined);
mainWindow.loadFile(appPath);
mainWindow.focus();
};

View File

@@ -18,20 +18,14 @@ an issue:
## Guides and Tutorials
### Quickstart
### Getting started
* [Quick Start Guide](tutorial/quick-start.md)
* [Prerequisites](tutorial/quick-start.md#prerequisites)
* [Create a basic application](tutorial/quick-start.md#create-a-basic-application)
* [Run your application](tutorial/quick-start.md#run-your-application)
* [Package and distribute the application](tutorial/quick-start.md#package-and-distribute-the-application)
* [Introduction](tutorial/introduction.md)
* [Quick Start](tutorial/quick-start.md)
* [Process Model](tutorial/process-model.md)
### Learning the basics
* [Electron's Process Model](tutorial/quick-start.md#application-architecture)
* [Main and Renderer Processes](tutorial/quick-start.md#main-and-renderer-processes)
* [Electron API](tutorial/quick-start.md#electron-api)
* [Node.js API](tutorial/quick-start.md#nodejs-api)
* Adding Features to Your App
* [Notifications](tutorial/notifications.md)
* [Recent Documents](tutorial/recent-documents.md)
@@ -59,6 +53,7 @@ an issue:
* [Using Native Node.js Modules](tutorial/using-native-node-modules.md)
* [Performance Strategies](tutorial/performance.md)
* [Security Strategies](tutorial/security.md)
* [Process Sandboxing](tutorial/sandbox.md)
* [Accessibility](tutorial/accessibility.md)
* [Manually Enabling Accessibility Features](tutorial/accessibility.md#manually-enabling-accessibility-features)
* [Testing and Debugging](tutorial/application-debugging.md)
@@ -68,6 +63,7 @@ an issue:
* [Testing on Headless CI Systems (Travis, Jenkins)](tutorial/testing-on-headless-ci.md)
* [DevTools Extension](tutorial/devtools-extension.md)
* [Automated Testing with a Custom Driver](tutorial/automated-testing-with-a-custom-driver.md)
* [REPL](tutorial/repl.md)
* [Distribution](tutorial/application-distribution.md)
* [Supported Platforms](tutorial/support.md#supported-platforms)
* [Code Signing](tutorial/code-signing.md)
@@ -126,6 +122,8 @@ These individual tutorials expand on topics discussed in the guide above.
* [ipcMain](api/ipc-main.md)
* [Menu](api/menu.md)
* [MenuItem](api/menu-item.md)
* [MessageChannelMain](api/message-channel-main.md)
* [MessagePortMain](api/message-port-main.md)
* [net](api/net.md)
* [netLog](api/net-log.md)
* [nativeTheme](api/native-theme.md)
@@ -135,6 +133,7 @@ These individual tutorials expand on topics discussed in the guide above.
* [protocol](api/protocol.md)
* [screen](api/screen.md)
* [session](api/session.md)
* [ShareMenu](api/share-menu.md)
* [systemPreferences](api/system-preferences.md)
* [TouchBar](api/touch-bar.md)
* [Tray](api/tray.md)
@@ -144,15 +143,14 @@ These individual tutorials expand on topics discussed in the guide above.
### Modules for the Renderer Process (Web Page):
* [contextBridge](api/context-bridge.md)
* [desktopCapturer](api/desktop-capturer.md)
* [ipcRenderer](api/ipc-renderer.md)
* [remote](api/remote.md)
* [webFrame](api/web-frame.md)
### Modules for Both Processes:
* [clipboard](api/clipboard.md)
* [crashReporter](api/crash-reporter.md)
* [desktopCapturer](api/desktop-capturer.md)
* [nativeImage](api/native-image.md)
* [shell](api/shell.md)

View File

@@ -35,7 +35,7 @@ Linux and Windows to define some accelerators.
Use `Alt` instead of `Option`. The `Option` key only exists on macOS, whereas
the `Alt` key is available on all platforms.
The `Super` key is mapped to the `Windows` key on Windows and Linux and
The `Super` (or `Meta`) key is mapped to the `Windows` key on Windows and Linux and
`Cmd` on macOS.
## Available modifiers
@@ -48,6 +48,7 @@ The `Super` key is mapped to the `Windows` key on Windows and Linux and
* `AltGr`
* `Shift`
* `Super`
* `Meta`
## Available key codes

View File

@@ -753,7 +753,8 @@ Overrides the current application's name.
### `app.getLocale()`
Returns `String` - The current application locale. Possible return values are documented [here](locales.md).
Returns `String` - The current application locale, fetched using Chromium's `l10n_util` library.
Possible return values are documented [here](https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc).
To set the locale, you'll want to use a command line switch at app startup, which may be found [here](https://github.com/electron/electron/blob/master/docs/api/command-line-switches.md).
@@ -929,6 +930,10 @@ re-add a removed item to a custom category earlier than that will result in the
entire custom category being omitted from the Jump List. The list of removed
items can be obtained using `app.getJumpListSettings()`.
**Note:** The maximum length of a Jump List item's `description` property is
260 characters. Beyond this limit, the item will not be added to the Jump
List, nor will it be displayed.
Here's a very simple example of creating a custom Jump List:
```javascript

View File

@@ -1,14 +1,16 @@
## Class: BrowserView
> Create and control views.
Process: [Main](../glossary.md#main-process)
# BrowserView
A `BrowserView` can be used to embed additional web content into a
[`BrowserWindow`](browser-window.md). It is like a child window, except that it is positioned
relative to its owning window. It is meant to be an alternative to the
`webview` tag.
## Class: BrowserView
> Create and control views.
Process: [Main](../glossary.md#main-process)
### Example
```javascript

View File

@@ -238,7 +238,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
window shadow and window animations. Default is `true`.
* `vibrancy` String (optional) - Add a type of vibrancy effect to the window, only on
macOS. Can be `appearance-based`, `light`, `dark`, `titlebar`, `selection`,
`menu`, `popover`, `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please note that using `frame: false` in combination with a vibrancy value requires that you use a non-default `titleBarStyle` as well. Also note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are deprecated and have been removed in macOS Catalina (10.15).
`menu`, `popover`, `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are deprecated and have been removed in macOS Catalina (10.15).
* `zoomToPageWidth` Boolean (optional) - Controls the behavior on macOS when
option-clicking the green stoplight button on the toolbar or by clicking the
Window > Zoom menu item. If `true`, the window will grow to the preferred
@@ -267,12 +267,12 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
be the absolute file path to the script.
When node integration is turned off, the preload script can reintroduce
Node global symbols back to the global scope. See example
[here](process.md#event-loaded).
[here](context-bridge.md#exposing-node-global-symbols).
* `sandbox` Boolean (optional) - If set, this will sandbox the renderer
associated with the window, making it compatible with the Chromium
OS-level sandbox and disabling the Node.js engine. This is not the same as
the `nodeIntegration` option and the APIs available to the preload script
are more limited. Read more about the option [here](sandbox-option.md).
are more limited. Read more about the option [here](../tutorial/sandbox.md).
* `enableRemoteModule` Boolean (optional) - Whether to enable the [`remote`](remote.md) module.
Default is `false`.
* `session` [Session](session.md#class-session) (optional) - Sets the session used by the
@@ -1301,7 +1301,7 @@ can be be used to listen to changes to tablet mode.
#### `win.getMediaSourceId()`
Returns `String` - Window id in the format of DesktopCapturerSource's id. For example "window:1234:0".
Returns `String` - Window id in the format of DesktopCapturerSource's id. For example "window:1324:0".
More precisely the format is `window:id:other_id` where `id` is `HWND` on
Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
@@ -1319,6 +1319,8 @@ The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
* `message` Integer
* `callback` Function
* `wParam` any - The `wParam` provided to the WndProc
* `lParam` any - The `lParam` provided to the WndProc
Hooks a windows message. The `callback` is called when
the message is received in the WndProc.
@@ -1371,7 +1373,7 @@ Returns `Boolean` - Whether the window's document has been edited.
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. If the page is not visible, `rect` may be empty.
#### `win.loadURL(url[, options])`
@@ -1380,7 +1382,7 @@ Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
* `httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer URL.
* `userAgent` String (optional) - A user agent originating the request.
* `extraHeaders` String (optional) - Extra headers separated by "\n"
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md)) (optional)
* `postData` ([UploadRawData](structures/upload-raw-data.md) | [UploadFile](structures/upload-file.md))[] (optional)
* `baseURLForDataURL` String (optional) - Base URL (with trailing path separator) for files to be loaded by the data URL. This is needed only if the specified `url` is a data URL and needs to load other files.
Returns `Promise<void>` - the promise will resolve when the page has finished loading

View File

@@ -80,6 +80,12 @@ This switch can not be used in `app.commandLine.appendSwitch` since it is parsed
earlier than user's app is loaded, but you can set the `ELECTRON_ENABLE_LOGGING`
environment variable to achieve the same effect.
### --force-fieldtrials=`trials`
Field trials to be forcefully enabled or disabled.
For example: `WebRTC-Audio-Red-For-Opus/Enabled/`
### --host-rules=`rules`
A comma-separated list of `rules` that control how hostnames are mapped.
@@ -136,7 +142,8 @@ proxy server flags that are passed.
### --no-sandbox
Disables Chromium sandbox, which is now enabled by default.
Disables the Chromium [sandbox](https://www.chromium.org/developers/design-documents/sandbox).
Forces renderer process and Chromium helper processes to run un-sandboxed.
Should only be used for testing.
### --proxy-bypass-list=`hosts`

View File

@@ -33,7 +33,7 @@ page you load in your renderer executes code in this world.
### Isolated World
When `contextIsolation` is enabled in your `webPreferences`, your `preload` scripts run in an
When `contextIsolation` is enabled in your `webPreferences` (this is the default behavior since Electron 12.0.0), your `preload` scripts run in an
"Isolated World". You can read more about context isolation and what it affects in the
[security](../tutorial/security.md#3-enable-context-isolation-for-remote-content) docs.
@@ -110,3 +110,22 @@ has been included below for completeness:
| `Symbol` | N/A | ❌ | ❌ | Symbols cannot be copied across contexts so they are dropped |
If the type you care about is not in the above table, it is probably not supported.
### Exposing Node Global Symbols
The `contextBridge` can be used by the preload script to give your renderer access to Node APIs.
The table of supported types described above also applies to Node APIs that you expose through `contextBridge`.
Please note that many Node APIs grant access to local system resources.
Be very cautious about which globals and APIs you expose to untrusted remote content.
```javascript
const { contextBridge } = require('electron')
const crypto = require('crypto')
contextBridge.exposeInMainWorld('nodeCrypto', {
sha256sum (data) {
const hash = crypto.createHash('sha256')
hash.update(data)
return hash.digest('hex')
}
})
```

View File

@@ -45,6 +45,8 @@ The following events are available on instances of `Cookies`:
#### Event: 'changed'
Returns:
* `event` Event
* `cookie` [Cookie](structures/cookie.md) - The cookie that was changed.
* `cause` String - The cause of the change with one of the following values:

View File

@@ -77,7 +77,8 @@ The `crashReporter` module has the following methods:
### `crashReporter.start(options)`
* `options` Object
* `submitURL` String - URL that crash reports will be sent to as POST.
* `submitURL` String (optional) - URL that crash reports will be sent to as
POST. Required unless `uploadToServer` is `false`.
* `productName` String (optional) - Defaults to `app.name`.
* `companyName` String (optional) _Deprecated_ - Deprecated alias for
`{ globalExtra: { _companyName: ... } }`.

View File

@@ -154,7 +154,7 @@ dialog.showOpenDialog(mainWindow, {
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `title` String (optional)
* `title` String (optional) - The dialog title. Cannot be displayed on some _Linux_ desktop environments.
* `defaultPath` String (optional) - Absolute directory path, absolute file
path, or file name to use by default.
* `buttonLabel` String (optional) - Custom label for the confirmation button, when
@@ -185,7 +185,7 @@ The `filters` specifies an array of file types that can be displayed, see
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `title` String (optional)
* `title` String (optional) - The dialog title. Cannot be displayed on some _Linux_ desktop environments.
* `defaultPath` String (optional) - Absolute directory path, absolute file
path, or file name to use by default.
* `buttonLabel` String (optional) - Custom label for the confirmation button, when

View File

@@ -83,8 +83,10 @@ win.show()
blur effect to the content below the window (i.e. other applications open on
the user's system).
* The window will not be transparent when DevTools is opened.
* On Windows operating systems, transparent windows will not work when DWM is
* On Windows operating systems,
* transparent windows will not work when DWM is
disabled.
* transparent windows can not be maximized using the Windows system menu or by double clicking the title bar. The reasoning behind this can be seen on [this pull request](https://github.com/electron/electron/pull/28207).
* On Linux, users have to put `--enable-transparent-visuals --disable-gpu` in
the command line to disable GPU and allow ARGB to make transparent window,
this is caused by an upstream bug that [alpha channel doesn't work on some

View File

@@ -1,142 +0,0 @@
# Locales
> Locale values returned by `app.getLocale()`.
Electron uses Chromium's `l10n_util` library to fetch the locale. Possible
values are listed below:
| Language Code | Language Name |
|---------------|---------------|
| af | Afrikaans |
| am | Amharic |
| ar | Arabic |
| az | Azerbaijani |
| be | Belarusian |
| bg | Bulgarian |
| bh | Bihari |
| bn | Bengali |
| br | Breton |
| bs | Bosnian |
| ca | Catalan |
| co | Corsican |
| cs | Czech |
| cy | Welsh |
| da | Danish |
| de | German |
| de-AT | German (Austria) |
| de-CH | German (Switzerland) |
| de-DE | German (Germany) |
| el | Greek |
| en | English |
| en-AU | English (Australia) |
| en-CA | English (Canada) |
| en-GB | English (UK) |
| en-NZ | English (New Zealand) |
| en-US | English (US) |
| en-ZA | English (South Africa) |
| eo | Esperanto |
| es | Spanish |
| es-419 | Spanish (Latin America) |
| et | Estonian |
| eu | Basque |
| fa | Persian |
| fi | Finnish |
| fil | Filipino |
| fo | Faroese |
| fr | French |
| fr-CA | French (Canada) |
| fr-CH | French (Switzerland) |
| fr-FR | French (France) |
| fy | Frisian |
| ga | Irish |
| gd | Scots Gaelic |
| gl | Galician |
| gn | Guarani |
| gu | Gujarati |
| ha | Hausa |
| haw | Hawaiian |
| he | Hebrew |
| hi | Hindi |
| hr | Croatian |
| hu | Hungarian |
| hy | Armenian |
| ia | Interlingua |
| id | Indonesian |
| is | Icelandic |
| it | Italian |
| it-CH | Italian (Switzerland) |
| it-IT | Italian (Italy) |
| ja | Japanese |
| jw | Javanese |
| ka | Georgian |
| kk | Kazakh |
| km | Cambodian |
| kn | Kannada |
| ko | Korean |
| ku | Kurdish |
| ky | Kyrgyz |
| la | Latin |
| ln | Lingala |
| lo | Laothian |
| lt | Lithuanian |
| lv | Latvian |
| mk | Macedonian |
| ml | Malayalam |
| mn | Mongolian |
| mo | Moldavian |
| mr | Marathi |
| ms | Malay |
| mt | Maltese |
| nb | Norwegian (Bokmal) |
| ne | Nepali |
| nl | Dutch |
| nn | Norwegian (Nynorsk) |
| no | Norwegian |
| oc | Occitan |
| om | Oromo |
| or | Oriya |
| pa | Punjabi |
| pl | Polish |
| ps | Pashto |
| pt | Portuguese |
| pt-BR | Portuguese (Brazil) |
| pt-PT | Portuguese (Portugal) |
| qu | Quechua |
| rm | Romansh |
| ro | Romanian |
| ru | Russian |
| sd | Sindhi |
| sh | Serbo-Croatian |
| si | Sinhalese |
| sk | Slovak |
| sl | Slovenian |
| sn | Shona |
| so | Somali |
| sq | Albanian |
| sr | Serbian |
| st | Sesotho |
| su | Sundanese |
| sv | Swedish |
| sw | Swahili |
| ta | Tamil |
| te | Telugu |
| tg | Tajik |
| th | Thai |
| ti | Tigrinya |
| tk | Turkmen |
| to | Tonga |
| tr | Turkish |
| tt | Tatar |
| tw | Twi |
| ug | Uighur |
| uk | Ukrainian |
| ur | Urdu |
| uz | Uzbek |
| vi | Vietnamese |
| xh | Xhosa |
| yi | Yiddish |
| yo | Yoruba |
| zh | Chinese |
| zh-CN | Chinese (Simplified) |
| zh-TW | Chinese (Traditional) |
| zu | Zulu |

View File

@@ -1,3 +1,5 @@
# Menu
## Class: Menu
> Create native application menus and context menus.

View File

@@ -9,12 +9,15 @@ channel messaging.
## Class: MessageChannelMain
> Channel interface for channel messaging in the main process.
Process: [Main](../glossary.md#main-process)
Example:
```js
// Main process
const { MessageChannelMain } = require('electron')
const { port1, port2 } = new MessageChannelMain()
w.webContents.postMessage('port', null, [port2])
port1.postMessage({ some: 'message' })

View File

@@ -14,6 +14,8 @@ channel messaging.
## Class: MessagePortMain
> Port interface for channel messaging in the main process.
Process: [Main](../glossary.md#main-process)
### Instance Methods

View File

@@ -30,11 +30,13 @@ In sandboxed renderers the `process` object contains only a subset of the APIs:
* `arch`
* `platform`
* `sandboxed`
* `contextIsolated`
* `type`
* `version`
* `versions`
* `mas`
* `windowsStore`
* `contextId`
## Events
@@ -43,19 +45,6 @@ In sandboxed renderers the `process` object contains only a subset of the APIs:
Emitted when Electron has loaded its internal initialization script and is
beginning to load the web page or the main script.
It can be used by the preload script to add removed Node global symbols back to
the global scope when node integration is turned off:
```javascript
// preload.js
const _setImmediate = setImmediate
const _clearImmediate = clearImmediate
process.once('loaded', () => {
global.setImmediate = _setImmediate
global.clearImmediate = _clearImmediate
})
```
## Properties
### `process.defaultApp` _Readonly_
@@ -93,6 +82,11 @@ A `String` representing the path to the resources directory.
A `Boolean`. When the renderer process is sandboxed, this property is `true`,
otherwise it is `undefined`.
### `process.contextIsolated` _Readonly_
A `Boolean` that indicates whether the current renderer context has `contextIsolation` enabled.
It is `undefined` in the main process.
### `process.throwDeprecation`
A `Boolean` that controls whether or not deprecation warnings will be thrown as
@@ -133,6 +127,13 @@ A `String` representing Electron's version string.
A `Boolean`. If the app is running as a Windows Store app (appx), this property is `true`,
for otherwise it is `undefined`.
### `process.contextId` _Readonly_
A `String` (optional) representing a globally unique ID of the current JavaScript context.
Each frame has its own JavaScript context. When contextIsolation is enabled, the isolated
world also has a separate JavaScript context.
This property is only available in the renderer process.
## Methods
The `process` object has the following methods:

View File

@@ -1,182 +0,0 @@
# `sandbox` Option
> Create a browser window with a sandboxed renderer. With this
option enabled, the renderer must communicate via IPC to the main process in order to access node APIs.
One of the key security features of Chromium is that all blink rendering/JavaScript
code is executed within a sandbox. This sandbox uses OS-specific features to ensure
that exploits in the renderer process cannot harm the system.
In other words, when the sandbox is enabled, the renderers can only make changes
to the system by delegating tasks to the main process via IPC.
[Here's](https://www.chromium.org/developers/design-documents/sandbox) more
information about the sandbox.
Since a major feature in Electron is the ability to run Node.js in the
renderer process (making it easier to develop desktop applications using web
technologies), the sandbox is disabled by electron. This is because
most Node.js APIs require system access. `require()` for example, is not
possible without file system permissions, which are not available in a sandboxed
environment.
Usually this is not a problem for desktop applications since the code is always
trusted, but it makes Electron less secure than Chromium for displaying
untrusted web content. For applications that require more security, the
`sandbox` flag will force Electron to spawn a classic Chromium renderer that is
compatible with the sandbox.
A sandboxed renderer doesn't have a Node.js environment running and doesn't
expose Node.js JavaScript APIs to client code. The only exception is the preload script,
which has access to a subset of the Electron renderer API.
Another difference is that sandboxed renderers don't modify any of the default
JavaScript APIs. Consequently, some APIs such as `window.open` will work as they
do in Chromium (i.e. they do not return a [`BrowserWindowProxy`](browser-window-proxy.md)).
## Example
To create a sandboxed window, pass `sandbox: true` to `webPreferences`:
```js
let win
app.whenReady().then(() => {
win = new BrowserWindow({
webPreferences: {
sandbox: true
}
})
win.loadURL('http://google.com')
})
```
In the above code the [`BrowserWindow`](browser-window.md) that was created has Node.js disabled and can communicate
only via IPC. The use of this option stops Electron from creating a Node.js runtime in the renderer. Also,
within this new window `window.open` follows the native behavior (by default Electron creates a [`BrowserWindow`](browser-window.md)
and returns a proxy to this via `window.open`).
[`app.enableSandbox`](app.md#appenablesandbox) can be used to force `sandbox: true` for all `BrowserWindow` instances.
```js
let win
app.enableSandbox()
app.whenReady().then(() => {
// no need to pass `sandbox: true` since `app.enableSandbox()` was called.
win = new BrowserWindow()
win.loadURL('http://google.com')
})
```
## Preload
An app can make customizations to sandboxed renderers using a preload script.
Here's an example:
```js
let win
app.whenReady().then(() => {
win = new BrowserWindow({
webPreferences: {
sandbox: true,
preload: path.join(app.getAppPath(), 'preload.js')
}
})
win.loadURL('http://google.com')
})
```
and preload.js:
```js
// This file is loaded whenever a javascript context is created. It runs in a
// private scope that can access a subset of Electron renderer APIs. Without
// contextIsolation enabled, it's possible to accidentally leak privileged
// globals like ipcRenderer to web content.
const { ipcRenderer } = require('electron')
const defaultWindowOpen = window.open
window.open = function customWindowOpen (url, ...args) {
ipcRenderer.send('report-window-open', location.origin, url, args)
return defaultWindowOpen(url + '?from_electron=1', ...args)
}
```
Important things to notice in the preload script:
- Even though the sandboxed renderer doesn't have Node.js running, it still has
access to a limited node-like environment: `Buffer`, `process`, `setImmediate`,
`clearImmediate` and `require` are available.
- The preload script must be contained in a single script, but it is possible to have
complex preload code composed with multiple modules by using a tool like
webpack or browserify. An example of using browserify is below.
To create a browserify bundle and use it as a preload script, something like
the following should be used:
```sh
browserify preload/index.js \
-x electron \
--insert-global-vars=__filename,__dirname -o preload.js
```
The `-x` flag should be used with any required module that is already exposed in
the preload scope, and tells browserify to use the enclosing `require` function
for it. `--insert-global-vars` will ensure that `process`, `Buffer` and
`setImmediate` are also taken from the enclosing scope(normally browserify
injects code for those).
Currently the `require` function provided in the preload scope exposes the
following modules:
- `electron`
- `crashReporter`
- `desktopCapturer`
- `ipcRenderer`
- `nativeImage`
- `webFrame`
- `events`
- `timers`
- `url`
More may be added as needed to expose more Electron APIs in the sandbox.
## Rendering untrusted content
Rendering untrusted content in Electron is still somewhat uncharted territory,
though some apps are finding success (e.g. Beaker Browser). Our goal is to get
as close to Chrome as we can in terms of the security of sandboxed content, but
ultimately we will always be behind due to a few fundamental issues:
1. We do not have the dedicated resources or expertise that Chromium has to
apply to the security of its product. We do our best to make use of what we
have, to inherit everything we can from Chromium, and to respond quickly to
security issues, but Electron cannot be as secure as Chromium without the
resources that Chromium is able to dedicate.
2. Some security features in Chrome (such as Safe Browsing and Certificate
Transparency) require a centralized authority and dedicated servers, both of
which run counter to the goals of the Electron project. As such, we disable
those features in Electron, at the cost of the associated security they
would otherwise bring.
3. There is only one Chromium, whereas there are many thousands of apps built
on Electron, all of which behave slightly differently. Accounting for those
differences can yield a huge possibility space, and make it challenging to
ensure the security of the platform in unusual use cases.
4. We can't push security updates to users directly, so we rely on app vendors
to upgrade the version of Electron underlying their app in order for
security updates to reach users.
Here are some things to consider before rendering untrusted content:
- A preload script can accidentally leak privileged APIs to untrusted code,
unless [`contextIsolation`](../tutorial/security.md#3-enable-context-isolation-for-remote-content)
is also enabled.
- Some bug in the V8 engine may allow malicious code to access the renderer
preload APIs, effectively granting full access to the system through the
`remote` module. Therefore, it is highly recommended to [disable the `remote`
module](../tutorial/security.md#15-disable-the-remote-module).
If disabling is not feasible, you should selectively [filter the `remote`
module](../tutorial/security.md#16-filter-the-remote-module).
- While we make our best effort to backport Chromium security fixes to older
versions of Electron, we do not make a guarantee that every fix will be
backported. Your best chance at staying secure is to be on the latest stable
version of Electron.

View File

@@ -822,6 +822,11 @@ Returns `Extension[]` - A list of all loaded extensions.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
#### `ses.getStoragePath()`
A `String | null` indicating the absolute file system path where data for this
session is persisted on disk. For in memory sessions this returns `null`.
### Instance Properties
The following properties are available on instances of `Session`:
@@ -835,6 +840,11 @@ code to the `setSpellCheckerLanguages` API that isn't in this array will result
A `Boolean` indicating whether builtin spell checker is enabled.
#### `ses.storagePath` _Readonly_
A `String | null` indicating the absolute file system path where data for this
session is persisted on disk. For in memory sessions this returns `null`.
#### `ses.cookies` _Readonly_
A [`Cookies`](cookies.md) object for this session.

View File

@@ -1,8 +1,4 @@
## Class: ShareMenu
> Create share menu on macOS.
Process: [Main](../glossary.md#main-process)
# ShareMenu
The `ShareMenu` class creates [Share Menu][share-menu] on macOS, which can be
used to share information from the current context to apps, social media
@@ -11,6 +7,12 @@ accounts, and other services.
For including the share menu as a submenu of other menus, please use the
`shareMenu` role of [`MenuItem`](menu-item.md).
## Class: ShareMenu
> Create share menu on macOS.
Process: [Main](../glossary.md#main-process)
### `new ShareMenu(sharingItem)`
* `sharingItem` SharingItem - The item to share.

View File

@@ -19,3 +19,7 @@
property set then its `type` is assumed to be `tasks`. If the `name` property
is set but the `type` property is omitted then the `type` is assumed to be
`custom`.
**Note:** The maximum length of a Jump List item's `description` property is
260 characters. Beyond this limit, the item will not be added to the Jump
List, nor will it be displayed.

View File

@@ -17,7 +17,7 @@
* `title` String (optional) - The text to be displayed for the item in the Jump List.
Should only be set if `type` is `task`.
* `description` String (optional) - Description of the task (displayed in a tooltip).
Should only be set if `type` is `task`.
Should only be set if `type` is `task`. Maximum length 260 characters.
* `iconPath` String (optional) - The absolute path to an icon to be displayed in a
Jump List, which can be an arbitrary resource file that contains an icon
(e.g. `.ico`, `.exe`, `.dll`). You can usually specify `process.execPath` to

View File

@@ -1,6 +1,6 @@
# PostBody Object
* `data` Array<[PostData](./post-data.md)> - The post data to be sent to the
* `data` ([UploadRawData](upload-raw-data.md) | [UploadFile](upload-file.md))[] - The post data to be sent to the
new window.
* `contentType` String - The `content-type` header used for the data. One of
`application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to

View File

@@ -1,21 +0,0 @@
# PostData Object
* `type` String - One of the following:
* `rawData` - The data is available as a `Buffer`, in the `rawData` field.
* `file` - The object represents a file. The `filePath`, `offset`, `length`
and `modificationTime` fields will be used to describe the file.
* `blob` - The object represents a `Blob`. The `blobUUID` field will be used
to describe the `Blob`.
* `bytes` String (optional) - The raw bytes of the post data in a `Buffer`.
Required for the `rawData` type.
* `filePath` String (optional) - The path of the file being uploaded. Required
for the `file` type.
* `blobUUID` String (optional) - The `UUID` of the `Blob` being uploaded.
Required for the `blob` type.
* `offset` Integer (optional) - The offset from the beginning of the file being
uploaded, in bytes. Only valid for `file` types.
* `length` Integer (optional) - The length of the file being uploaded, in bytes.
If set to `-1`, the whole file will be uploaded. Only valid for `file` types.
* `modificationTime` Double (optional) - The modification time of the file
represented by a double, which is the number of seconds since the `UNIX Epoch`
(Jan 1, 1970). Only valid for `file` types.

View File

@@ -1,6 +1,6 @@
# UploadFile Object
* `type` String - `file`.
* `type` 'file' - `file`.
* `filePath` String - Path of file to be uploaded.
* `offset` Integer - Defaults to `0`.
* `length` Integer - Number of bytes to read from `offset`.

View File

@@ -1,4 +1,4 @@
# UploadRawData Object
* `type` String - `rawData`.
* `type` 'rawData' - `rawData`.
* `bytes` Buffer - Data to be uploaded.

View File

@@ -13,7 +13,7 @@ either process type.
The basic rule is: if a module is [GUI][gui] or low-level system related, then
it should be only available in the main process. You need to be familiar with
the concept of [main process vs. renderer process](../tutorial/quick-start.md#main-and-renderer-processes)
the concept of main process vs. renderer process
scripts to be able to use those modules.
The main process script is like a normal Node.js script:
@@ -43,8 +43,6 @@ extra ability to use node modules if `nodeIntegration` is enabled:
</html>
```
To run your app, read [Run your app](../tutorial/quick-start.md#run-your-application).
## Destructuring assignment
As of 0.37, you can use

View File

@@ -130,6 +130,8 @@ This is necessary for events such as `NSUserDefaultsDidChangeNotification`.
* `userInfo` Record<String, unknown>
* `object` String
Returns `Number` - The ID of this subscription
Same as `subscribeNotification`, but uses `NSWorkspace.sharedWorkspace.notificationCenter`.
This is necessary for events such as `NSWorkspaceDidActivateApplicationNotification`.

View File

@@ -1,3 +1,5 @@
# TouchBar
## Class: TouchBar
> Create TouchBar layouts for native macOS applications

View File

@@ -1,3 +1,5 @@
# Tray
## Class: Tray
> Add icons and context menus to the system's notification area.

View File

@@ -914,7 +914,7 @@ in `webPreferences`.
* `httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer url.
* `userAgent` String (optional) - A user agent originating the request.
* `extraHeaders` String (optional) - Extra headers separated by "\n".
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md)) (optional)
* `postData` ([UploadRawData](structures/upload-raw-data.md) | [UploadFile](structures/upload-file.md))[] (optional)
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
Returns `Promise<void>` - the promise will resolve when the page has finished loading
@@ -1184,6 +1184,16 @@ Ignore application menu shortcuts while this web contents is focused.
* `url` String - The _resolved_ version of the URL passed to `window.open()`. e.g. opening a window with `window.open('foo')` will yield something like `https://the-origin/the/current/path/foo`.
* `frameName` String - Name of the window provided in `window.open()`
* `features` String - Comma separated list of window features provided to `window.open()`.
* `disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
`new-window`, `save-to-disk` or `other`.
* `referrer` [Referrer](structures/referrer.md) - The referrer that will be
passed to the new window. May or may not result in the `Referer` header being
sent, depending on the referrer policy.
* `postBody` [PostBody](structures/post-body.md) (optional) - The post data that
will be sent to the new window, along with the appropriate headers that will
be set. If no post data is to be sent, the value will be `null`. Only defined
when the window is being created by a form that set `target=_blank`.
Returns `{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}` - `deny` cancels the creation of the new
window. `allow` will allow the new window to be created. Specifying `overrideBrowserWindowOptions` allows customization of the created window.
Returning an unrecognized value such as a null, undefined, or an object
@@ -1320,8 +1330,7 @@ Inserts `text` to the focused element.
* `text` String - Content to be searched, must not be empty.
* `options` Object (optional)
* `forward` Boolean (optional) - Whether to search forward or backward, defaults to `true`.
* `findNext` Boolean (optional) - Whether the operation is first request or a follow up,
defaults to `false`.
* `findNext` Boolean (optional) - Whether to begin a new text finding session with this request. Should be `true` for initial requests, and `false` for follow-up requests. Defaults to `false`.
* `matchCase` Boolean (optional) - Whether search should be case-sensitive,
defaults to `false`.
@@ -1363,19 +1372,21 @@ Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
Returns `Boolean` - Whether this page is being captured. It returns true when the capturer count
is large then 0.
#### `contents.incrementCapturerCount([size, stayHidden])`
#### `contents.incrementCapturerCount([size, stayHidden, stayAwake])`
* `size` [Size](structures/size.md) (optional) - The preferred size for the capturer.
* `stayHidden` Boolean (optional) - Keep the page hidden instead of visible.
* `stayAwake` Boolean (optional) - Keep the system awake instead of allowing it to sleep.
Increase the capturer count by one. The page is considered visible when its browser window is
hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that `stayHidden` is set to true.
This also affects the Page Visibility API.
#### `contents.decrementCapturerCount([stayHidden])`
#### `contents.decrementCapturerCount([stayHidden, stayAwake])`
* `stayHidden` Boolean (optional) - Keep the page in hidden state instead of visible.
* `stayAwake` Boolean (optional) - Keep the system awake instead of allowing it to sleep.
Decrease the capturer count by one. The page will be set to hidden or occluded state when its
browser window is hidden or occluded and the capturer count reaches zero. If you want to

View File

@@ -5,7 +5,7 @@
Electron's `webview` tag is based on [Chromium's `webview`][chrome-webview], which
is undergoing dramatic architectural changes. This impacts the stability of `webviews`,
including rendering, navigation, and event routing. We currently recommend to not
use the `webview` tag and to consider alternatives, like `iframe`, Electron's `BrowserView`,
use the `webview` tag and to consider alternatives, like `iframe`, [Electron's `BrowserView`](browser-view.md),
or an architecture that avoids embedded content altogether.
## Enabling
@@ -274,7 +274,7 @@ webview.addEventListener('dom-ready', () => {
* `httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer url.
* `userAgent` String (optional) - A user agent originating the request.
* `extraHeaders` String (optional) - Extra headers separated by "\n"
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md)) (optional)
* `postData` ([UploadRawData](structures/upload-raw-data.md) | [UploadFile](structures/upload-file.md))[] (optional)
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
Returns `Promise<void>` - The promise will resolve when the page has finished loading
@@ -515,8 +515,7 @@ Inserts `text` to the focused element.
* `text` String - Content to be searched, must not be empty.
* `options` Object (optional)
* `forward` Boolean (optional) - Whether to search forward or backward, defaults to `true`.
* `findNext` Boolean (optional) - Whether the operation is first request or a follow up,
defaults to `false`.
* `findNext` Boolean (optional) - Whether to begin a new text finding session with this request. Should be `true` for initial requests, and `false` for follow-up requests. Defaults to `false`.
* `matchCase` Boolean (optional) - Whether search should be case-sensitive,
defaults to `false`.

View File

@@ -83,9 +83,9 @@ const mainWindow = new BrowserWindow()
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (url.startsWith('https://github.com/')) {
return true
return { action: 'allow' }
}
return false
return { action: 'deny' }
})
mainWindow.webContents.on('did-create-window', (childWindow) => {

View File

@@ -136,6 +136,22 @@ systemPreferences.isHighContrastColorScheme()
nativeTheme.shouldUseHighContrastColors
```
### Deprecated: WebContents `new-window` event
The `new-window` event of WebContents has been deprecated. It is replaced by [`webContents.setWindowOpenHandler()`](api/web-contents.md#contentssetwindowopenhandlerhandler).
```js
// Deprecated in Electron 13
webContents.on('new-window', (event) => {
event.preventDefault()
})
// Replace with
webContents.setWindowOpenHandler((details) => {
return { action: 'deny' }
})
```
## Planned Breaking API Changes (12.0)
### Removed: Pepper Flash support
@@ -160,6 +176,9 @@ the previous behavior, `contextIsolation: false` must be specified in WebPrefere
We [recommend having contextIsolation enabled](https://github.com/electron/electron/blob/master/docs/tutorial/security.md#3-enable-context-isolation-for-remote-content) for the security of your application.
Another implication is that `require()` cannot be used in the renderer process unless
`nodeIntegration` is `true` and `contextIsolation` is `false`.
For more details see: https://github.com/electron/electron/issues/23506
### Removed: `crashReporter.getCrashesDirectory()`

View File

@@ -1,6 +1,8 @@
# Build Instructions
Follow the guidelines below for building Electron.
Follow the guidelines below for building **Electron itself**, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the [application distribution][application-distribution] guide.
[application-distribution]: ../tutorial/application-distribution.md
## Platform prerequisites

View File

@@ -1,6 +1,8 @@
# Build Instructions (Linux)
Follow the guidelines below for building Electron on Linux.
Follow the guidelines below for building **Electron itself** on Linux, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the [application distribution][application-distribution] guide.
[application-distribution]: ../tutorial/application-distribution.md
## Prerequisites

View File

@@ -1,6 +1,8 @@
# Build Instructions (macOS)
Follow the guidelines below for building Electron on macOS.
Follow the guidelines below for building **Electron itself** on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the [application distribution][application-distribution] guide.
[application-distribution]: ../tutorial/application-distribution.md
## Prerequisites

View File

@@ -1,6 +1,8 @@
# Build Instructions (Windows)
Follow the guidelines below for building Electron on Windows.
Follow the guidelines below for building **Electron itself** on Windows, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the [application distribution][application-distribution] guide.
[application-distribution]: ../tutorial/application-distribution.md
## Prerequisites

View File

@@ -33,8 +33,7 @@ contributing, and more. Please use the issue tracker for bugs only!
To submit a bug report:
When opening a new issue in the [`electron/electron` issue tracker](https://github.com/electron/electron/issues/new/choose), users
will be presented with [a template](https://github.com/electron/electron/blob/master/.github/ISSUE_TEMPLATE/Bug_report.md)
that should be filled in.
will be presented with a template that should be filled in.
If you believe that you have found a bug in Electron, please fill out the template
to the best of your ability.

View File

@@ -100,7 +100,5 @@ script/ - The set of all scripts Electron runs for a variety of purposes.
└── uploaders/ - Uploads various release-related files during release.
```
* **tools** - Helper scripts used by GN files.
* Scripts put here should never be invoked by users directly, unlike those in `script`.
* **typings** - TypeScript typings for Electron's internal code.
* **vendor** - Source code for some third party dependencies.

View File

@@ -7,12 +7,9 @@
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<a href="#" id="drag">Drag me</a>
<p>Drag the boxes below to somewhere in your OS (Finder/Explorer, Desktop, etc.) to copy an example markdown file.</p>
<div style="border:2px solid black;border-radius:3px;padding:5px;display:inline-block" draggable="true" id="drag1">Drag me - File 1</div>
<div style="border:2px solid black;border-radius:3px;padding:5px;display:inline-block" draggable="true" id="drag2">Drag me - File 2</div>
<script src="renderer.js"></script>
</body>
</html>

View File

@@ -1,21 +1,28 @@
const { app, BrowserWindow, ipcMain, nativeImage, NativeImage } = require('electron')
const fs = require('fs');
const http = require('http');
const path = require('path')
const fs = require('fs')
const https = require('https')
function createWindow () {
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
preload: path.join(__dirname, 'preload.js')
}
})
win.loadFile('index.html')
}
const iconName = 'iconForDragAndDrop.png';
const icon = fs.createWriteStream(`${process.cwd()}/${iconName}`);
http.get('http://img.icons8.com/ios/452/drag-and-drop.png', (response) => {
const iconName = path.join(__dirname, 'iconForDragAndDrop.png');
const icon = fs.createWriteStream(iconName);
// Create a new file to copy - you can also copy existing files.
fs.writeFileSync(path.join(__dirname, 'drag-and-drop-1.md'), '# First file to test drag and drop')
fs.writeFileSync(path.join(__dirname, 'drag-and-drop-2.md'), '# Second file to test drag and drop')
https.get('https://img.icons8.com/ios/452/drag-and-drop.png', (response) => {
response.pipe(icon);
});
@@ -23,8 +30,8 @@ app.whenReady().then(createWindow)
ipcMain.on('ondragstart', (event, filePath) => {
event.sender.startDrag({
file: filePath,
icon: `${process.cwd()}/${iconName}`
file: path.join(__dirname, filePath),
icon: iconName,
})
})

View File

@@ -0,0 +1,8 @@
const { contextBridge, ipcRenderer } = require('electron')
const path = require('path')
contextBridge.exposeInMainWorld('electron', {
startDrag: (fileName) => {
ipcRenderer.send('ondragstart', fileName)
}
})

View File

@@ -1,9 +1,9 @@
const { ipcRenderer } = require('electron')
const fs = require('fs')
document.getElementById('drag').ondragstart = (event) => {
const fileName = 'drag-and-drop.md'
fs.writeFileSync(fileName, '# Test drag and drop');
document.getElementById('drag1').ondragstart = (event) => {
event.preventDefault()
ipcRenderer.send('ondragstart', process.cwd() + `/${fileName}`)
window.electron.startDrag('drag-and-drop-1.md')
}
document.getElementById('drag2').ondragstart = (event) => {
event.preventDefault()
window.electron.startDrag('drag-and-drop-2.md')
}

View File

@@ -7,10 +7,6 @@
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<p>Hit Alt+Ctrl+I on Windows or Opt+Cmd+I on Mac to see a message printed to the console.</p>
</body>
</html>

View File

@@ -4,9 +4,6 @@ function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')

View File

@@ -7,8 +7,6 @@
</head>
<body>
<h1>Hello World!</h1>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
<p>Hit Ctrl+I to see a message printed to the console.</p>
</body>
</html>

View File

@@ -1,7 +1,7 @@
const { app, BrowserWindow } = require('electron')
app.whenReady().then(() => {
const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } })
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadFile('index.html')
win.webContents.on('before-input-event', (event, input) => {

View File

@@ -7,10 +7,6 @@
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<p>Hit Alt+Shift+I on Windows, or Opt+Cmd+I on mac to see a message printed to the console.</p>
</body>
</html>

View File

@@ -4,9 +4,6 @@ function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<p>Hit any key with this window focused to see it captured here.</p>
<div><span>Last Key Pressed: </span><span id="last-keypress"></span></div>
<script src="./renderer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,35 @@
// Modules to control application life and create native browser window
const {app, BrowserWindow} = require('electron')
const path = require('path')
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})

View File

@@ -0,0 +1,7 @@
function handleKeyPress (event) {
// You can put code here to handle the keypress.
document.getElementById("last-keypress").innerText = event.key
console.log(`You pressed ${event.key}`)
}
window.addEventListener('keyup', handleKeyPress, true)

View File

@@ -1,11 +1,12 @@
const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron')
const path = require('path')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
preload: path.join(__dirname, 'preload.js')
}
})
@@ -25,16 +26,18 @@ function createWindow () {
})
}
app.whenReady().then(createWindow)
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,6 @@
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('darkMode', {
toggle: () => ipcRenderer.invoke('dark-mode:toggle'),
system: () => ipcRenderer.invoke('dark-mode:system')
})

View File

@@ -1,11 +1,9 @@
const { ipcRenderer } = require('electron')
document.getElementById('toggle-dark-mode').addEventListener('click', async () => {
const isDarkMode = await ipcRenderer.invoke('dark-mode:toggle')
const isDarkMode = await window.darkMode.toggle()
document.getElementById('theme-source').innerHTML = isDarkMode ? 'Dark' : 'Light'
})
document.getElementById('reset-to-system').addEventListener('click', async () => {
await ipcRenderer.invoke('dark-mode:system')
await window.darkMode.system()
document.getElementById('theme-source').innerHTML = 'System'
})

View File

@@ -7,10 +7,6 @@
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<p>Right click the dock icon to see the custom menu options.</p>
</body>
</html>

View File

@@ -4,9 +4,6 @@ function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
@@ -27,7 +24,9 @@ const dockMenu = Menu.buildFromTemplate([
])
app.whenReady().then(() => {
app.dock.setMenu(dockMenu)
if (process.platform === 'darwin') {
app.dock.setMenu(dockMenu)
}
}).then(createWindow)
app.on('window-all-closed', () => {

View File

@@ -1,15 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
</body>
</html>

View File

@@ -1,5 +1,6 @@
const { app, BrowserWindow } = require('electron')
const fs = require('fs')
const path = require('path')
app.disableHardwareAcceleration()
@@ -12,7 +13,7 @@ app.whenReady().then(() => {
fs.writeFileSync('ex.png', image.toPNG())
})
win.webContents.setFrameRate(60)
console.log(`The screenshot has been successfully saved to ${process.cwd()}/ex.png`)
console.log(`The screenshot has been successfully saved to ${path.join(process.cwd(), 'ex.png')}`)
})
app.on('window-all-closed', () => {

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Connection status: <strong id='status'></strong></h1>
<script src="renderer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,26 @@
const { app, BrowserWindow } = require('electron')
function createWindow () {
const onlineStatusWindow = new BrowserWindow({
width: 300,
height: 200
})
onlineStatusWindow.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})

View File

@@ -1,17 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<script src="renderer.js"></script>
</body>
</html>

View File

@@ -1,24 +0,0 @@
const { app, BrowserWindow, ipcMain } = require('electron')
let onlineStatusWindow
app.whenReady().then(() => {
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false, webPreferences: { nodeIntegration: true } })
onlineStatusWindow.loadURL(`file://${__dirname}/index.html`)
})
ipcMain.on('online-status-changed', (event, status) => {
console.log(status)
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -1,7 +0,0 @@
const { ipcRenderer } = require('electron')
const updateOnlineStatus = () => { ipcRenderer.send('online-status-changed', navigator.onLine ? 'online' : 'offline') }
window.addEventListener('online', updateOnlineStatus)
window.addEventListener('offline', updateOnlineStatus)
updateOnlineStatus()

View File

@@ -0,0 +1,8 @@
function onlineStatusIndicator () {
document.getElementById('status').innerHTML = navigator.onLine ? 'online' : 'offline'
}
window.addEventListener('online', onlineStatusIndicator)
window.addEventListener('offline', onlineStatusIndicator)
onlineStatusIndicator()

View File

@@ -1,17 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<script src="renderer.js"></script>
</body>
</html>

View File

@@ -1,20 +0,0 @@
const { app, BrowserWindow } = require('electron')
let onlineStatusWindow
app.whenReady().then(() => {
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false })
onlineStatusWindow.loadURL(`file://${__dirname}/index.html`)
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -1,6 +0,0 @@
const alertOnlineStatus = () => { window.alert(navigator.onLine ? 'online' : 'offline') }
window.addEventListener('online', alertOnlineStatus)
window.addEventListener('offline', alertOnlineStatus)
alertOnlineStatus()

View File

@@ -8,9 +8,9 @@
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
We are using Node.js <span id="node-version"></span>,
Chromium <span id="chrome-version"></span>,
and Electron <span id="electron-version"></span>.
</p>
</body>
</html>

View File

@@ -1,18 +1,27 @@
const { app, BrowserWindow } = require('electron')
const path = require('path')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
preload: path.join(__dirname, 'preload.js')
}
})
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
@@ -20,8 +29,3 @@ app.on('window-all-closed', () => {
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,11 @@
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector)
if (element) element.innerText = text
}
for (const type of ['chrome', 'node', 'electron']) {
replaceText(`${type}-version`, process.versions[type])
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -2,15 +2,14 @@
These are the guidelines for writing Electron documentation.
## Titles
## Headings
* Each page must have a single `#`-level title at the top.
* Chapters in the same page must have `##`-level titles.
* Sub-chapters need to increase the number of `#` in the title according to
* Chapters in the same page must have `##`-level headings.
* Sub-chapters need to increase the number of `#` in the heading according to
their nesting depth.
* All words in the page's title must be capitalized, except for conjunctions
like "of" and "and" .
* Only the first word of a chapter title must be capitalized.
* The page's title must follow [APA title case][title-case].
* All chapters must follow [APA sentence case][sentence-case].
Using `Quick Start` as example:
@@ -44,12 +43,20 @@ For API references, there are exceptions to this rule.
## Markdown rules
This repository uses the [`markdownlint`][markdownlint] package to enforce consistent
Markdown styling. For the exact rules, see the `.markdownlint.json` file in the root
folder.
There are a few style guidelines that aren't covered by the linter rules:
<!--TODO(erickzhao): make sure this matches with the lint:markdownlint task-->
* Use `sh` instead of `cmd` in code blocks (due to the syntax highlighter).
* Lines should be wrapped at 80 columns.
* Keep line lengths between 80 and 100 characters if possible for readability
purposes.
* No nesting lists more than 2 levels (due to the markdown renderer).
* All `js` and `javascript` code blocks are linted with
[standard-markdown](https://www.npmjs.com/package/standard-markdown).
* For unordered lists, use asterisks instead of dashes
* For unordered lists, use asterisks instead of dashes.
## Picking words
@@ -60,14 +67,15 @@ For API references, there are exceptions to this rule.
The following rules only apply to the documentation of APIs.
### Page title
### Title and description
Each page must use the actual object name returned by `require('electron')`
as the title, such as `BrowserWindow`, `autoUpdater`, and `session`.
Each module's API doc must use the actual object name returned by `require('electron')`
as its title (such as `BrowserWindow`, `autoUpdater`, and `session`).
Under the page title must be a one-line description starting with `>`.
Directly under the page title, add a one-line description of the module
as a markdown quote (beginning with `>`).
Using `session` as example:
Using the `session` module as an example:
```markdown
# session
@@ -99,14 +107,19 @@ Using `autoUpdater` as an example:
* API classes or classes that are part of modules must be listed under a
`## Class: TheClassName` chapter.
* One page can have multiple classes.
* Constructors must be listed with `###`-level titles.
* [Static Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static) must be listed under a `### Static Methods` chapter.
* [Instance Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods) must be listed under an `### Instance Methods` chapter.
* All methods that have a return value must start their description with "Returns `[TYPE]` - Return description"
* If the method returns an `Object`, its structure can be specified using a colon followed by a newline then an unordered list of properties in the same style as function parameters.
* Constructors must be listed with `###`-level headings.
* [Static Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static)
must be listed under a `### Static Methods` chapter.
* [Instance Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods)
must be listed under an `### Instance Methods` chapter.
* All methods that have a return value must start their description with
"Returns `[TYPE]` - [Return description]"
* If the method returns an `Object`, its structure can be specified using a colon
followed by a newline then an unordered list of properties in the same style as
function parameters.
* Instance Events must be listed under an `### Instance Events` chapter.
* Instance Properties must be listed under an `### Instance Properties` chapter.
* Instance properties must start with "A [Property Type] ..."
* Instance Properties must start with "A [Property Type] ..."
Using the `Session` and `Cookies` classes as an example:
@@ -142,7 +155,7 @@ Using the `Session` and `Cookies` classes as an example:
#### `cookies.get(filter, callback)`
```
### Methods
### Methods and their arguments
The methods chapter must be in the following form:
@@ -155,8 +168,12 @@ The methods chapter must be in the following form:
...
```
The title can be `###` or `####`-levels depending on whether it is a method of
a module or a class.
#### Heading level
The heading can be `###` or `####`-levels depending on whether the method
belongs to a module or a class.
#### Function signature
For modules, the `objectName` is the module's name. For classes, it must be the
name of the instance of the class, and must not be the same as the module's
@@ -165,23 +182,33 @@ name.
For example, the methods of the `Session` class under the `session` module must
use `ses` as the `objectName`.
The optional arguments are notated by square brackets `[]` surrounding the optional argument
as well as the comma required if this optional argument follows another
Optional arguments are notated by square brackets `[]` surrounding the optional
argument as well as the comma required if this optional argument follows another
argument:
```sh
```markdown
required[, optional]
```
Below the method is more detailed information on each of the arguments. The type
of argument is notated by either the common types:
#### Argument descriptions
* [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
* [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)
* [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
* [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)
* [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
* Or a custom type like Electron's [`WebContent`](api/web-contents.md)
More detailed information on each of the arguments is noted in an unordered list
below the method. The type of argument is notated by either JavaScript primitives
(e.g. `String`, `Promise`, or `Object`), a custom API structure like Electron's
[`Cookie`](api/structures/cookie.md), or the wildcard `any`.
If the argument is of type `Array`, use `[]` shorthand with the type of value
inside the array (for example,`any[]` or `String[]`).
If the argument is of type `Promise`, parametrize the type with what the promise
resolves to (for example, `Promise<void>` or `Promise<String>`).
If an argument can be of multiple types, separate the types with `|`.
The description for `Function` type arguments should make it clear how it may be
called and list the types of the parameters that will be passed to it.
#### Platform-specific functionality
If an argument or a method is unique to certain platforms, those platforms are
denoted using a space-delimited italicized list following the datatype. Values
@@ -191,12 +218,6 @@ can be `macOS`, `Windows` or `Linux`.
* `animate` Boolean (optional) _macOS_ _Windows_ - Animate the thing.
```
`Array` type arguments must specify what elements the array may include in
the description below.
The description for `Function` type arguments should make it clear how it may be
called and list the types of the parameters that will be passed to it.
### Events
The events chapter must be in following form:
@@ -211,8 +232,8 @@ Returns:
...
```
The title can be `###` or `####`-levels depending on whether it is an event of
a module or a class.
The heading can be `###` or `####`-levels depending on whether the event
belongs to a module or a class.
The arguments of an event follow the same rules as methods.
@@ -226,9 +247,13 @@ The properties chapter must be in following form:
...
```
The title can be `###` or `####`-levels depending on whether it is a property of
a module or a class.
The heading can be `###` or `####`-levels depending on whether the property
belongs to a module or a class.
## Documentation Translations
## Documentation translations
See [electron/i18n](https://github.com/electron/i18n#readme)
[title-case]: https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case
[sentence-case]: https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case
[markdownlint]: https://github.com/DavidAnson/markdownlint

View File

@@ -18,7 +18,7 @@ distributable Electron application, such as bundling your application,
rebranding the executable, and setting the right icons.
You can check the example of how to package your app with `electron-forge` in
our [Quick Start Guide](quick-start.md#package-and-distribute-the-application).
the [Quick Start guide](quick-start.md#package-and-distribute-your-application).
## Manual distribution

View File

@@ -47,18 +47,18 @@ of this theming, due to the use of the macOS 10.14 SDK.
## Example
We'll start with a working application from the
[Quick Start Guide](quick-start.md) and add functionality gradually.
This example demonstrates an Electron application that derives its theme colors from the
`nativeTheme`. Additionally, it provides theme toggle and reset controls using IPC channels.
First, let's edit our interface so users can toggle between light and dark
modes. This basic UI contains buttons to change the `nativeTheme.themeSource`
setting and a text element indicating which `themeSource` value is selected.
By default, Electron follows the system's dark mode preference, so we
will hardcode the theme source as "System".
```javascript fiddle='docs/fiddles/features/macos-dark-mode'
Add the following lines to the `index.html` file:
```
```html
### How does this work?
Starting with the `index.html` file:
```html title='index.html'
<!DOCTYPE html>
<html>
<head>
@@ -80,65 +80,70 @@ Add the following lines to the `index.html` file:
</html>
```
Next, add [event listeners](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)
that listen for `click` events on the toggle buttons. Because the `nativeTheme`
module only exposed in the Main process, you need to set up each listener's
callback to use IPC to send messages to and handle responses from the Main
process:
And the `style.css` file:
* when the "Toggle Dark Mode" button is clicked, we send the
`dark-mode:toggle` message (event) to tell the Main process to trigger a theme
change, and update the "Current Theme Source" label in the UI based on the
response from the Main process.
* when the "Reset to System Theme" button is clicked, we send the
`dark-mode:system` message (event) to tell the Main process to use the system
color scheme, and update the "Current Theme Source" label to `System`.
```css title='style.css'
@media (prefers-color-scheme: dark) {
body { background: #333; color: white; }
}
To add listeners and handlers, add the following lines to the `renderer.js` file:
@media (prefers-color-scheme: light) {
body { background: #ddd; color: black; }
}
```
```javascript
const { ipcRenderer } = require('electron')
The example renders an HTML page with a couple elements. The `<strong id="theme-source">`
element shows which theme is currently selected, and the two `<button>` elements are the
controls. The CSS file uses the [`prefers-color-scheme`][prefers-color-scheme] media query
to set the `<body>` element background and text colors.
The `preload.js` script adds a new API to the `window` object called `darkMode`. This API
exposes two IPC channels to the renderer process, `'dark-mode:toggle'` and `'dark-mode:system'`.
It also assigns two methods, `toggle` and `system`, which pass messages from the renderer to the
main process.
```js title='preload.js'
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('darkMode', {
toggle: () => ipcRenderer.invoke('dark-mode:toggle'),
system: () => ipcRenderer.invoke('dark-mode:system')
})
```
Now the renderer process can communicate with the main process securely and perform the necessary
mutations to the `nativeTheme` object.
The `renderer.js` file is responsible for controlling the `<button>` functionality.
```js title='renderer.js'
document.getElementById('toggle-dark-mode').addEventListener('click', async () => {
const isDarkMode = await ipcRenderer.invoke('dark-mode:toggle')
const isDarkMode = await window.darkMode.toggle()
document.getElementById('theme-source').innerHTML = isDarkMode ? 'Dark' : 'Light'
})
document.getElementById('reset-to-system').addEventListener('click', async () => {
await ipcRenderer.invoke('dark-mode:system')
await window.darkMode.system()
document.getElementById('theme-source').innerHTML = 'System'
})
```
If you run your code at this point, you'll see that your buttons don't do
anything just yet, and your Main process will output an error like this when
you click on your buttons:
`Error occurred in handler for 'dark-mode:toggle': No handler registered for 'dark-mode:toggle'`
This is expected — we haven't actually touched any `nativeTheme` code yet.
Using `addEventListener`, the `renderer.js` file adds `'click'` [event listeners][event-listeners]
to each button element. Each event listener handler makes calls to the respective `window.darkMode`
API methods.
Now that we're done wiring the IPC from the Renderer's side, the next step
is to update the `main.js` file to handle events from the Renderer process.
Finally, the `main.js` file represents the main process and contains the actual `nativeTheme` API.
Depending on the received event, we update the
[`nativeTheme.themeSource`](../api/native-theme.md#nativethemethemesource)
property to apply the desired theme on the system's native UI elements
(e.g. context menus) and propagate the preferred color scheme to the Renderer
process:
* Upon receiving `dark-mode:toggle`, we check if the dark theme is currently
active using the `nativeTheme.shouldUseDarkColors` property, and set the
`themeSource` to the opposite theme.
* Upon receiving `dark-mode:system`, we reset the `themeSource` to `system`.
```javascript
```js
const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron')
const path = require('path')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
preload: path.join(__dirname, 'preload.js')
}
})
@@ -154,44 +159,41 @@ function createWindow () {
})
ipcMain.handle('dark-mode:system', () => {
nativeTheme.themeSource = 'system'
nativeTheme.themeSouce = 'system'
})
}
app.whenReady().then(createWindow)
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
```
The final step is to add a bit of styling to enable dark mode for the web parts
of the UI by leveraging the [`prefers-color-scheme`][prefer-color-scheme] CSS
attribute. The value of `prefers-color-scheme` will follow your
`nativeTheme.themeSource` setting.
The `ipcMain.handle` methods are how the main process responds to the click events from the buttons
on the HTML page.
Create a `styles.css` file and add the following lines:
The `'dark-mode:toggle'` IPC channel handler method checks the `shouldUseDarkColors` boolean property,
sets the corresponding `themeSource`, and then returns the current `shouldUseDarkColors` property.
Looking back on the renderer process event listener for this IPC channel, the return value from this
handler is utilized to assign the correct text to the `<strong id='theme-source'>` element.
```css fiddle='docs/fiddles/features/macos-dark-mode'
@media (prefers-color-scheme: dark) {
body { background: #333; color: white; }
}
The `'dark-mode:system'` IPC channel handler method assigns the string `'system'` to the `themeSource`
and returns nothing. This also corresponds with the relative renderer process event listener as the
method is awaited with no return value expected.
@media (prefers-color-scheme: light) {
body { background: #ddd; color: black; }
}
```
After launching the Electron application, you can change modes or reset the
theme to system default by clicking corresponding buttons:
Run the example using Electron Fiddle and then click the "Toggle Dark Mode" button; the app should
start alternating between a light and dark background color.
![Dark Mode](../images/dark_mode.gif)
@@ -199,4 +201,5 @@ theme to system default by clicking corresponding buttons:
[electron-forge]: https://www.electronforge.io/
[electron-packager]: https://github.com/electron/electron-packager
[packager-darwindarkmode-api]: https://electron.github.io/electron-packager/master/interfaces/electronpackager.options.html#darwindarkmodesupport
[prefer-color-scheme]: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
[prefers-color-scheme]: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
[event-listeners]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

View File

@@ -11,14 +11,19 @@ npm install electron --save-dev
See the [Electron versioning doc][versioning] for info on how to
manage Electron versions in your apps.
## Global Installation
## Running Electron ad-hoc
You can also install the `electron` command globally in your `$PATH`:
If you're in a pinch and would prefer to not use `npm install` in your local
project, you can also run Electron ad-hoc using the [`npx`][npx] command runner
bundled with `npm`:
```sh
npm install electron -g
npx electron .
```
The above command will run the current working directory with Electron. Note that
any dependencies in your app will not be installed.
## Customization
If you want to change the architecture that is downloaded (e.g., `ia32` on an
@@ -178,6 +183,7 @@ If you need to force a re-download of the asset and the SHASUM file set the
[npm]: https://docs.npmjs.com
[versioning]: ./electron-versioning.md
[npx]: https://docs.npmjs.com/cli/v7/commands/npx
[releases]: https://github.com/electron/electron/releases
[proxy-env-10]: https://github.com/gajus/global-agent/blob/v2.1.5/README.md#environment-variables
[proxy-env]: https://github.com/np-maintain/global-tunnel/blob/v2.7.1/README.md#auto-config

View File

@@ -0,0 +1,59 @@
# Introduction
Welcome to the Electron documentation! If this is your first time developing
an Electron app, read through this Getting Started section to get familiar with the
basics. Otherwise, feel free to explore our guides and API documentation!
## What is Electron?
Electron is a framework for building desktop applications using JavaScript,
HTML, and CSS. By embedding [Chromium][chromium] and [Node.js][node] into its
binary, Electron allows you to maintain one JavaScript codebase and create
cross-platform apps that work on Windows, macOS, and Linux — no native development
experience required.
## Prerequisites
These docs operate under the assumption that the reader is familiar with both
Node.js and general web development. If you need to get more comfortable with
either of these areas, we recommend the following resources:
* [Getting started with the Web (MDN)][mdn-guide]
* [Introduction to Node.js][node-guide]
Moreover, you'll have a better time understanding how Electron works if you get
acquainted with Chromium's process model. You can get a brief overview of
Chrome architecture with the [Chrome comic][comic], which was released alongside
Chrome's launch back in 2008. Although it's been over a decade since then, the
core principles introduced in the comic remain helpful to understand Electron.
## Running examples with Electron Fiddle
[Electron Fiddle][fiddle] is a sandbox app written with Electron and supported by
Electron's maintainers. We highly recommend installing it as a learning tool to
experiment with Electron's APIs or to prototype features during development.
Fiddle also integrates nicely with our documentation. When browsing through examples
in our tutorials, you'll frequently see an "Open in Electron Fiddle" button underneath
a code block. If you have Fiddle installed, this button will open a
`fiddle.electronjs.org` link that will automatically load the example into Fiddle,
no copy-pasting required.
## Getting help
Are you getting stuck anywhere? Here are a few links to places to look:
* If you need help with developing your app, our [community Discord server][discord]
is a great place to get advice from other Electron app developers.
* If you suspect you're running into a bug with the `electron` package, please check
the [GitHub issue tracker][issue-tracker] to see if any existing issues match your
problem. If not, feel free to fill out our bug report template and submit a new issue.
[chromium](https://www.chromium.org/)
[node](https://nodejs.org/)
[mdn-guide](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web)
[node-guide](https://nodejs.dev/learn)
[comic](https://www.google.com/googlebooks/chrome/)
[fiddle](https://electronjs.org/fiddle)
[issue-tracker](https://github.com/electron/electron/issues)
[discord](https://discord.gg/electron)

View File

@@ -81,11 +81,17 @@ If you want to handle keyboard shortcuts within a [BrowserWindow], you can
listen for the `keyup` and `keydown` [DOM events][dom-events] inside the
renderer process using the [addEventListener() API][addEventListener-api].
```js
window.addEventListener('keyup', doSomething, true)
```javascript fiddle='docs/fiddles/features/keyboard-shortcuts/web-apis|focus=renderer.js'
function handleKeyPress(event) {
// You can put code here to handle the keypress.
document.getElementById("last-keypress").innerText = event.key;
console.log(`You pressed ${event.key}`);
}
window.addEventListener('keyup', handleKeyPress, true);
```
Note the third parameter `true` indicates that the listener will always receive
> Note: the third parameter `true` indicates that the listener will always receive
key presses before other listeners so they can't have `stopPropagation()`
called on them.
@@ -95,8 +101,6 @@ The [`before-input-event`](../api/web-contents.md#event-before-input-event) even
is emitted before dispatching `keydown` and `keyup` events in the page. It can
be used to catch and handle custom shortcuts that are not visible in the menu.
##### Example
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` file with the
following lines:
@@ -105,7 +109,7 @@ following lines:
const { app, BrowserWindow } = require('electron')
app.whenReady().then(() => {
const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } })
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadFile('index.html')
win.webContents.on('before-input-event', (event, input) => {

View File

@@ -1,53 +1,111 @@
# Mac App Store Submission Guide
Since v0.34.0, Electron allows submitting packaged apps to the Mac App Store
(MAS). This guide provides information on: how to submit your app and the
limitations of the MAS build.
This guide provides information on:
**Note:** Submitting an app to Mac App Store requires enrolling in the [Apple Developer
Program][developer-program], which costs money.
* How to sign Electron apps on macOS;
* How to submit Electron apps to Mac App Store (MAS);
* The limitations of the MAS build.
## How to Submit Your App
## Requirements
The following steps introduce a simple way to submit your app to Mac App Store.
However, these steps do not ensure your app will be approved by Apple; you
still need to read Apple's [Submitting Your App][submitting-your-app] guide on
how to meet the Mac App Store requirements.
To sign Electron apps, the following tools must be installed first:
### Get Certificate
* Xcode 11 or above.
* The [electron-osx-sign][electron-osx-sign] npm module.
To submit your app to the Mac App Store, you first must get a certificate from
Apple. You can follow these [existing guides][nwjs-guide] on web.
You also have to register an Apple Developer account and join the
[Apple Developer Program][developer-program].
### Get Team ID
## Sign Electron apps
Before signing your app, you need to know the Team ID of your account. To locate
your Team ID, Sign in to [Apple Developer Center](https://developer.apple.com/account/),
and click Membership in the sidebar. Your Team ID appears in the Membership
Information section under the team name.
Electron apps can be distributed through Mac App Store or outside it. Each way
requires different ways of signing and testing. This guide focuses on
distribution via Mac App Store, but will also mention other methods.
### Sign Your App
The following steps describe how to get the certificates from Apple, how to sign
Electron apps, and how to test them.
After finishing the preparation work, you can package your app by following
[Application Distribution](application-distribution.md), and then proceed to
signing your app.
### Get certificates
First, you have to add a `ElectronTeamID` key to your app's `Info.plist`, which
has your Team ID as its value:
The simplest way to get signing certificates is to use Xcode:
```xml
<plist version="1.0">
<dict>
...
<key>ElectronTeamID</key>
<string>TEAM_ID</string>
</dict>
</plist>
```
1. Open Xcode and open "Accounts" preferences;
2. Sign in with your Apple account;
3. Select a team and click "Manage Certificates";
4. In the lower-left corner of the signing certificates sheet, click the Add
button (+), and add following certificates:
* "Apple Development"
* "Apple Distribution"
Then, you need to prepare three entitlements files.
The "Apple Development" certificate is used to sign apps for development and
testing, on machines that have been registered on Apple Developer website. The
method of registration will be described in
[Prepare provisioning profile](#prepare-provisioning-profile).
`child.plist`:
Apps signed with the "Apple Development" certificate cannot be submitted to Mac
App Store. For that purpose, apps must be signed with the "Apple Distribution"
certificate instead. But note that apps signed with the "Apple Distribution"
certificate cannot run directly, they must be re-signed by Apple to be able to
run, which will only be possible after being downloaded from the Mac App Store.
#### Other certificates
You may notice that there are also other kinds of certificates.
The "Developer ID Application" certificate is used to sign apps before
distributing them outside the Mac App Store.
The "Developer ID Installer" and "Mac Installer Distribution" certificates are
used to sign the Mac Installer Package instead of the app itself. Most Electron
apps do not use Mac Installer Package so they are generally not needed.
The full list of certificate types can be found
[here](https://help.apple.com/xcode/mac/current/#/dev80c6204ec).
Apps signed with "Apple Development" and "Apple Distribution" certificates can
only run under [App Sandbox][app-sandboxing], so they must use the MAS build of
Electron. However, the "Developer ID Application" certificate does not have this
restrictions, so apps signed with it can use either the normal build or the MAS
build of Electron.
#### Legacy certificate names
Apple has been changing the names of certificates during past years, you might
encounter them when reading old documentations, and some utilities are still
using one of the old names.
* The "Apple Distribution" certificate was also named as "3rd Party Mac
Developer Application" and "Mac App Distribution".
* The "Apple Development" certificate was also named as "Mac Developer" and
"Development".
### Prepare provisioning profile
If you want to test your app on your local machine before submitting your app to
the Mac App Store, you have to sign the app with the "Apple Development"
certificate with the provisioning profile embedded in the app bundle.
To [create a provisioning profile](https://help.apple.com/developer-account/#/devf2eb157f8),
you can follow the below steps:
1. Open the "Certificates, Identifiers & Profiles" page on the
[Apple Developer](https://developer.apple.com/account) website.
2. Add a new App ID for your app in the "Identifiers" page.
3. Register your local machine in the "Devices" page. You can find your
machine's "Device ID" in the "Hardware" page of the "System Information" app.
4. Register a new Provisioning Profile in the "Profiles" page, and download it
to `/path/to/yourapp.provisionprofile`.
### Enable Apple's App Sandbox
Apps submitted to the Mac App Store must run under Apple's
[App Sandbox][app-sandboxing], and only the MAS build of Electron can run with
the App Sandbox. The standard darwin build of Electron will fail to launch
when run under App Sandbox.
When signing the app with `electron-osx-sign`, it will automatically add the
necessary entitlements to your app's entitlements, but if you are using custom
entitlements, you must ensure App Sandbox capacity is added:
```xml
<?xml version="1.0" encoding="UTF-8"?>
@@ -56,13 +114,14 @@ Then, you need to prepare three entitlements files.
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
</dict>
</plist>
```
`parent.plist`:
#### Extra steps without `electron-osx-sign`
If you are signing your app without using `electron-osx-sign`, you must ensure
the app bundle's entitlements have at least following keys:
```xml
<?xml version="1.0" encoding="UTF-8"?>
@@ -79,7 +138,11 @@ Then, you need to prepare three entitlements files.
</plist>
```
`loginhelper.plist`:
The `TEAM_ID` should be replaced with your Apple Developer account's Team ID,
and the `your.bundle.id` should be replaced with the App ID of the app.
And the following entitlements must be added to the binaries and helpers in
the app's bundle:
```xml
<?xml version="1.0" encoding="UTF-8"?>
@@ -88,80 +151,97 @@ Then, you need to prepare three entitlements files.
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
</dict>
</plist>
```
You have to replace `TEAM_ID` with your Team ID, and replace `your.bundle.id`
with the Bundle ID of your app.
And the app bundle's `Info.plist` must include `ElectronTeamID` key, which has
your Apple Developer account's Team ID as its value:
And then sign your app with the following script:
```sh
#!/bin/bash
# Name of your app.
APP="YourApp"
# The path of your app to sign.
APP_PATH="/path/to/YourApp.app"
# The path to the location you want to put the signed package.
RESULT_PATH="~/Desktop/$APP.pkg"
# The name of certificates you requested.
APP_KEY="3rd Party Mac Developer Application: Company Name (APPIDENTITY)"
INSTALLER_KEY="3rd Party Mac Developer Installer: Company Name (APPIDENTITY)"
# The path of your plist files.
CHILD_PLIST="/path/to/child.plist"
PARENT_PLIST="/path/to/parent.plist"
LOGINHELPER_PLIST="/path/to/loginhelper.plist"
FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Electron Framework"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libnode.dylib"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/Contents/MacOS/$APP Helper"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/"
codesign -s "$APP_KEY" -f --entitlements "$LOGINHELPER_PLIST" "$APP_PATH/Contents/Library/LoginItems/$APP Login Helper.app/Contents/MacOS/$APP Login Helper"
codesign -s "$APP_KEY" -f --entitlements "$LOGINHELPER_PLIST" "$APP_PATH/Contents/Library/LoginItems/$APP Login Helper.app/"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$APP_PATH/Contents/MacOS/$APP"
codesign -s "$APP_KEY" -f --entitlements "$PARENT_PLIST" "$APP_PATH"
productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH"
```xml
<plist version="1.0">
<dict>
...
<key>ElectronTeamID</key>
<string>TEAM_ID</string>
</dict>
</plist>
```
If you are new to app sandboxing under macOS, you should also read through
Apple's [Enabling App Sandbox][enable-app-sandbox] to have a basic idea, then
add keys for the permissions needed by your app to the entitlements files.
When using `electron-osx-sign` the `ElectronTeamID` key will be added
automatically by extracting the Team ID from the certificate's name. You may
need to manually add this key if `electron-osx-sign` could not find the correct
Team ID.
Apart from manually signing your app, you can also choose to use the
[electron-osx-sign][electron-osx-sign] module to do the job.
### Sign apps for development
#### Sign Native Modules
To sign an app that can run on your development machine, you must sign it with
the "Apple Development" certificate and pass the provisioning profile to
`electron-osx-sign`.
Native modules used in your app also need to be signed. If using
electron-osx-sign, be sure to include the path to the built binaries in the
argument list:
```sh
electron-osx-sign YourApp.app YourApp.app/Contents/Resources/app/node_modules/nativemodule/build/release/nativemodule
```bash
electron-osx-sign YourApp.app --identity='Apple Development' --provisioning-profile=/path/to/yourapp.provisionprofile
```
Also note that native modules may have intermediate files produced which should
not be included (as they would also need to be signed). If you use
[electron-packager][electron-packager] before version 8.1.0, add
`--ignore=.+\.o$` to your build step to ignore these files. Versions 8.1.0 and
later ignore those files by default.
If you are signing without `electron-osx-sign`, you must place the provisioning
profile to `YourApp.app/Contents/embedded.provisionprofile`.
### Upload Your App
The signed app can only run on the machines that registered by the provisioning
profile, and this is the only way to test the signed app before submitting to
Mac App Store.
After signing your app, you can use Application Loader to upload it to iTunes
### Sign apps for submitting to the Mac App Store
To sign an app that will be submitted to Mac App Store, you must sign it with
the "Apple Distribution" certificate. Note that apps signed with this
certificate will not run anywhere, unless it is downloaded from Mac App Store.
```bash
electron-osx-sign YourApp.app --identity='Apple Distribution'
```
### Sign apps for distribution outside the Mac App Store
If you don't plan to submit the app to Mac App Store, you can sign it the
"Developer ID Application" certificate. In this way there is no requirement on
App Sandbox, and you should use the normal darwin build of Electron if you don't
use App Sandbox.
```bash
electron-osx-sign YourApp.app --identity='Developer ID Application' --no-gatekeeper-assess
```
By passing `--no-gatekeeper-assess`, the `electron-osx-sign` will skip the macOS
GateKeeper check as your app usually has not been notarized yet by this step.
<!-- TODO(zcbenz): Add a chapter about App Notarization -->
This guide does not cover [App Notarization][app-notarization], but you might
want to do it otherwise Apple may prevent users from using your app outside Mac
App Store.
## Submit Apps to the Mac App Store
After signing the app with the "Apple Distribution" certificate, you can
continue to submit it to Mac App Store.
However, this guide do not ensure your app will be approved by Apple; you
still need to read Apple's [Submitting Your App][submitting-your-app] guide on
how to meet the Mac App Store requirements.
### Upload
The Application Loader should be used to upload the signed app to iTunes
Connect for processing, making sure you have [created a record][create-record]
before uploading.
### Submit Your App for Review
If you are seeing errors like private APIs uses, you should check if the app is
using the MAS build of Electron.
After these steps, you can [submit your app for review][submit-for-review].
### Submit for review
After uploading, you should [submit your app for review][submit-for-review].
## Limitations of MAS Build
@@ -181,13 +261,13 @@ Also, due to the usage of app sandboxing, the resources which can be accessed by
the app are strictly limited; you can read [App Sandboxing][app-sandboxing] for
more information.
### Additional Entitlements
### Additional entitlements
Depending on which Electron APIs your app uses, you may need to add additional
entitlements to your `parent.plist` file to be able to use these APIs from your
app's Mac App Store build.
entitlements to your app's entitlements file. Otherwise, the App Sandbox may
prevent you from using them.
#### Network Access
#### Network access
Enable outgoing network connections to allow your app to connect to a server:
@@ -261,15 +341,12 @@ Electron uses following cryptographic algorithms:
* RIPEMD - [ISO/IEC 10118-3](https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004)
[developer-program]: https://developer.apple.com/support/compare-memberships/
[submitting-your-app]: https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html
[nwjs-guide]: https://github.com/nwjs/nw.js/wiki/Mac-App-Store-%28MAS%29-Submission-Guideline#first-steps
[enable-app-sandbox]: https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html
[create-record]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html
[electron-osx-sign]: https://github.com/electron-userland/electron-osx-sign
[electron-packager]: https://github.com/electron/electron-packager
[submit-for-review]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
[electron-osx-sign]: https://github.com/electron/electron-osx-sign
[app-sandboxing]: https://developer.apple.com/app-sandboxing/
[app-notarization]: https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution
[submitting-your-app]: https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html
[create-record]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html
[submit-for-review]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
[export-compliance]: https://help.apple.com/app-store-connect/#/devc3f64248f
[temporary-exception]: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AppSandboxTemporaryExceptionEntitlements.html
[user-selected]: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6
[network-access]: https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9

Some files were not shown because too many files have changed in this diff Show More