Compare commits

...

242 Commits

Author SHA1 Message Date
Pedro Pontes
e8b8ee1454 chore: cherry-pick d5ffb4dd4112 from chromium (#36214)
* chore: cherry-pick d5ffb4dd4112 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2022-11-03 12:26:44 -04:00
Pedro Pontes
b9d0a5aee3 chore: cherry-pick ec236fef54b8 from v8 (#36226)
* chore: [20-x-y] cherry-pick ec236fef54b8 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-11-03 11:40:13 -04:00
Pedro Pontes
bc3d0bf0c2 chore: cherry-pick 933cc81c6bad from chromium (#36223)
* chore: cherry-pick 933cc81c6bad from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2022-11-03 09:52:59 -04:00
Pedro Pontes
a0f608b8b6 chore: cherry-pick 06c87f9f42ff from chromium (#36208)
chore: [20-x-y] cherry-pick 06c87f9f42ff from chromium

Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2022-11-02 11:53:02 -04:00
Pedro Pontes
92a338a273 chore: cherry-pick eef098d1c7d5 from webrtc (#36217)
* chore: cherry-pick eef098d1c7d5 from webrtc

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-11-02 11:50:29 -04:00
Pedro Pontes
f8ab27474f chore: cherry-pick b8636b57b8f2 from angle (#36210)
chore: [20-x-y] cherry-pick b8636b57b8f2 from angle
2022-11-02 10:32:39 -04:00
Pedro Pontes
d844933377 chore: cherry-pick 194bcc127f21 from v8 (#36206)
* chore: [20-x-y] cherry-pick 194bcc127f21 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-11-02 10:05:48 -04:00
Pedro Pontes
30046ca08d chore: cherry-pick 67c9cbc784d6 from chromium (#36220) 2022-11-02 09:15:49 -04:00
George Xu
98ab127aa1 build: use python3 for appveyor commands (#36231) 2022-11-01 16:59:01 -07:00
trop[bot]
1008774610 docs: Fixed outdated documentation (uploading to App Store) (#36211)
* Updated docs on uploading

- replaced mention of Application Loader with Apple Transporter, its replacement
- replaced mention of iTunes Connect with App Store Connect
- updated link for creating a record

Co-authored-by: Georgescu Gabriel <29951139+gabi200@users.noreply.github.com>

* Update mac-app-store-submission-guide.md

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

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Georgescu Gabriel <29951139+gabi200@users.noreply.github.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-11-01 16:40:25 -07:00
trop[bot]
782e5adc99 build: fix building with enable_plugins = false (#36005)
Co-authored-by: Milan Burda <milan.burda@gmail.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2022-11-01 11:17:30 -04:00
trop[bot]
806d0840ff fix: resolve loadURL properly for in-page navigations (#36149)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2022-11-01 11:12:22 -04:00
Keeley Hammond
bdf6126133 build: determine electron version from tags not files (#36136)
* build: determine electron version from tags not files (#36106)

* build: determine electron version from tags not files

* build: make electron_version dependent on packed-refs and git HEAD

* build: do not delete electron/.git

* build: do not revert a commit we didn't make

* build: gen version file instead of just writing it

* build: update cache and ninja targets

* build: copy resource.h to generated electron.rc

* build: electron_win32_resources should be public deps

* build: also copy the icon

Co-authored-by: MarshallOfSound <marshallofsound@electronjs.org>

* chore: fixup patches

* chore: update patches

* build: ensure get-version runs in the electron git checkout (#36128)

* build: strip v in the getElectronVersion helper

* build: use npm@7 for npm view command

Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: MarshallOfSound <marshallofsound@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-10-30 15:37:45 -07:00
trop[bot]
378110b748 build: prefix version in uploader script (#36176)
build: prefix v in uploader script

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-10-27 17:48:21 -07:00
trop[bot]
117b264db5 test: fixup HID test for ARM CI (#36171)
(cherry picked from commit caf28066d6)

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-10-27 16:18:12 -04:00
trop[bot]
109009f3e7 refactor: handle uncaught promise error (#36157)
Co-authored-by: daief <1437931235@qq.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: daief <1437931235@qq.com>
2022-10-27 14:26:51 -04:00
trop[bot]
b2ca7f9c05 test: fix flake in will-navigate test (#36167)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2022-10-27 14:03:46 -04:00
trop[bot]
5382df7ea2 docs: document that when invoke rejects, it gives a different Error (#36146)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2022-10-26 17:28:30 -07:00
Pedro Pontes
aedfdadf1b chore: cherry-pick 65f0ef609c00 from chromium (#36079)
* chore: [20-x-y] cherry-pick 65f0ef609c00 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2022-10-26 17:29:30 -04:00
Pedro Pontes
7a70765ba1 chore: cherry-pick 07a2ce61e31a from skia (#36080)
* chore: cherry-pick 07a2ce61e31a from skia

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-10-26 17:17:26 -04:00
George Xu
a7ae2511d2 refactor: migrate from asar to @electron/asar (#36070) (#36083)
* refactor: migrate from asar to @electron/asar (#36070)

* refactor: migrate from asar to @electron/asar

* fix: update asar require calls

* kick ci

* kick ci

Co-authored-by: Samuel Attard <sam@electronjs.org>
2022-10-24 14:49:00 -07:00
trop[bot]
cf9f5ca5b8 test: disable flaky linux arm/arm64 crash test case (#36099)
test: disable failing linux arm/arm64 crash test case

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-10-24 15:06:55 -04:00
Pedro Pontes
2e85e7fd69 chore: cherry-pick d7feae867b83 from sqlite (#36085)
* chore: cherry-pick d7feae867b83 from sqlite

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-10-24 15:05:56 -04:00
Pedro Pontes
3028dcd785 chore: cherry-pick cb9dff93f3d4 from chromium (#36078)
* chore: [20-x-y] cherry-pick cb9dff93f3d4 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-10-20 14:05:20 -04:00
Sudowoodo Release Bot
d010bcca86 Bump v20.3.3 2022-10-19 08:31:28 -07:00
trop[bot]
1ba8128c8c docs: update VS Code debugger types to remove "pwa-" prefix (#36052)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2022-10-17 14:18:39 -04:00
trop[bot]
25e504a7ed fix: override app's desktop name and v8 flags in default-app (#36048)
Co-authored-by: Piroro-hs <Piroro-hs@users.noreply.github.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Piroro-hs <Piroro-hs@users.noreply.github.com>
2022-10-17 14:12:49 +02:00
trop[bot]
589199f335 test: re-enable power monitor tests on arm64 (#36023)
test: re-enable powermonitor on arm64

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-10-15 01:24:14 -07:00
Sudowoodo Release Bot
c0371ab218 Bump v20.3.2 2022-10-12 08:32:04 -07:00
trop[bot]
50f2f10b94 fix: on-screen-keyboard hides on input blurred in webview (#35981)
* fix: on-screen-keyboard hides on input blurred in webview

Co-authored-by: Kyrylo Hrechykhin <khrechykhin@microsoft.com>

* chore: update patches

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Kyrylo Hrechykhin <khrechykhin@microsoft.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-10-12 10:36:53 -04:00
trop[bot]
2ee36539ba fix: drag and drop should copy on macOS (#35978)
fix: drag and drop should copy on macOS (#35963)

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-10-12 10:08:42 -04:00
trop[bot]
0d05ce8d12 docs: remove references to Widevine (#35991)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-10-12 09:59:37 -04:00
Jeremy Rose
9e064fec80 chore: cherry-pick fefd6198da31 from chromium (#35883)
* chore: [20-x-y] cherry-pick fefd6198da31 from chromium

* chore: update patches

* Update cherry-pick-fefd6198da31.patch

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-10-12 09:53:39 -04:00
trop[bot]
619a88cf56 fix: expose the built-in electron module via the ESM loader (#35956)
* fix: expose the built-in electron module via the ESM loader

Co-authored-by: Samuel Attard <sattard@salesforce.com>

* Update .patches

* chore: update patches

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sattard@salesforce.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-10-11 16:06:42 -07:00
Milan Burda
080bc57145 fix: pass rfh instances through to the permission helper (#35985)
fix: pass rfh instances through to the permission helper (#35419)

Co-authored-by: Samuel Attard <sam@electronjs.org>
2022-10-11 16:05:41 -07:00
Raymond Zhao
a03ec151e1 chore: cherry-pick 30a32e6 from chromium (#35370) (#35968) 2022-10-11 15:45:51 +09:00
ad0p
0858a08097 chore: cherry-pick 05a0d99c9715 from chromium (#35929)
* chore: cherry-pick 05a0d99c9715 from chromium

* chore: cherry-pick 05a0d99c9715 from chromium

Co-authored-by: Adam Prasil <adamprasil@microsoft.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-10-10 16:49:07 +02:00
Samuel Attard
53b6270320 chore: cherry-pick c83640db21b5 from chromium (#35926)
* chore: cherry-pick c83640db21b5 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-10-06 04:27:10 -07:00
Samuel Attard
4c44e86fd1 build: fix filesystem permissions from bad trop commits
Ref: a7848809fc
Ref: c0c83d2719
2022-10-05 12:09:08 -07:00
Sudowoodo Release Bot
543a29c926 Bump v20.3.1 2022-10-05 08:32:16 -07:00
trop[bot]
c0c83d2719 docs: update supported Mac versions (#35912)
Co-authored-by: VerteDinde <vertedinde@electronjs.org>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2022-10-05 11:05:49 +02:00
trop[bot]
a7848809fc fix: TryCatch scope in node_bindings (#35897)
fix: TryCatch scope in node_bindings

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-10-04 11:04:41 -04:00
Jeremy Rose
d8ca287700 chore: cherry-pick 8b040cb69e96 from v8 (#35889)
* chore: [20-x-y] cherry-pick 8b040cb69e96 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2022-10-04 15:47:07 +02:00
Jeremy Rose
b0c881f608 chore: cherry-pick 1eb1e18ad41d from chromium (#35880)
* chore: [20-x-y] cherry-pick 1eb1e18ad41d from chromium

* chore: resolve patch conflicts

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-10-03 23:49:47 -07:00
Jeremy Rose
6620ba4e15 chore: cherry-pick 2f6a2939514f from v8 (#35892)
* chore: [20-x-y] cherry-pick 2f6a2939514f from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-10-03 23:37:28 -07:00
trop[bot]
1babaec6da fix: set display_id in desktop capturer on Linux (#35834)
fix: set display_id in desktop capturer on Linux (#33861)

Previously, display_id was an empty string, pending Chrome support for
sharing individual screens. Now that this has been added, it is
desirable to have this property set correctly.

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: James Cash <james.nvc@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-10-03 13:05:11 -07:00
Sudowoodo Release Bot
cbe1debbe2 Bump v20.3.0 2022-09-28 08:31:21 -07:00
trop[bot]
3c73ea5259 fix: Handle an electron.d.ts file in a custom build (#35823)
fix: Handle an electron.d.ts file in a custom build (#33979)

* Handle an electron.d.ts file in a custom build

* Fix linter issues

Co-authored-by: Felix Rieseberg <felixr@stripe.com>

Co-authored-by: Felix Rieseberg <felix@felixrieseberg.com>
Co-authored-by: Felix Rieseberg <felixr@stripe.com>
2022-09-26 17:41:28 -04:00
trop[bot]
02622b02a6 build: remove unused GitHub app config file (#35813)
chore: remove unused GitHub action config file

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2022-09-26 11:29:27 -04:00
trop[bot]
700906c1f1 fix: set macOS crypto keychain name earlier (#35796)
* fix: set macOS crypto keychain name earlier

* spec: ensure arm64 mac tests are cleaned up

Co-authored-by: Samuel Attard <sattard@salesforce.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2022-09-26 01:50:45 -07:00
trop[bot]
d19a0ac51b docs: add forge-overview.md (#35758)
docs: add forge-overview.md (#35473)

* docs: move forge-specific docs to electronforge.io

* docs: add reference to forge icon tutorial

* docs: add references to forge-overview.md

* docs: add recommended

* docs: update forge-overview

* docs: apply code review comments

Co-authored-by: Charles Kerr <charles@charleskerr.com>

Co-authored-by: George Xu <33054982+georgexu99@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-09-23 12:43:58 -07:00
trop[bot]
25521f6286 fix: allow docking DevTools with WCO (#35764)
fix: allow for docking devtools with WCO

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-09-23 11:48:08 -07:00
trop[bot]
f89b51fe0a docs: update the link for Introduction to Node.js (#35769)
Updated the link for Introduction to NodeJs

Co-authored-by: Aman Gupta <techbugaman@gmail.com>
2022-09-23 11:44:08 -07:00
trop[bot]
2a42cd2f65 docs: changed event.data to data under the message.port in docs (#35781)
* docs: changed event.data to data under the message.port in docs

* docs: corrected BrowserWindow wrong usage and change window.messagePort to window.electronMessagePort

Co-authored-by: cyrilchukwuebuka <muofunanya3@gmail.com>
2022-09-23 11:35:24 -07:00
trop[bot]
9e419bc4e9 feat: allow custom v8 snapshots to be used in the main process and the default snapshot in the renderer process (#35694)
feat: allow custom v8 snapshots to be used in the main process and the default snapshot in the renderer process (#35266)

* Updates to allow for using a custom v8 snapshot file name

* Allow using a custom v8 snapshot file name

* Fix up patch due to merge

* Use fuse to set up custom v8 snapshot file in browser process

* Refactor to use delegate instead of command line parameter

* Refactoring

* Update due to merge

* PR comments

* Rename patch

* Rename patch

chore: update patches

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
2022-09-22 09:41:25 -07:00
Sudowoodo Release Bot
1921f802fd Bump v20.2.0 2022-09-21 14:34:58 -07:00
Sudowoodo Release Bot
06e585d82f Revert "Bump v20.2.0"
This reverts commit febee696d6.
2022-09-21 10:34:45 -07:00
Sudowoodo Release Bot
febee696d6 Bump v20.2.0 2022-09-21 08:31:47 -07:00
trop[bot]
57917c4b5a chore: fix ambiguous reference gcc compile error (#35733)
Co-authored-by: Bruno Pitrus <brunopitrus@hotmail.com>
2022-09-21 15:15:45 +02:00
trop[bot]
3f7f4de319 docs: fix wording mistake in security.md section 4 (#35742)
docs: fix wording mistake in security.md section 4 (#35682)

Update security.md

Under "4. Process Sandboxing", it said "For mor information on what `contextIsolation` is..." which was the previous section (copied from there). This updates it to say "For more information on what Process Sandboxing is..."

Co-authored-by: Sebastian Vittersø <37065184+sebastianvitterso@users.noreply.github.com>
2022-09-21 10:54:09 +02:00
trop[bot]
91bafdd3d5 fix: edge case in app.isInApplicationsFolder() (#35731)
fix: edge case in app.isInApplicationsFolder() (#35636)

* fix: edge case in IsInApplicationsFolder

* use realpath instead

* lint

* revert lowercasing

* optimize

* Update shell/browser/ui/cocoa/electron_bundle_mover.mm

* lint

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: Kishan Bagaria <hi@kishan.info>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-09-21 10:41:27 +02:00
trop[bot]
c676831a54 chore: add missing .eslintrc.json files to limit imports properly (#35746)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-09-21 10:39:38 +02:00
trop[bot]
a62b98a23f fix: uv_os_gethostname failing on Windows 7 (libuv patch regression) (#35705)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2022-09-16 08:37:24 -07:00
Michaela Laurencin
cbd39f73f8 chore: cherry-pick 47968ed from chromium (#35530)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-09-16 01:21:46 +02:00
trop[bot]
eb819e0881 build: fix building with enable_basic_printing false (#35692)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2022-09-15 14:04:16 -07:00
trop[bot]
36885ea919 docs: add back docs about asar archives (#35666)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-09-15 13:11:32 -07:00
electron-roller[bot]
bc09b08664 chore: bump chromium to 104.0.5112.124 (20-x-y) (#35674)
chore: bump chromium in DEPS to 104.0.5112.124

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2022-09-15 11:26:29 -07:00
trop[bot]
880d06e304 build: make check-symlinks.js aware of BRANDING.json changes (#35670)
Right now the `check-symlinks.js` assumes that the branding product name
is "Electron". If users change `BRANDING.json` on custom builds, the
script will fail.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Co-authored-by: Juan Cruz Viotti <jv@jviotti.com>
2022-09-15 10:59:46 -07:00
trop[bot]
cb5b28f833 feat: webFrameMain.origin (#35535)
* feat: webFrameMain.origin

* add tests

* update docs

* fix spec

Co-authored-by: Jeremy Rose <japthorp@slack-corp.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-09-15 10:24:50 -07:00
Sudowoodo Release Bot
e867b08172 Bump v20.1.4 2022-09-14 08:31:15 -07:00
trop[bot]
4541c432af fix: allow maximizing when window enters tablet mode with WCO (#35663)
* fix: Backport CL 3753528 for WCO

* Update comment

* Update shell/browser/ui/views/win_caption_button_container.cc

Co-authored-by: Robo <hop2deep@gmail.com>

Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>
Co-authored-by: Robo <hop2deep@gmail.com>
2022-09-14 10:50:20 +09:00
Pedro Pontes
604034a899 chore: cherry-pick 88f6139ead from sqlite (#35560)
* chore: cherry-pick 88f6139ead from sqlite

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-09-13 23:34:56 +02:00
trop[bot]
c256db23ce fix: remove extra dot in extension (#35659)
* fix: remove extra period of extension

* update comment

Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2022-09-13 14:10:24 -07:00
trop[bot]
c19f09e92e docs: improve registerFileProtocol example (#35598)
docs: improve registerFileProtocol example (#35580)

* improve registerFileProtocol example

* link ProtocolResponse

* kick lint

Co-authored-by: Kishan Bagaria <hi@kishan.info>
2022-09-13 13:53:07 -07:00
trop[bot]
328368be56 docs: fix typescript error in code samples (#35655)
Fixed typescript error

Co-authored-by: Leon Schwanitz <leon@28minds.com>
2022-09-13 13:32:36 -07:00
trop[bot]
73deb5f56d fix: potential "Object has been destroyed" error in BrowserWindow.getFocusedWindow (#35644)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-09-13 10:46:59 -07:00
trop[bot]
46c416190b docs: update sandbox renderer defaults for Electron 20 (#35616)
docs: update sandbox renderer defaults for Electron 20 (#35379)

* docs: update E20 sandbox rendering defaults

* docs: update tutorial

* simplify paragraph

* dont mention context isolation

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2022-09-13 09:36:02 -07:00
trop[bot]
046ef10147 docs: Use inline image link in faq.md (#35649)
* Use absolute URL in faq.md image link

The relative link is rendered relative to the host domain, which works fine when viewing it on Github, but since you also use the same generated HTML in your doc site, the link is broken. See here: https://www.electronjs.org/docs/latest/faq#the-font-looks-blurry-what-is-this-and-what-can-i-do

Using an absolute URL here should fix the issue on the main site.

* Use inline image reference for subpixel rendering example

As suggested by @dsanders11

Co-authored-by: Adrian Petrescu <adrian@apetre.sc>
2022-09-13 08:03:50 -07:00
trop[bot]
7c8d5f68d5 docs: fix misspelling in fuses (#35619)
Co-authored-by: CanadaHonk <19228318+CanadaHonk@users.noreply.github.com>
2022-09-12 16:14:21 -07:00
trop[bot]
4be4dc7c4f fix: ensure history navigations are sandboxed-iframe-aware (#35622)
Co-authored-by: Jeremy Spiegel <jeremy.spiegel@frontapp.com>
2022-09-12 22:58:07 +02:00
Sudowoodo Release Bot
5cfb58161c Bump v20.1.3 2022-09-08 12:12:16 -07:00
trop[bot]
2f116aacfb fix: Set background for WCO container (#35611)
* fix: Set background for WCO container

* Add background when invalidating as well

Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>
2022-09-08 10:18:54 -07:00
trop[bot]
2f5c0f9eec fix: session.getBlobData never resolves with blob sizes > 65536 (#35601)
fix: session.getBlobData never resolves with blob sizes > 65536 (#35277)

* fix: session.getBlobData never resolves with blob sizes > 65536 (#34398)

* Add unit test case for session.getBlobData

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: Frank Pian <bianyongfang@vip.qq.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-09-08 06:47:53 -04:00
trop[bot]
c730abc55d docs: add fuses and asar integrity docs (#35595)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2022-09-07 14:08:51 -04:00
Sudowoodo Release Bot
61f385a89e Bump v20.1.2 2022-09-07 08:31:29 -07:00
Pedro Pontes
389911d7e2 chore: cherry-pick 2083e894852c from chromium (#35553)
* chore: [20-x-y] cherry-pick 2083e894852c from chromium

* chore: update patches

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-09-07 15:33:58 +02:00
Pedro Pontes
85ae4c4a77 chore: cherry-pick 51daffbf5cd8 from chromium (#35549)
* chore: [20-x-y] cherry-pick 51daffbf5cd8 from chromium

* chore: update patches

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-09-07 11:45:02 +02:00
Samuel Attard
bb0a66823b chore: cherry-pick 9b5207569882 from chromium (#35544)
* chore: cherry-pick 9b5207569882 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-09-06 10:28:05 -07:00
electron-roller[bot]
e9b721ba51 chore: bump chromium to 104.0.5112.114 (20-x-y) (#35570)
chore: bump chromium in DEPS to 104.0.5112.114

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-09-06 12:17:10 -04:00
Pedro Pontes
42bb395529 chore: cherry-pick fd34e75b0a from sqlite (#35557)
* chore: cherry-pick fd34e75b0a from sqlite

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-09-05 09:53:02 +02:00
electron-roller[bot]
7a418ffa43 chore: bump chromium to 104.0.5112.111 (20-x-y) (#35523)
* chore: bump chromium in DEPS to 104.0.5112.111

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-08-31 20:06:45 -04:00
Sudowoodo Release Bot
1e14b3ebb8 Bump v20.1.1 2022-08-31 08:32:28 -07:00
trop[bot]
dbaa3528f9 fix: crash on WebWorker destruction (#35491)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-31 11:20:02 +09:00
trop[bot]
44bd6aac3a fix: compensate for title bar height when setting bounds on BrowserView (#35494)
fix: compensate for title bar height when setting bounds

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-30 11:09:16 +02:00
trop[bot]
fef7d52e73 chore: use nghttp2's config.h on all platforms (#35486)
https://github.com/nodejs/node/pull/27283

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-29 11:06:45 -04:00
trop[bot]
0bdb5ac85a docs: update docs description to match sidebar (#35481)
Update introduction.md

Co-authored-by: Nik K <nk@nikk.ca>
2022-08-29 15:52:39 +02:00
trop[bot]
1e54a8d3fe chore: delete implicit fallthrough patch (#35468)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-29 16:45:52 +09:00
trop[bot]
5ef4b258ec fix: Node.js atob input validation (#35445)
fix: Node.js atob input validation

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-25 19:02:08 +02:00
trop[bot]
dad125a0e0 fix: fullscreen crashing with roundedCorners: false (#35455)
fix: fullscreen crashing with roundedCorners

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-25 15:52:21 +02:00
Sudowoodo Release Bot
42e2e54730 Bump v20.1.0 2022-08-24 08:33:03 -07:00
trop[bot]
3795fbaccb fix: undefined details.requestingUrl from session.setPermissionCheckHandler (#35408)
* fix: undefined details.requestingUrl from setPermissionCheckHandler

* fix: compilation error

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2022-08-24 11:42:55 +02:00
electron-roller[bot]
7358d0fd71 chore: bump chromium to 104.0.5112.102 (20-x-y) (#35361)
* chore: bump chromium in DEPS to 104.0.5112.102

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-08-23 21:12:41 +02:00
trop[bot]
f85bd310c8 fix: add restore event for minimized maximization (#35412)
Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2022-08-23 10:25:57 -04:00
trop[bot]
a415eb6f06 fix: promise support with webFrameMain.executeJavaScript (#35358)
* fix: promise support with webFrameMain.executeJavaScript

* chore: reject when result is an error

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2022-08-23 11:40:04 +02:00
trop[bot]
3f6b9a8fcd fix: ensure chrome colors are initialized (#35402)
* fix: ensure chrome colors are initialized

* build: fix linking on windows

* build: fix linking on windows

* build: add needed files to chromium_src/BUILD

Co-authored-by: Samuel Attard <sattard@salesforce.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2022-08-23 10:27:42 +09:00
trop[bot]
cc17929ebb fix: don't bypass redirect checks (#35368)
Co-authored-by: Jeremy Rose <japthorp@slack-corp.com>
2022-08-18 10:09:28 -07:00
Sudowoodo Release Bot
a85ad0ea38 Bump v20.0.3 2022-08-17 08:33:00 -07:00
trop[bot]
91e09c69bd fix: Frameless window shows frame while opening (#35352)
* fix: Frameless window shows frame while opening

* Clarify comments

* Inline setter

* Edit comment

* chore: update patches

Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-08-16 17:14:56 -07:00
trop[bot]
6e27b53527 docs: add Electron deps to license credits file (#35331)
* docs: add Electron deps to license credits file

* fixup! docs: add Electron deps to license credits file

remove nan; it is dev-only

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-08-15 21:35:39 -07:00
trop[bot]
534d313758 fix: add uv_loop_close when object release to fix crash (#35338)
Co-authored-by: yangzuohui <yangzuohui@bytedance.com>
2022-08-16 11:20:23 +09:00
Darshan Sen
30b446ca32 fix: prevent brief display of "Ozone X11" in window title on Linux (#35317)
Backport of https://chromium-review.googlesource.com/c/chromium/src/+/3722478.

The change landed on main recently in the latest chromium 105.0.5173.0
upgrade - https://github.com/electron/electron/pull/34770, so it would
not be backported automatically to the currently supported stable
branches, so I thought it would make sense to manually backport it.

Fixes: https://github.com/electron/electron/issues/34467

Signed-off-by: Darshan Sen <raisinten@gmail.com>

Signed-off-by: Darshan Sen <raisinten@gmail.com>
2022-08-15 10:41:54 -04:00
trop[bot]
7e6d0d4c3c docs: removes unused import in preload script (#35333)
* Remove unused import of path

This import gives out the error in the preload script:

Error: module not found: path
    at preloadRequire

* Remove import path as it is not used in the script

note: Removes import path as it is not used in the script

Co-authored-by: Rhitik Bhatt <bhattrhitik95@gmail.com>
2022-08-15 17:07:13 +09:00
trop[bot]
6eabd3c72b refactor: simplify Browser::SetLoginItemSettings (#35328)
refactor: simplify Browser::SetLoginItemSettings

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-15 15:20:31 +09:00
trop[bot]
f0302c4981 fix: WCO occlusion of DevTools (#35309)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-15 10:30:43 +09:00
trop[bot]
3c71a812c3 docs: fix getStoragePath return type (#35294)
Fixes #35255

Co-authored-by: Samuel Attard <sam@electronjs.org>
2022-08-15 09:47:01 +09:00
Sudowoodo Release Bot
58981b69b1 Bump v20.0.2 2022-08-10 08:31:37 -07:00
trop[bot]
6a451311cd fix(docs): fix a typo in section on debugging with VSCode (#35286)
fix(docs): fix a typo

Co-authored-by: Trang Le <trang.thule@zoho.com>
2022-08-09 15:30:39 -07:00
trop[bot]
09beb48648 fix: app.relaunch loses args when execPath specified (#35253)
fix: app.relaunch loses args when execPath specified (#35108)

Co-authored-by: Aaron Meriwether <me@ameriwether.com>
2022-08-09 08:55:23 +09:00
Milan Burda
e6fc453d90 build: fix building with enable_plugins = false (#35259) 2022-08-08 17:07:53 -04:00
trop[bot]
305751aa47 test: temporarily disable tests on mas arm64 that are causing a crash (#35248)
test: temporarily disable tests on mas arm64 that are causing a crash (#35226)

* test: temporarily disable test on mas arm64 that is causing crash

* disable the right test

* chore: speculative fix for CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER crash

* enable all the tests

* Revert "chore: speculative fix for CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER crash"

This reverts commit b7c8ef364c.

* test: disable tests that crash on  mas arm64

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-08-08 15:56:17 -04:00
trop[bot]
d8fbdf6b3e docs: update tray docs with info for mac menubar icons (#35222)
Co-authored-by: Brad Carter <16466430+carterbs@users.noreply.github.com>
2022-08-08 10:02:21 +02:00
msizanoen1
c84a45f9f2 fix: Wayland general CSD fixes (#35206)
* fix: broken wayland window decorations due to botched chromium update

The `GetTitlebarBounds().height()` is obviously intended to be placed in
the `top` parameter, which used to be the second one before upstream
removed multi-parameter `gfx::Rect::Inset`, but it's the first parameter
for `gfx::Insets::TLBR`, which was intended to replace the removed
`Inset` function. However, whoever updated Chromium kept the parameter
unchanged, causing the title bar height to be passed to the `left`
parameter, causing the window title bar to be unclickable.

* fix: wayland window top bar buttons unclickable

Use NonClientFrameView::TargetForRect for the ClientFrameViewLinux
implementation because the default inherited from FramelessView blocks
any non-HTCLIENT events.

* fix: add maximized parameter to LinuxUI::GetWindowFrameProvider

* fix: pass frame_->IsMaximized() to GetWindowFrameProvider

This ensures that the toolkit renders the window decorations in maximized mode
while the window is maximized to ensure that there is no empty space around the window.
2022-08-04 12:29:09 +02:00
trop[bot]
5274c253db fix: consider dock space when showing menu (#35200)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-08-04 10:58:31 +02:00
trop[bot]
8e70826af6 docs: fix link in tutorial (#35208)
Relands https://github.com/electron/electronjs.org-new/pull/240 upstream

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2022-08-03 10:07:26 -07:00
Sudowoodo Release Bot
9afa4194ac Bump v20.0.1 2022-08-03 08:31:32 -07:00
trop[bot]
062f7c0cb1 docs: update categories to match sidebar (#35202)
This page describes each of the categories available in the sidebar, but some of the category titles didn't match.

Co-authored-by: Maya Nedeljković Batić <maya.nedeljko@gmail.com>
2022-08-03 10:15:52 -04:00
trop[bot]
13cfb4ef8f chore: remove unsupported skiptaskbar linux impl (#35188)
chore: unsupported skiptaskbar linux impl

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2022-08-03 10:10:31 -04:00
trop[bot]
39d08c3f2a fix: fail non-fatally when InitLogging fails (#35190)
Co-authored-by: Jeremy Rose <japthorp@slack-corp.com>
2022-08-03 10:09:54 -04:00
trop[bot]
1a6d998c34 fix: modify file extension generation on Windows (#35173)
* fix: modify file extension generation on Windows

* modify includes

* include vector in header

* add win build flags

* remove hardcoded strings

* Update shell/browser/electron_download_manager_delegate.h

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix string manipulation and function definitions

* Update electron_download_manager_delegate.h

* convert to std::string and modify for electron

* Update shell/browser/electron_download_manager_delegate.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* remove vector include and update conversion

* add vectr include for lint

Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-08-02 15:55:25 -04:00
trop[bot]
ab426d5abf fix: touch events not recognized by WCO on windows (#35174)
* fix: touch events not recognized by WCO on windows

* chore: update patches

Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-08-02 15:34:34 -04:00
electron-roller[bot]
6ff154c7cc chore: bump chromium to 104.0.5112.81 (20-x-y) (#35181)
chore: bump chromium in DEPS to 104.0.5112.81

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2022-08-02 15:30:58 -04:00
trop[bot]
910dd786a9 fix: DCHECK entering fullscreen while loading url (#35165)
* fix: DCHECK entering fullscreen while loading url

* spec: fixup test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-02 11:34:45 -04:00
trop[bot]
d7fedd2961 ci: turn off windows on arm test result comments (#35169)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-08-02 11:00:20 -04:00
Sudowoodo Release Bot
f20a51a87f Bump v20.0.0 2022-08-01 11:55:57 -07:00
trop[bot]
6c29ab10a4 fix: ensure native modules use the correct config (#35160)
* fix: ensure native modules are built with config.gypi

This works by patching node.h to check that two defines are set using the equivilant of an XNOR operation.  One define "ELECTRON_ENSURE_CONFIG_GYPI" is set via common.gypi which is _already_ used to build native modules and has been since the dawn of time.  Therefore this define will be set for all native module compilations targetting the Electron runtime.  The second define "USING_ELECTRON_CONFIG_GYPI" is only defined when the gypi argument "using_electron_config_gypi" is set to 1 which is only done so via config.gypi.  Only new enough versions of node-gyp correctly use the config.gypi file thus resulting in a compilation error on version of node-gyp that are too old.

* chore: fix lint

* chore: update patches

Co-authored-by: Samuel Attard <sattard@salesforce.com>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-08-01 11:44:25 -07:00
trop[bot]
b61692d790 fix: remove skip-taskbar feature on Linux. (#35156)
* fix: remove skip-taskbar feature on Linux.

Marked as unsupported in e19, now removed in e20.

See #33226 for more information

* docs: remove skipTaskbar note in browserWindow

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-08-01 07:42:38 -07:00
Shelley Vohr
0e6f172897 fix: clean up callback handling in webContents.print() (#35141)
fix: clean up callback handling in webContents.print()
2022-08-01 07:41:56 -07:00
trop[bot]
aa99d73990 chore: add electron deps to //src gitignore (#35146)
chore: add electon deps to //src gitignore

Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-08-01 12:54:51 +02:00
trop[bot]
f1c7562d9c docs: new main -> renderers messageChannel example (#35134)
* docs: new main -> renderers messageChannel example

* consistent use of your

* fix a typo

* linting

* markdown linting

* Update docs/tutorial/message-ports.md

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

* update code example headings, reference contextIsolation example

* remove nodeIntegration: false from browserWindows

* rename "messagePort" to "electronMessagePort" for compatibility

Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2022-07-29 15:07:40 -07:00
Keeley Hammond
08aa57806e feat: sandbox preloads by default (#35125)
feat: sandbox preloads by default (#32869)

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2022-07-29 15:06:31 -07:00
Keeley Hammond
76450afd47 fix: ensure that v8 sandbox isnt enabled for arm (#35137)
fix: ensure that v8 sandbox isnt enabled for arm (#34914)

Co-authored-by: Samuel Attard <sam@electronjs.org>
2022-07-29 17:37:31 -04:00
trop[bot]
8ac0e2bdec docs: update E21 release date (#35126)
* docs: update E21 release date

* chore: fix lint

Co-authored-by: Sofia Nguy <sofianguy@gmail.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-07-29 11:43:45 -07:00
trop[bot]
c61a14c5d1 fix: empty result of webContents.getUserAgent() (#35131)
fix: empty result of webContents.getUserAgent()

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-29 11:26:33 -07:00
John Kleinschmidt
ecdfca8f13 ci: switch to GHA for WOA (#35120)
ci: switch to GHA for WOA (#35109)

* ci: switch to GHA for WOA

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
(cherry picked from commit 674596d11e)
2022-07-28 22:17:10 -07:00
electron-roller[bot]
2f9414dcc4 chore: bump chromium to 104.0.5112.65 (20-x-y) (#35114)
* chore: bump chromium in DEPS to 104.0.5112.65

* chore: update patches

* test: remove duplicate test that is causing hang in Windows (#35071)

(cherry picked from commit 182ab9ad76)

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-07-28 16:28:16 -04:00
Sudowoodo Release Bot
816e8e804c Bump v20.0.0-beta.13 2022-07-28 06:32:12 -07:00
trop[bot]
5f1c3b4d13 fix: handle WCO pressed state when going maximized -> minimized (#35074)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-27 11:42:49 +02:00
trop[bot]
7b1872dafe fix: allow setsize to be called within a move or resize for preventDefault (#35084)
fix: #34599 allow setsize to be called within a move or resize for preventDefault

Co-authored-by: Ian German Mesner <mesner@gmail.com>
2022-07-27 11:14:21 +02:00
trop[bot]
c10922f15f fix: use win_clang_x64 binary for x86 extract symbols (#35091)
fix: use win_clang_x64 for x86 extract symbols

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-07-27 11:13:15 +02:00
Devin Foley
d8edf84cfc fix: Make disable_color_correct_rendering patch work again (#35087)
Fix disable_color_correct_rendering patch.
2022-07-27 11:09:45 +02:00
trop[bot]
215ae2b012 fix: crash on startup in X11 (#35092)
Fixes #34996.

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-07-27 11:09:11 +02:00
trop[bot]
09c4fdd6d0 docs: Add missing link to tutorial page (#35041)
Add missing link to tutorial page

Co-authored-by: Mike Lee <mikemunkyu.lee@gmail.com>
2022-07-26 18:24:45 +02:00
trop[bot]
77d561a8a6 fix: merge crash annotations instead of overwriting (#35045)
ElectronCrashReporterClient::GetProcessSimpleAnnotations() merges
annotations provided as argument with global_annotations_,
preserving useful information.

Co-authored-by: Alexander Petrov <zowers+github@zowers.net>
2022-07-26 17:37:23 +09:00
electron-roller[bot]
3777902abc chore: bump chromium to 104.0.5112.57 (20-x-y) (#35018)
* chore: bump chromium in DEPS to 104.0.5112.57

* Trigger Build

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-07-25 19:57:37 -04:00
trop[bot]
3a079feb87 fix: properly fire serial-port-added and serial-port-removed events (#35047)
Based on 2309652: [webhid] Notify chooser context observers on shutdown | https://chromium-review.googlesource.com/c/chromium/src/+/2309652

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-07-25 16:36:59 -04:00
Sudowoodo Release Bot
8d68009abc Bump v20.0.0-beta.12 2022-07-25 06:30:44 -07:00
trop[bot]
4f3be68ad5 refactor: only create webContents after 'will-attach-webview' (#35016)
refactor: only create webContents after 'will-attach-webview' (#30311)

Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-07-25 10:11:12 +02:00
trop[bot]
c7509b0a53 fix: add support for --ozone-platform-hint flag on Linux (#35014)
Co-authored-by: Valentin Hăloiu <valentin.haloiu@gmail.com>
2022-07-25 09:59:22 +02:00
Sudowoodo Release Bot
fa4052fc9e Bump v20.0.0-beta.11 2022-07-21 06:31:05 -07:00
trop[bot]
e02fbe1d29 fix: crash on BrowserWindow.setEnabled() (#34972)
fix: crash on BrowserWindow.setEnabled()

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-21 10:38:44 +02:00
trop[bot]
7e06da25ef ci: wait longer for goma to be ready (#34965)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-07-19 20:31:40 +02:00
trop[bot]
f0ae458f6f fix: potential hang on print settings failure (#34968)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-19 16:28:09 +02:00
Sudowoodo Release Bot
b2955e8cf5 Bump v20.0.0-beta.10 2022-07-18 13:40:55 -07:00
electron-roller[bot]
ca6738dc08 chore: bump chromium to 104.0.5112.48 (20-x-y) (#34920)
* chore: bump chromium in DEPS to 104.0.5112.48

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-07-18 13:15:56 -04:00
Sudowoodo Release Bot
0640a8a02a Revert "Bump v20.0.0-beta.10"
This reverts commit b7d5573584.
2022-07-18 10:09:45 -07:00
Sudowoodo Release Bot
b7d5573584 Bump v20.0.0-beta.10 2022-07-18 08:46:13 -07:00
Keeley Hammond
6fb73ba8e7 fix: do not define _LIBCPP_ABI_NAMESPACE=Cr for all native modules (#34944)
fix: do not define _LIBCPP_ABI_NAMESPACE=Cr for all native modules (#34932)

This define is only needed when linking against Chromiums libc++ which we currently
do not ship / expose the symbols of.  We probably should make those symbols visible and
actually ensure that electron-rebuild et. al link against our libc++ instead of the system libc++
but for now this fixes compilation issues on macOS where the default system clang links to the system libc++
which does not (obviously) use the Chromium ABI namespace.

For our nan tests which do link against Chromiums libc++ we define the ABI namespace in the spec runner.

Co-authored-by: Samuel Attard <sam@electronjs.org>
2022-07-18 08:16:56 -07:00
Sudowoodo Release Bot
99724da33b Bump v20.0.0-beta.9 2022-07-14 06:31:14 -07:00
trop[bot]
76975dfefd fix: enable deviceName validation on Linux (#34901) 2022-07-14 09:38:23 +02:00
trop[bot]
8313ea461e fix: alwaysOnTop browser window option for X11 Linux (#34913)
fix: alwaysontop browser window option for x11

Co-authored-by: Gellert Hegyi <gellert.hegyi@around.co>
2022-07-14 09:23:33 +02:00
trop[bot]
2c0327c394 fix: update Windows caption buttons to match Win11 style (#34888)
* fix: update Windows caption buttons to match Win11 style

* chore: fix const issue

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-13 09:37:10 +02:00
trop[bot]
603a4af5ee fix: ensure that requestMediaKeySystemAccess resolves (#34891)
When widevine was disabled at the build level we never dealt with the callback passed into GetSupportedKeySystems.  This was ok until requests became marked pending in https://chromium-review.googlesource.com/c/chromium/src/+/3430502 until the callback was called.  This resulted in a promise never resolving / rejecting and certain media websites (E.g. spotify) hanging on load waiting for a signal that would never arrive.

Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-07-12 10:56:09 -07:00
trop[bot]
5a121dd077 fix: safer check for WCO button updates (#34875)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-12 15:51:20 +02:00
electron-roller[bot]
db0830e0f8 chore: bump chromium to 104.0.5112.39 (20-x-y) (#34425)
* chore: bump chromium in DEPS to 104.0.5098.0

* chore: bump chromium in DEPS to 104.0.5100.0

* chore: bump chromium in DEPS to 104.0.5102.0

* chore: bump chromium in DEPS to 104.0.5103.0

* chore: bump chromium in DEPS to 104.0.5104.0

* chore: bump chromium in DEPS to 104.0.5106.0

* chore: bump chromium in DEPS to 104.0.5108.0

* chore: bump chromium in DEPS to 104.0.5110.0

* chore: bump chromium in DEPS to 104.0.5112.0

* chore: bump chromium in DEPS to 104.0.5112.4

* 3651284: Use the entry settings object for window.open navigation

https://chromium-review.googlesource.com/c/chromium/src/+/3651284
(cherry picked from commit 6ff37a08f7)

* 3644598: Make RenderFrameHost used for notification permission decision

https://chromium-review.googlesource.com/c/chromium/src/+/3644598
(cherry picked from commit 46df809556)

* 3642842: Window Placement: Prototype Fullscreen Capability Delegation - Part 2

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

* 3652785: [sandbox] Enable sandboxed pointers on sanitizer builds

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

* 3611967: webhid: Migrate HidDelegate to use BrowserContext and Origin

https://chromium-review.googlesource.com/c/chromium/src/+/3611967
(cherry picked from commit 18aac8e93e)

* 3665762: Remove RenderFrameHost::IsRenderFrameCreated from //content/.

https://chromium-review.googlesource.com/c/chromium/src/+/3665762
(cherry picked from commit 070ea1700b)

* 3659375: Fold x509_util_ios and most of x509_util_mac into x509_util_apple

https://chromium-review.googlesource.com/c/chromium/src/+/3659375
(cherry picked from commit 479647e0ac)

* 3656234: [CodeHealth] Remove uses of base::ListValue::Append() (Final, take 2)

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

* chore: update patch indices

(cherry picked from commit 8d666da975)

* chore: fix lint

(cherry picked from commit f9a9aca456)

* 3644598: Make RenderFrameHost used for notification permission decision

https://chromium-review.googlesource.com/c/chromium/src/+/3644598
(cherry picked from commit 014c4b9212)

* webhid: Migrate HidDelegate to use BrowserContext and Origin

This is a temporary fix for  https://chromium-review.googlesource.com/c/chromium/src/+/3611967 to get the build compiling, but we need to either patch around  https://chromium-review.googlesource.com/c/chromium/src/+/3611967 or move our device permissioning to BrowserContext

(cherry picked from commit 322e9686da)

* chore: fix lint

(cherry picked from commit 12b886cc62)

* build: run electron/script/gen-libc++-filenames.js

fixes gn check

(cherry picked from commit 93cebfecb2)

* chore: disable flaking tests

(cherry picked from commit fd0bc08f44)

* 3652749: Delete GLRenderer and related classes

https://chromium-review.googlesource.com/c/chromium/src/+/3652749
(cherry picked from commit 43024a74c2)

* 3682394: Change pipes surrounding code references in comments to backticks

https://chromium-review.googlesource.com/c/chromium/src/+/3682394
(cherry picked from commit 41026ae4d0)

* chore: fixup patch indices

(cherry picked from commit fccfc1bb29)

* 3671199: Remove ContentMainDelegate::PostFieldTrialInitialization

https://chromium-review.googlesource.com/c/chromium/src/+/3671199
(cherry picked from commit 6392cfb595)

* 3607963: hid: Do not exclude HID device with no collections

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

* refactor: use ElectronBrowserContext instead of WebContents to persist devices

due to changes like https://chromium-review.googlesource.com/c/chromium/src/+/3611967,
we can no longer use WebContents to store device permissions so this commit
moves device permission storage to live in memory in ElectronBrowserContext
instead.

(cherry picked from commit 2f95568bfd)

* 3557253: Deprecate some signature checks

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

* 3680781: Add policy for Renderer App Container.

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

* chore: update patch indices

(cherry picked from commit 40c6295a5b)

* 3675465: Update NetLog network service API to use mojom::DictionaryValue.

https://chromium-review.googlesource.com/c/chromium/src/+/3675465
(cherry picked from commit 55a58418e6)

* fix: add patch for DCHECK in fullscreen test

(cherry picked from commit c65280306d)

* build: fix nan build

(cherry picked from commit c06ea18698)

* build: make the nan spec runner work on macOS

(cherry picked from commit a22950b126)

* chore: update patches

(cherry picked from commit 7375148f93)

* chore: update patches

* 3693745: Delete base::LowerCaseEqualsASCII()

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3693745
(cherry picked from commit ed192f5c9b)

* 3653285: Remove OS X 10.11 and macOS 10.12 code from chrome/

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

* 3687395: Remove DictionaryValue::HasKey().

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3687395
(cherry picked from commit 2a6804db60)

* 3691014: Prevent unsafe narrowing: ui/accessibility, part 2

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3691014
(cherry picked from commit fca99a5cf9)

* 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors.

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

* 3684873: [Bluetooth][Win/Linux] Add bluetooth pair confirmation prompt

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

* chore: missing includes in desktop_notification_controller

(cherry picked from commit 574fb7933d)

* 3685951: Reland "Make sure screen object is created once in tests."

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

* fixup: Reland "Make sure screen object is created once in tests."

* chore: bump chromium in DEPS to 104.0.5110.0

* chore: update patches

* Revert "3560567: [MSC] Porting GenerateStreams clients to handle stream vectors."

This reverts commit c9c1c534056404be22a2d81ae6df4d184654fa35.

* Revert "3691014: Prevent unsafe narrowing: ui/accessibility, part 2"

This reverts commit 08f7a35765fde0467ef44d773e943cf5998619ae.

* 3687671: [v8] Freeze flags after initialization

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

* fixup: 3687671: [v8] Freeze flags after initialization

* chore: bump chromium in DEPS to 104.0.5112.14

* chore: update patches

* 3691014: Prevent unsafe narrowing: ui/accessibility, part 2

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3691014
(cherry picked from commit fca99a5cf9)
(cherry picked from commit 08f7a35765fde0467ef44d773e943cf5998619ae)

* 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors.

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

* 3669226: Remove printing PostTask usage of IO thread

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

* chore: document breaking change

(cherry picked from commit d0991597c2)

* chore: update patches

* chore: remove deprecated AccessorSignatures

https://github.com/nodejs/nan/pull/941

* Revert "fixup: 3687671: [v8] Freeze flags after initialization"

This reverts commit a473727f39267327c7a77ec5056edd36b7c5b403.

* Revert "3687671: [v8] Freeze flags after initialization"

This reverts commit 7a8404be3c9d48a2e7ce877d749362f4754a9f17.

* 3687671: [v8] Freeze flags after initialization

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

* 52026: Do not allow md4 or md5 based signatures in X.509 certificates.

https://boringssl-review.googlesource.com/c/boringssl/+/52026

* chore: bump chromium in DEPS to 104.0.5112.20

* chore: update patches

patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch
is no longer needed because it was upstreamed via:
2527943: Allow static access to WasmCodeGeneration callback

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

* 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560567
(cherry picked from commit 797c3a1656)

* fixup! 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors.

(cherry picked from commit 9741ab73cf)

* fixup! 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors.

(cherry picked from commit 558ed59d86)

* chore: bump chromium in DEPS to 104.0.5112.29

* chore: update patches

* chore: bump chromium in DEPS to 104.0.5112.39

* chore: update patches

* chore: update patches

* Trigger Build

* 3695382: [ext-code-space] Fix CodeRange allocation logic

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

fixes https://bugs.chromium.org/p/v8/issues/detail?id=12942

* 3695382: [ext-code-space] Fix CodeRange allocation logic

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

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Samuel Attard <sattard@salesforce.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Jeremy Rose <japthorp@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-07-12 08:22:53 -04:00
trop[bot]
3ca5708faa fix: set Wayland application ID (#34879) 2022-07-12 09:37:40 +02:00
trop[bot]
688780aa85 build: run CI tests on Xcode 13.3.0 (#34871)
* build: test disabling security

* build: install python2 during tests

* build: do not install python2 on arm64 runners

* attempt 2

* build: only allow 13.3.0 xcode

Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-07-11 11:24:15 -07:00
Sudowoodo Release Bot
7e53953fbf Bump v20.0.0-beta.8 2022-07-11 06:30:55 -07:00
trop[bot]
4cc3b85adc fix: WCO pressed background state updates (#34840)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-11 17:21:40 +09:00
trop[bot]
efa621f76d fix: setRepresentedFilename with non-default titlebarStyle (#34849)
fix: setRepresentedFilename with non-default titlebarStyle

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-11 17:19:39 +09:00
trop[bot]
659b2c3c52 test: add first-party-set chromium tests (#34842)
test: add first-part-set chromium feature tests

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-07-08 09:44:28 -07:00
Sudowoodo Release Bot
aba5e9892d Bump v20.0.0-beta.7 2022-07-08 04:54:51 -07:00
trop[bot]
c10eeceb93 fix: ensure v8 pointer compression + sandbox is enabled on 64bit native modules (#34851)
* fix: ensure v8 pointer compression + sandbox is enabled on 64bit native modules

* build: rely on config.gypi to enable pointer compression

* Update .patches

* Update build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch

* chore: update patches

Co-authored-by: Samuel Attard <sattard@salesforce.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-07-08 04:51:39 -07:00
Sudowoodo Release Bot
ce2dcdf42f Bump v20.0.0-beta.6 2022-07-07 06:30:34 -07:00
trop[bot]
283ddb684f fix: <datalist> bounds vertical cutoff (#34786)
fix: DataList bounds overflow

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-05 12:22:35 -04:00
Sudowoodo Release Bot
5100807a6a Bump v20.0.0-beta.5 2022-07-04 06:31:28 -07:00
trop[bot]
9d7b59e37d docs: document the removal of IA32 Linux support (#34806)
* docs: document the removal of IA32 Linux support

Chromium had dropped support for IA32 Linux, so the Chromium
102.0.4999.0 upgrade PR,
https://github.com/electron/electron/pull/33731, had introduced the commit,
389ef0731e,
to drop support for IA32 Linux but the change landed without an addition
to the documentation for the breaking changes, so this PR adds that.

Closes: https://github.com/electron/electron/issues/34783
Refs: https://bugs.chromium.org/p/chromium/issues/detail?id=1194538
Signed-off-by: Darshan Sen <raisinten@gmail.com>

* Update docs/breaking-changes.md

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>

Co-authored-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2022-06-30 11:48:24 -07:00
Keeley Hammond
67957aac67 docs: expand tutorial (#34604) (#34797)
* docs: base tutorial update

* more docs

* zzz

* remove unused images

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2022-06-30 10:07:35 -07:00
Sudowoodo Release Bot
e774d4f348 Bump v20.0.0-beta.4 2022-06-30 06:31:12 -07:00
trop[bot]
3e18fba853 fix: resolve symlinks when computing relative asar paths for integrity (#34779)
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-06-29 12:54:12 -07:00
trop[bot]
fa1382d980 build: remove appveyor hook to defunct service (#34792)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-29 19:33:07 +02:00
trop[bot]
8f738edc40 docs: replace broken Windows taskbar images (#34754)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2022-06-28 10:08:32 +02:00
Sudowoodo Release Bot
5b4577af20 Bump v20.0.0-beta.3 2022-06-27 06:31:23 -07:00
trop[bot]
cf38b9e375 refactor: load webFrame via process._linkedBinding in security-warnings.ts (#34748)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-06-27 14:12:34 +02:00
trop[bot]
bbc84b0e9a fix: WCO respects maximizable/closable/minimizable (#34721)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-26 10:15:02 +02:00
Sudowoodo Release Bot
c655ed075a Bump v20.0.0-beta.2 2022-06-23 06:30:53 -07:00
trop[bot]
c48e0b8ab6 feat: add panel support for BrowserWindow (#34665)
* feat: add NSPanel support for BrowserWindow

* change header guard to satisfy linter

* change panel wording in browser-window

* Revert "change panel wording in browser-window"

This reverts commit 6f3f80f94a.

* change wording in browser-window

* Update shell/browser/ui/cocoa/electron_native_widget_mac.mm

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

* Update shell/browser/ui/cocoa/electron_native_widget_mac.h

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

* Changed ScopedDisableResize class to allow for nesting

Co-authored-by: andreiisaila <andreiisaila@microsoft.com>
Co-authored-by: isailaandrei <isailaandrei.i@gmail.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2022-06-22 15:42:28 -04:00
trop[bot]
46d609fc2c fix: window button visibility fullscreen interaction (#34675)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-22 12:27:22 +02:00
trop[bot]
03fe3c42d4 chore: move main process only accessible API bindings away from common (#34672)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-06-21 13:54:16 -07:00
trop[bot]
952e2905b9 chore: let result: ReturnType<typeof this._callWindowOpenHandler>; (#34669)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-06-21 13:53:49 -07:00
Sudowoodo Release Bot
7619dd51bf Bump v20.0.0-beta.1 2022-06-21 09:11:51 -07:00
trop[bot]
e2b823fb07 fix: overzealous media key listening on Windows (#34647)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-21 16:35:02 +09:00
trop[bot]
a1dcdc4664 build: mark existing Node.js flakes as dontcare (#34659)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-21 16:33:52 +09:00
trop[bot]
2b2900a2f1 fix: performance problem in crashReporter.start() on macOS (#34639)
* fix: performance problem in crashReporter.start() on macOS

This change reduces the duration of crashReporter.start() on Intel macOS
from 622 milliseconds to 257 milliseconds!

Backports https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3641386

  posix: Replace DoubleForkAndExec() with ForkAndSpawn()

  The DoubleForkAndExec() function was taking over 622 milliseconds to run
  on macOS 11 (BigSur) on Intel i5-1038NG7. I did some debugging by adding
  some custom traces and found that the fork() syscall is the bottleneck
  here, i.e., the first fork() takes around 359 milliseconds and the
  nested fork() takes around 263 milliseconds. Replacing the nested fork()
  and exec() with posix_spawn() reduces the time consumption to 257
  milliseconds!

  See https://github.com/libuv/libuv/pull/3064 to know why fork() is so
  slow on macOS and why posix_spawn() is a better replacement.

  Another point to note is that even base::LaunchProcess() from Chromium
  calls posix_spawnp() on macOS -
  8f8d82dea0:base/process/launch_mac.cc;l=295-296

  Change-Id: I25c6ee9629a1ae5d0c32b361b56a1ce0b4b0fd26
  Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3641386
  Reviewed-by: Mark Mentovai <mark@chromium.org>
  Commit-Queue: Mark Mentovai <mark@chromium.org>

Fixes: https://github.com/electron/electron/issues/34321
Signed-off-by: Darshan Sen <raisinten@gmail.com>

* Trigger Build

Co-authored-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-06-21 10:40:35 +09:00
trop[bot]
d87bad743c refactor: remove deprecated drag-and-drop code (#34649)
* refactor: remove deprecated drag-and-drop code

* Update shell/browser/ui/drag_util_mac.mm

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-06-20 15:55:17 -04:00
Sudowoodo Release Bot
33670ac928 Bump v20.0.0-alpha.7 2022-06-20 06:31:05 -07:00
trop[bot]
8ecbc11aa2 chore: fix BrowserView painting when origin updated (#34643)
chore: fix View painting when origin updated

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-20 16:41:42 +09:00
trop[bot]
4ab3b1d624 refactor: use stubs for gdk-pixbuf dependency (#34635)
* refactor: use stubs for gdk-pixbuf dependency

* Adjust build file

* Add includes

* Merge gdk_pixbuf stubs into gtk stubs

* Split pixbuf sigs into own file again

* Add initialization check

* Apply PR feedback

Co-authored-by: Raymond Zhao <raymondzhao@microsoft.com>
Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>
2022-06-20 16:40:12 +09:00
trop[bot]
bce95c4886 test: add missing page-title-updated event spec for webview (#34544)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-06-20 13:33:33 +09:00
trop[bot]
5b583c8808 feat: add immersive dark mode on windows (#34549)
feat: add immersive dark mode on windows (#33624)

* feat: add immersive dark mode

* fix syntax and add header

* add me

* Update fuses.json5

* fix: redraw title bar on dark mode change

* chore: SetWindowTheme doesn't seem to be needed

* chore: separate out Win 10 dark mode implementation

* final touches

* final touches

* chore: limit Win 10 to >= 20H1 and drop fuse

* fix types

* fix lint

Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2022-06-20 13:33:01 +09:00
trop[bot]
c20d6e54c5 fix: draggable regions updating on bounds change (#34612)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-20 13:30:39 +09:00
trop[bot]
ff7f2a5091 fix: make preload calculation identical between sandbox & non-sandboxed (#34585)
* fix: make preload calculation identical between sandbox & non-sandboxed

* fix test

* split IPCs

* fix ipc constant

* fix unneeded async function

* remove unused preloads blink preferences

* fix typings

Co-authored-by: Jeremy Rose <japthorp@slack-corp.com>
2022-06-20 10:02:49 +09:00
trop[bot]
10062c9a5b chore: warn when using the deprecated new-window event (#34593)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-06-20 10:00:10 +09:00
Sudowoodo Release Bot
82a6e9bd5a Bump v20.0.0-alpha.6 2022-06-16 06:31:00 -07:00
trop[bot]
10131e36f3 fix: crash when setWindowOpenHandler callback throws (#34547)
* fix: crash when setWindowOpenHandler throws

* refactor: throw as process uncaughtException event

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-15 14:25:41 +09:00
trop[bot]
37078297c6 fix: all files selection logic on linux (#34516)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-14 12:36:02 -04:00
trop[bot]
48f4ef65ed refactor: move duplicate code to RendererClientBase::ShouldLoadPreload helper (#34520)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-06-13 17:37:28 -04:00
trop[bot]
e174aac845 fix: make navigator.userAgentData non-empty (#34524)
fix: make navigator.userAgentData non-empty (#34481)

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2022-06-13 16:04:47 -04:00
trop[bot]
dd1a692aba chore: remove unused proxy-window-open.snapshot.txt (#34521)
chore: remove unused spec-main/fixtures/snapshots/proxy-window-open.snapshot.txt

Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-06-13 16:21:57 +02:00
Sudowoodo Release Bot
aa05c43994 Bump v20.0.0-alpha.5 2022-06-13 06:30:54 -07:00
trop[bot]
16561d08ae fix: update normal bounds prior to minimizing (#34486)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-13 11:17:42 +02:00
trop[bot]
edc0a47c89 fix: don't require glibc 2.29+ on linux arm64 builds (#34503)
* build: use sid sysroot for linux arm64

* try this

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-06-10 20:55:44 -04:00
Sudowoodo Release Bot
018e2aee8d Bump v20.0.0-alpha.4 2022-06-09 06:30:35 -07:00
trop[bot]
dd10a5ebf2 build: update clang-format script (#34479)
* build: fix clang-format script

* chore: remove python2 cases

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-09 11:13:57 +09:00
trop[bot]
2fe7d59437 chore: fix nan spec runner on macOS (#34462)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-09 09:54:58 +09:00
trop[bot]
a4a9210d2d chore: use --root instead of --project_root for cpplint (#34474)
--root has been improved upstream in depot_tools to better handle Windows:
https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3648533

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2022-06-08 12:17:41 -04:00
trop[bot]
69179bbfe7 fix: html fullscreen transitions stacking (#34468)
* fix: html fullscreen transitions stacking

* spec: move webview test to spec-main

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-08 11:33:17 +02:00
trop[bot]
b64b87a8d6 test: fix for flaky renderer crash test (#34454)
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2022-06-08 16:44:06 +09:00
trop[bot]
7bdc9d8039 fix: fullscreen windows aren't resizable on macOS (#34433)
* fix: fullscreen windows aren't resizable on macOS

* chore: GetStyleMask -> HasStyleMask

* chore: depreacate style names

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-06-06 15:03:51 -04:00
trop[bot]
cbe2a458c9 docs: fix did-frame-navigate example in webFrameMain docs (#34446)
docs: fix did-frame-navigate example in webFrameMain docs

Co-authored-by: Will Anderson <will@itsananderson.com>
2022-06-06 11:18:56 -04:00
Sudowoodo Release Bot
d20e547316 Bump v20.0.0-alpha.3 2022-06-06 06:30:51 -07:00
trop[bot]
bde27c7e6b fix: render process crash handling (#34432)
* fix: crash when renderer process is reused

Could occur when a renderer crashes and the same-origin URL is loaded again
which leads to reusing the renderer process.

* test: renderer process crash recovery

* fix: handle case which leads to render frame DCHECK

* fix: lint

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2022-06-02 19:53:12 -07:00
Sudowoodo Release Bot
d0d5e20efb Bump v20.0.0-alpha.2 2022-06-02 15:59:51 -07:00
trop[bot]
dc452de295 chore: increase timeout for electron-build step (#34429)
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2022-06-02 15:58:10 -07:00
trop[bot]
ade2b02e1c build: disable 32-bit Windows symbol generation (#34426)
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-06-02 11:14:04 -07:00
trop[bot]
73e3c29c94 fix: crash in WebFrameMain mojo connection when RenderFrameHost is nullptr (#34417)
* fix: crash when RenderFrameHost is nullptr

* chore: lint fix

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2022-06-02 09:44:10 -07:00
Sudowoodo Release Bot
24df260185 Revert "Bump v20.0.0-alpha.2"
This reverts commit 4fe31bd1aa.
2022-06-02 08:49:30 -07:00
Sudowoodo Release Bot
4fe31bd1aa Bump v20.0.0-alpha.2 2022-06-02 06:30:59 -07:00
electron-roller[bot]
948949f83d chore: bump chromium to 104.0.5073.0 (20-x-y) (#34352) 2022-06-02 10:54:37 +02:00
trop[bot]
bba63609f2 ci: cache python install to better deal with download errors. (#34409)
* ci: cache python install to better deal with download errors.

* chore: use our CDN to download python2

* build: DRY up the python install steps

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-06-02 15:16:46 +09:00
trop[bot]
4b793692ea fix: zombie windows when fullscreening and closing (#34393)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-05-31 13:15:31 -04:00
trop[bot]
f3da81cb77 fix: hide content protected windows during screen capture with ScreenCaptureKitMac (#34384)
fix: hide content protected windows during screen capture

Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-05-31 15:33:17 +09:00
Sudowoodo Release Bot
6f8bf917f7 Bump v20.0.0-alpha.1 2022-05-25 06:26:17 -07:00
439 changed files with 13853 additions and 3927 deletions

View File

@@ -53,14 +53,8 @@ executors:
description: "macOS executor size"
type: enum
enum: ["macos.x86.medium.gen2", "large"]
xcode:
description: "xcode version"
default: 13.3.0
type: enum
enum: ["12.4.0", "13.3.0"]
macos:
xcode: << parameters.xcode >>
xcode: 13.3.0
resource_class: << parameters.size >>
# Electron Runners
@@ -125,6 +119,9 @@ env-apple-silicon: &env-apple-silicon
USE_PREBUILT_V8_CONTEXT_SNAPSHOT: 1
npm_config_arch: arm64
env-runner: &env-runner
IS_ELECTRON_RUNNER: 1
env-arm64: &env-arm64
GN_EXTRA_ARGS: 'target_cpu = "arm64" fatal_linker_warnings = false enable_linux_installer = false'
MKSNAPSHOT_TOOLCHAIN: //build/toolchain/linux:clang_arm64
@@ -219,6 +216,7 @@ step-maybe-cleanup-arm64-mac: &step-maybe-cleanup-arm64-mac
rm -rf ~/Library/Application\ Support/electron*
security delete-generic-password -l "Chromium Safe Storage" || echo "✓ Keychain does not contain password from tests"
security delete-generic-password -l "Electron Test Main Safe Storage" || echo "✓ Keychain does not contain password from tests"
security delete-generic-password -a "electron-test-safe-storage" || echo "✓ Keychain does not contain password from tests"
elif [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
XVFB=/usr/bin/Xvfb
/sbin/start-stop-daemon --stop --exec $XVFB || echo "Xvfb not running"
@@ -349,7 +347,7 @@ step-wait-for-goma: &step-wait-for-goma
sleep 5
done
echo "Goma ready"
no_output_timeout: 2m
no_output_timeout: 5m
step-restore-brew-cache: &step-restore-brew-cache
restore_cache:
@@ -457,7 +455,7 @@ step-delete-git-directories: &step-delete-git-directories
command: |
if [ "`uname`" == "Darwin" ]; then
cd src
( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" ) | xargs rm -rf
( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf
fi
# On macOS the yarn install command during gclient sync was run on a linux
@@ -511,6 +509,7 @@ step-install-signing-cert-on-mac: &step-install-signing-cert-on-mac
name: Import and trust self-signed codesigning cert on MacOS
command: |
if [ "$TARGET_ARCH" != "arm64" ] && [ "`uname`" == "Darwin" ]; then
sudo security authorizationdb write com.apple.trust-settings.admin allow
cd src/electron
./script/codesign/generate-identity.sh
fi
@@ -527,15 +526,6 @@ step-install-gnutar-on-mac: &step-install-gnutar-on-mac
ln -fs /usr/local/bin/gtar /usr/local/bin/tar
fi
step-install-python2-on-mac: &step-install-python2-on-mac
run:
name: Install python2 on macos
command: |
if [ "`uname`" == "Darwin" ]; then
curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg
sudo installer -pkg python-2.7.18-macosx10.9.pkg -target /
fi
step-gn-gen-default: &step-gn-gen-default
run:
name: Default GN gen
@@ -558,7 +548,7 @@ step-gn-check: &step-gn-check
step-electron-build: &step-electron-build
run:
name: Electron build
no_output_timeout: 30m
no_output_timeout: 60m
command: |
# On arm platforms we generate a cross-arch ffmpeg that ninja does not seem
# to realize is not correct / should be rebuilt. We delete it here so it is
@@ -823,7 +813,7 @@ step-maybe-zip-symbols: &step-maybe-zip-symbols
cd src
export BUILD_PATH="$PWD/out/Default"
ninja -C out/Default electron:licenses
ninja -C out/Default electron:electron_version
ninja -C out/Default electron:electron_version_file
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
step-maybe-cross-arch-snapshot: &step-maybe-cross-arch-snapshot
@@ -883,12 +873,12 @@ step-touch-sync-done: &step-touch-sync-done
step-maybe-restore-src-cache: &step-maybe-restore-src-cache
restore_cache:
keys:
- v14-src-cache-{{ checksum "src/electron/.depshash" }}
- v15-src-cache-{{ checksum "src/electron/.depshash" }}
name: Restoring src cache
step-maybe-restore-src-cache-marker: &step-maybe-restore-src-cache-marker
restore_cache:
keys:
- v14-src-cache-marker-{{ checksum "src/electron/.depshash" }}
- v15-src-cache-marker-{{ checksum "src/electron/.depshash" }}
name: Restoring src cache marker
# Restore exact or closest git cache based on the hash of DEPS and .circle-sync-done
@@ -964,13 +954,14 @@ step-minimize-workspace-size-from-checkout: &step-minimize-workspace-size-from-c
rm -rf third_party/electron_node/deps/openssl
rm -rf third_party/electron_node/deps/v8
rm -rf chrome/test/data/xr/webvr_info
rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
# Save the src cache based on the deps hash
step-save-src-cache: &step-save-src-cache
save_cache:
paths:
- /var/portal
key: v14-src-cache-{{ checksum "/var/portal/src/electron/.depshash" }}
key: v15-src-cache-{{ checksum "/var/portal/src/electron/.depshash" }}
name: Persisting src cache
step-make-src-cache-marker: &step-make-src-cache-marker
run:
@@ -980,7 +971,7 @@ step-save-src-cache-marker: &step-save-src-cache-marker
save_cache:
paths:
- .src-cache-marker
key: v14-src-cache-marker-{{ checksum "/var/portal/src/electron/.depshash" }}
key: v15-src-cache-marker-{{ checksum "/var/portal/src/electron/.depshash" }}
step-maybe-early-exit-no-doc-change: &step-maybe-early-exit-no-doc-change
run:
@@ -1011,7 +1002,7 @@ steps-electron-gn-check: &steps-electron-gn-check
- *step-checkout-electron
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-install-python2-on-mac
- install-python2-mac
- *step-setup-env-for-build
- *step-setup-goma-for-build
- *step-generate-deps-hash
@@ -1041,6 +1032,7 @@ steps-tests: &steps-tests
- *step-setup-linux-for-headless-testing
- *step-restore-brew-cache
- *step-fix-known-hosts-linux
- install-python2-mac
- *step-install-signing-cert-on-mac
- run:
@@ -1130,6 +1122,31 @@ steps-test-node: &steps-test-node
# Command Aliases
commands:
install-python2-mac:
steps:
- restore_cache:
keys:
- v2.7.18-python-cache-{{ arch }}
name: Restore python cache
- run:
name: Install python2 on macos
command: |
if [ "`uname`" == "Darwin" ] && [ "$IS_ELECTRON_RUNNER" != "1" ]; then
if [ ! -f "python-downloads/python-2.7.18-macosx10.9.pkg" ]; then
mkdir python-downloads
echo 'Downloading Python 2.7.18'
curl -O https://dev-cdn.electronjs.org/python/python-2.7.18-macosx10.9.pkg
mv python-2.7.18-macosx10.9.pkg python-downloads
else
echo 'Using Python install from cache'
fi
sudo installer -pkg python-downloads/python-2.7.18-macosx10.9.pkg -target /
fi
- save_cache:
paths:
- python-downloads
key: v2.7.18-python-cache-{{ arch }}
name: Persisting python cache
maybe-restore-portaled-src-cache:
parameters:
halt-if-successful:
@@ -1296,7 +1313,7 @@ commands:
- run: rm -rf src/electron
- *step-restore-brew-cache
- *step-install-gnutar-on-mac
- *step-install-python2-on-mac
- install-python2-mac
- *step-save-brew-cache
- when:
condition: << parameters.build >>
@@ -1488,7 +1505,7 @@ commands:
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-restore-brew-cache
- *step-install-python2-on-mac
- install-python2-mac
- *step-get-more-space-on-mac
- when:
condition: << parameters.checkout >>
@@ -2028,7 +2045,6 @@ jobs:
osx-testing-x64-tests:
executor:
name: macos
xcode: 12.4.0
size: macos.x86.medium.gen2
environment:
<<: *env-mac-large
@@ -2042,12 +2058,12 @@ jobs:
<<: *env-mac-large
<<: *env-stack-dumping
<<: *env-apple-silicon
<<: *env-runner
<<: *steps-tests
mas-testing-x64-tests:
executor:
name: macos
xcode: 12.4.0
size: macos.x86.medium.gen2
environment:
<<: *env-mac-large
@@ -2061,6 +2077,7 @@ jobs:
<<: *env-mac-large
<<: *env-stack-dumping
<<: *env-apple-silicon
<<: *env-runner
<<: *steps-tests
# List all workflows

View File

@@ -1,2 +0,0 @@
# Always validate the PR title, and ignore the commits
titleOnly: true

View File

@@ -0,0 +1,178 @@
name: Electron WOA Testing
on:
push:
branches: '**'
workflow_dispatch:
inputs:
appveyor_job_id:
description: 'Job Id of Appveyor WOA job to test'
type: text
required: true
jobs:
electron-woa-init:
if: ${{ github.event_name == 'push' && github.repository == 'electron/electron' }}
runs-on: ubuntu-latest
steps:
- name: Dummy step for push event
run: |
echo "This job is a needed initialization step for Electron WOA testing. Another test result will appear once the electron-woa-testing build is done."
electron-woa-testing:
if: ${{ github.event_name == 'workflow_dispatch' && github.repository == 'electron/electron' }}
runs-on: [self-hosted, woa]
permissions:
checks: write
pull-requests: write
steps:
- uses: LouisBrunner/checks-action@v1.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
status: in_progress
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"Test In Progress","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
- name: Clean Workspace
run: |
Remove-Item * -Recurse -Force
shell: powershell
- name: Checkout
uses: actions/checkout@v3
with:
path: src\electron
fetch-depth: 0
- name: Yarn install
run: |
cd src\electron
node script/yarn.js install --frozen-lockfile
- name: Download and extract dist.zip for test
run: |
$localArtifactPath = "$pwd\dist.zip"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/dist.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\Default -y $localArtifactPath
shell: powershell
- name: Download and extract native test executables for test
run: |
$localArtifactPath = "src\out\Default\shell_browser_ui_unittests.exe"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/shell_browser_ui_unittests.exe"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
shell: powershell
- name: Download and extract ffmpeg.zip for test
run: |
$localArtifactPath = "$pwd\ffmpeg.zip"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/ffmpeg.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\ffmpeg $localArtifactPath
shell: powershell
- name: Download node headers for test
run: |
$localArtifactPath = "src\node_headers.zip"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/node_headers.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
cd src
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y node_headers.zip
shell: powershell
- name: Download electron.lib for test
run: |
$localArtifactPath = "src\out\Default\electron.lib"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/electron.lib"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
shell: powershell
# Uncomment the following block if pdb files are needed to debug issues
# - name: Download pdb files for detailed stacktraces
# if: ${{ github.event_name == 'workflow_dispatch' }}
# run: |
# try {
# $localArtifactPath = "src\pdb.zip"
# $serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/pdb.zip"
# Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
# cd src
# & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip
# } catch {
# Write-Host "There was an exception encountered while downloading pdb files:" $_.Exception.Message
# } finally {
# $global:LASTEXITCODE = 0
# }
# shell: powershell
- name: Setup node headers
run: |
New-Item src\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path src\out\Default\electron.lib -destination src\out\Default\gen\node_headers\Release\node.lib
shell: powershell
- name: Run Electron Main process tests
run: |
cd src
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
set npm_config_arch=arm64
cd electron
node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
env:
ELECTRON_ENABLE_STACK_DUMPING: true
ELECTRON_OUT_DIR: Default
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
- name: Run Electron Remote based tests
if: ${{ success() || failure() }}
run: |
cd src
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
set npm_config_arch=arm64
cd electron
node script/yarn test --runners=remote --enable-logging --disable-features=CalculateNativeWinOcclusion
env:
ELECTRON_OUT_DIR: Default
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
- name: Verify ffmpeg
run: |
cd src
echo "Verifying non proprietary ffmpeg"
python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
shell: cmd
- name: Kill processes left running from last test run
if: ${{ always() }}
run: |
Get-Process | Where Name -Like "electron*" | Stop-Process
Get-Process | Where Name -Like "msedge*" | Stop-Process
shell: powershell
- name: Delete user app data directories
if: ${{ always() }}
run: |
Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore
shell: powershell
- uses: LouisBrunner/checks-action@v1.1.1
if: ${{ success() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
conclusion: "${{ job.status }}"
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"${{ job.status }}","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
- uses: LouisBrunner/checks-action@v1.1.1
if: ${{ success() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
conclusion: "${{ job.status }}"
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"Job Succeeded","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
- uses: LouisBrunner/checks-action@v1.1.1
if: ${{ ! success() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
conclusion: "${{ job.status }}"
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"Job Failed","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}

View File

@@ -23,7 +23,5 @@
"br_spaces": 0
},
"single-h1": false,
"no-inline-html": {
"allowed_elements": ["br"]
}
"no-inline-html": false
}

View File

@@ -37,7 +37,7 @@ if (is_mac) {
import("build/rules.gni")
assert(
mac_deployment_target == "10.11.0",
mac_deployment_target == "10.13",
"Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change")
}
@@ -87,7 +87,10 @@ if (is_linux) {
# implementation. In future, this file can be extended to contain
# gtk4 stubs to switch gtk version in runtime.
generate_stubs("electron_gtk_stubs") {
sigs = [ "shell/browser/ui/electron_gtk.sigs" ]
sigs = [
"shell/browser/ui/electron_gdk_pixbuf.sigs",
"shell/browser/ui/electron_gtk.sigs",
]
extra_header = "shell/browser/ui/electron_gtk.fragment"
output_name = "electron_gtk_stubs"
public_deps = [ "//ui/gtk:gtk_config" ]
@@ -104,6 +107,14 @@ branding = read_file("shell/app/BRANDING.json", "json")
electron_project_name = branding.project_name
electron_product_name = branding.product_name
electron_mac_bundle_id = branding.mac_bundle_id
electron_version = exec_script("script/print-version.py",
[],
"trim string",
[
".git/packed-refs",
".git/HEAD",
"script/lib/get-version.js",
])
if (is_mas_build) {
assert(is_mac,
@@ -230,6 +241,7 @@ action("electron_js2c") {
action("generate_config_gypi") {
outputs = [ "$root_gen_dir/config.gypi" ]
script = "script/generate-config-gypi.py"
inputs = [ "//third_party/electron_node/configure.py" ]
args = rebase_path(outputs) + [ target_cpu ]
}
@@ -298,12 +310,9 @@ npm_action("electron_version_args") {
outputs = [ "$target_gen_dir/electron_version.args" ]
args = rebase_path(outputs)
args = rebase_path(outputs) + [ "$electron_version" ]
inputs = [
"ELECTRON_VERSION",
"script/generate-version-json.js",
]
inputs = [ "script/generate-version-json.js" ]
}
templated_file("electron_version_header") {
@@ -315,6 +324,39 @@ templated_file("electron_version_header") {
args_files = get_target_outputs(":electron_version_args")
}
templated_file("electron_win_rc") {
deps = [ ":electron_version_args" ]
template = "build/templates/electron_rc.tmpl"
output = "$target_gen_dir/win-resources/electron.rc"
args_files = get_target_outputs(":electron_version_args")
}
copy("electron_win_resource_files") {
sources = [
"shell/browser/resources/win/electron.ico",
"shell/browser/resources/win/resource.h",
]
outputs = [ "$target_gen_dir/win-resources/{{source_file_part}}" ]
}
templated_file("electron_version_file") {
deps = [ ":electron_version_args" ]
template = "build/templates/version_string.tmpl"
output = "$root_build_dir/version"
args_files = get_target_outputs(":electron_version_args")
}
group("electron_win32_resources") {
public_deps = [
":electron_win_rc",
":electron_win_resource_files",
]
}
action("electron_fuses") {
script = "build/fuses/build.py"
@@ -371,6 +413,7 @@ source_set("electron_lib") {
"//chrome/app/resources:platform_locale_settings",
"//components/autofill/core/common:features",
"//components/certificate_transparency",
"//components/embedder_support:browser_util",
"//components/language/core/browser",
"//components/net_log",
"//components/network_hints/browser",
@@ -398,9 +441,6 @@ source_set("electron_lib") {
"//media/mojo/mojom",
"//net:extras",
"//net:net_resources",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/shared_impl",
"//printing/buildflags",
"//services/device/public/cpp/geolocation",
"//services/device/public/cpp/hid",
@@ -611,7 +651,12 @@ source_set("electron_lib") {
}
if (enable_plugins) {
deps += [ "chromium_src:plugins" ]
deps += [
"chromium_src:plugins",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/shared_impl",
]
sources += [
"shell/renderer/pepper_helper.cc",
"shell/renderer/pepper_helper.h",
@@ -726,14 +771,6 @@ source_set("electron_lib") {
sources += get_target_outputs(":electron_fuses")
if (is_win && enable_win_dark_mode_window_ui) {
sources += [
"shell/browser/win/dark_mode.cc",
"shell/browser/win/dark_mode.h",
]
libs += [ "uxtheme.lib" ]
}
if (allow_runtime_configurable_key_storage) {
defines += [ "ALLOW_RUNTIME_CONFIGURABLE_KEY_STORAGE" ]
}
@@ -753,7 +790,6 @@ if (is_mac) {
electron_helper_name = "$electron_product_name Helper"
electron_login_helper_name = "$electron_product_name Login Helper"
electron_framework_version = "A"
electron_version = read_file("ELECTRON_VERSION", "trim string")
mac_xib_bundle_data("electron_xibs") {
sources = [ "shell/common/resources/mac/MainMenu.xib" ]
@@ -1187,6 +1223,7 @@ if (is_mac) {
":default_app_asar",
":electron_app_manifest",
":electron_lib",
":electron_win32_resources",
":packed_resources",
"//components/crash/core/app",
"//content:sandbox_helper_win",
@@ -1220,8 +1257,7 @@ if (is_mac) {
if (is_win) {
sources += [
# TODO: we should be generating our .rc files more like how chrome does
"shell/browser/resources/win/electron.rc",
"$target_gen_dir/win-resources/electron.rc",
"shell/browser/resources/win/resource.h",
]
@@ -1403,15 +1439,10 @@ group("licenses") {
]
}
copy("electron_version") {
sources = [ "ELECTRON_VERSION" ]
outputs = [ "$root_build_dir/version" ]
}
dist_zip("electron_dist_zip") {
data_deps = [
":electron_app",
":electron_version",
":electron_version_file",
":licenses",
]
if (is_linux) {

2
DEPS
View File

@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'103.0.5044.0',
'104.0.5112.124',
'node_version':
'v16.15.0',
'nan_version':

View File

@@ -1 +0,0 @@
20.0.0-nightly.20220524

View File

@@ -38,7 +38,7 @@ For more installation options and troubleshooting tips, see
Each Electron release provides binaries for macOS, Windows, and Linux.
* macOS (El Capitan and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
* macOS (High Sierra and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
* Windows (Windows 7 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8.
* Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on:
* Ubuntu 14.04 and newer

View File

@@ -34,16 +34,6 @@ environment:
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
method: POST
headers:
x-mission-control-secret:
secure: 90BLVPcqhJPG7d24v0q/RRray6W3wDQ8uVQlQjOHaBWkw1i8FoA1lsjr2C/v1dVok+tS2Pi6KxDctPUkwIb4T27u4RhvmcPzQhVpfwVJAG9oNtq+yKN7vzHfg7k/pojEzVdJpQLzeJGcSrZu7VY39Q==
on_build_success: false
on_build_failure: true
on_build_status_changed: false
build_script:
- ps: >-
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
@@ -188,14 +178,14 @@ build_script:
}
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python electron\script\zip-symbols.py
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
@@ -216,11 +206,11 @@ test_script:
- if "%RUN_TESTS%"=="true" ( echo Running remote test suite & node script/yarn test -- --trace-uncaught --runners=remote --runTestFilesSeperately --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
- if "%RUN_TESTS%"=="true" ( echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
- cd ..
- if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg )
- if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python3 electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg )
- echo "About to verify mksnapshot"
- if "%RUN_TESTS%"=="true" ( echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd% )
- if "%RUN_TESTS%"=="true" ( echo Verifying mksnapshot & python3 electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd% )
- echo "Done verifying mksnapshot"
- if "%RUN_TESTS%"=="true" ( echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd% )
- if "%RUN_TESTS%"=="true" ( echo Verifying chromedriver & python3 electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd% )
- echo "Done verifying chromedriver"
deploy_script:
- cd electron
@@ -228,13 +218,13 @@ deploy_script:
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python script\release\uploaders\upload.py --verbose --upload_to_storage
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python script\release\uploaders\upload.py --verbose
& python3 script\release\uploaders\upload.py --verbose
}
} elseif (Test-Path Env:\TEST_WOA) {
node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
node script/release/ci-release-build.js --job=electron-woa-testing --ci=GHA --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
}
on_finish:
# Uncomment this lines to enable RDP

View File

@@ -1,121 +0,0 @@
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: src/electron'
inputs:
TargetFolder: src/electron
- bash: |
cd src/electron
node script/yarn.js install --frozen-lockfile
displayName: 'Yarn install'
- bash: |
export ZIP_DEST=$PWD/src/out/Default
echo "##vso[task.setvariable variable=ZIP_DEST]$ZIP_DEST"
mkdir -p $ZIP_DEST
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=dist.zip --dest=$ZIP_DEST
cd $ZIP_DEST
unzip -o dist.zip
xattr -cr Electron.app
displayName: 'Download and unzip dist files for test'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
export FFMPEG_ZIP_DEST=$PWD/src/out/ffmpeg
mkdir -p $FFMPEG_ZIP_DEST
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=ffmpeg.zip --dest=$FFMPEG_ZIP_DEST
cd $FFMPEG_ZIP_DEST
unzip -o ffmpeg.zip
displayName: 'Download and unzip ffmpeg for test'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
export NODE_HEADERS_DEST=$PWD/src/out/Default/gen
mkdir -p $NODE_HEADERS_DEST
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=node_headers.tar.gz --dest=$NODE_HEADERS_DEST
cd $NODE_HEADERS_DEST
tar xzf node_headers.tar.gz
displayName: 'Download and untar node header files for test'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
export CROSS_ARCH_SNAPSHOTS=$PWD/src/out/Default/cross-arch-snapshots
mkdir -p $CROSS_ARCH_SNAPSHOTS
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/snapshot_blob.bin --dest=$CROSS_ARCH_SNAPSHOTS
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/v8_context_snapshot.arm64.bin --dest=$CROSS_ARCH_SNAPSHOTS
displayName: 'Download cross arch snapshot files'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
cd src
export ELECTRON_OUT_DIR=Default
export npm_config_arch=arm64
(cd electron && node script/yarn test --enable-logging --runners main)
displayName: 'Run Electron main tests'
timeoutInMinutes: 20
env:
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
- bash: |
cd src
export ELECTRON_OUT_DIR=Default
export npm_config_arch=arm64
(cd electron && node script/yarn test --enable-logging --runners remote)
displayName: 'Run Electron remote tests'
timeoutInMinutes: 20
condition: succeededOrFailed()
env:
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
- bash: |
cd src
python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg
displayName: Verify non proprietary ffmpeg
timeoutInMinutes: 5
condition: succeededOrFailed()
env:
TARGET_ARCH: arm64
- bash: |
cd src
echo Verify cross arch snapshot
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/out/Default/cross-arch-snapshots
displayName: Verify cross arch snapshot
timeoutInMinutes: 5
condition: succeededOrFailed()
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFiles: '*.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/'
condition: succeededOrFailed()
- bash: killall Electron || echo "No Electron processes left running"
displayName: 'Kill processes left running from last test run'
condition: always()
- bash: |
rm -rf ~/Library/Application\ Support/Electron*
rm -rf ~/Library/Application\ Support/electron*
displayName: 'Delete user app data directories'
condition: always()
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
displayName: 'Clean Agent Directories'
condition: always()

View File

@@ -1,130 +0,0 @@
workspace:
clean: all
steps:
- checkout: self
path: src\electron
- script: |
node script/yarn.js install --frozen-lockfile
displayName: 'Yarn install'
- powershell: |
$localArtifactPath = "$pwd\dist.zip"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/dist.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -o$(Pipeline.Workspace)\src\out\Default -y $localArtifactPath
displayName: 'Download and extract dist.zip for test'
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
$localArtifactPath = "$(Pipeline.Workspace)\src\out\Default\shell_browser_ui_unittests.exe"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/shell_browser_ui_unittests.exe"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
displayName: 'Download and extract native test executables for test'
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
$localArtifactPath = "$pwd\ffmpeg.zip"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/ffmpeg.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -o$(Pipeline.Workspace)\src\out\ffmpeg $localArtifactPath
displayName: 'Download and extract ffmpeg.zip for test'
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
$localArtifactPath = "$(Pipeline.Workspace)\src\node_headers.zip"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/node_headers.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
cd $(Pipeline.Workspace)\src
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y node_headers.zip
displayName: 'Download node headers for test'
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
$localArtifactPath = "$(Pipeline.Workspace)\src\out\Default\electron.lib"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/electron.lib"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
displayName: 'Download electron.lib for test'
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
# Uncomment the following block if pdb files are needed to debug issues
# - powershell: |
# try {
# $localArtifactPath = "$(Pipeline.Workspace)\src\pdb.zip"
# $serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/pdb.zip"
# Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
# cd $(Pipeline.Workspace)\src
# & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip
# } catch {
# Write-Host "There was an exception encountered while downloading pdb files:" $_.Exception.Message
# } finally {
# $global:LASTEXITCODE = 0
# }
# displayName: 'Download pdb files for detailed stacktraces'
# env:
# APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
New-Item $(Pipeline.Workspace)\src\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path $(Pipeline.Workspace)\src\out\Default\electron.lib -destination $(Pipeline.Workspace)\src\out\Default\gen\node_headers\Release\node.lib
displayName: 'Setup node headers'
- script: |
cd $(Pipeline.Workspace)\src
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
set npm_config_arch=arm64
cd electron
node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
displayName: 'Run Electron Main process tests'
env:
ELECTRON_ENABLE_STACK_DUMPING: true
ELECTRON_OUT_DIR: Default
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
- script: |
cd $(Pipeline.Workspace)\src
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
set npm_config_arch=arm64
cd electron
node script/yarn test --runners=remote --enable-logging --disable-features=CalculateNativeWinOcclusion
displayName: 'Run Electron Remote based tests'
env:
ELECTRON_OUT_DIR: Default
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
condition: succeededOrFailed()
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFiles: '*.xml'
searchFolder: '$(Pipeline.Workspace)/src/junit/'
condition: always()
- script: |
cd $(Pipeline.Workspace)\src
echo "Verifying non proprietary ffmpeg"
python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
displayName: 'Verify ffmpeg'
- powershell: |
Get-Process | Where Name Like "electron*" | Stop-Process
Get-Process | Where Name Like "msedge*" | Stop-Process
displayName: 'Kill processes left running from last test run'
condition: always()
- powershell: |
Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore
displayName: 'Delete user app data directories'
condition: always()

View File

@@ -45,3 +45,5 @@ enable_cet_shadow_stack = false
# V8 in the browser process.
# Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=281
is_cfi = false
v8_enable_sandboxed_pointers = false

View File

@@ -24,7 +24,11 @@ template("extract_symbols") {
assert(defined(invoker.binary), "Need binary to dump")
assert(defined(invoker.symbol_dir), "Need directory for symbol output")
dump_syms_label = "//third_party/breakpad:dump_syms($host_toolchain)"
if (host_os == "win" && target_cpu == "x86") {
dump_syms_label = "//third_party/breakpad:dump_syms(//build/toolchain/win:win_clang_x64)"
} else {
dump_syms_label = "//third_party/breakpad:dump_syms($host_toolchain)"
}
dump_syms_binary = get_label_info(dump_syms_label, "root_out_dir") +
"/dump_syms$_host_executable_suffix"

View File

@@ -7,5 +7,6 @@
"node_options": "1",
"node_cli_inspect": "1",
"embedded_asar_integrity_validation": "0",
"only_load_app_from_asar": "0"
"only_load_app_from_asar": "0",
"load_browser_process_specific_v8_snapshot": "0"
}

View File

@@ -50,8 +50,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 20,0,0,20220524
PRODUCTVERSION 20,0,0,20220524
FILEVERSION $major,$minor,$patch,$prerelease_number
PRODUCTVERSION $major,$minor,$patch,$prerelease_number
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -68,12 +68,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron"
VALUE "FileVersion", "20.0.0"
VALUE "FileVersion", "$major.$minor.$patch"
VALUE "InternalName", "electron.exe"
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
VALUE "OriginalFilename", "electron.exe"
VALUE "ProductName", "Electron"
VALUE "ProductVersion", "20.0.0"
VALUE "ProductVersion", "$major.$minor.$patch"
VALUE "SquirrelAwareVersion", "1"
END
END

View File

@@ -0,0 +1 @@
$full_version

View File

@@ -19,7 +19,6 @@ buildflag_header("buildflags") {
"ENABLE_ELECTRON_EXTENSIONS=$enable_electron_extensions",
"ENABLE_BUILTIN_SPELLCHECKER=$enable_builtin_spellchecker",
"ENABLE_PICTURE_IN_PICTURE=$enable_picture_in_picture",
"ENABLE_WIN_DARK_MODE_WINDOW_UI=$enable_win_dark_mode_window_ui",
"OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
]
}

View File

@@ -31,7 +31,4 @@ declare_args() {
# Enable Spellchecker support
enable_builtin_spellchecker = true
# Undocumented Windows dark mode API
enable_win_dark_mode_window_ui = false
}

View File

@@ -6,6 +6,7 @@ import("//build/config/ozone.gni")
import("//build/config/ui.gni")
import("//components/spellcheck/spellcheck_build_features.gni")
import("//electron/buildflags/buildflags.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
import("//third_party/widevine/cdm/widevine.gni")
@@ -55,6 +56,14 @@ static_library("chrome") {
"//chrome/browser/process_singleton.h",
"//chrome/browser/process_singleton_internal.cc",
"//chrome/browser/process_singleton_internal.h",
"//chrome/browser/themes/browser_theme_pack.cc",
"//chrome/browser/themes/browser_theme_pack.h",
"//chrome/browser/themes/custom_theme_supplier.cc",
"//chrome/browser/themes/custom_theme_supplier.h",
"//chrome/browser/themes/theme_properties.cc",
"//chrome/browser/themes/theme_properties.h",
"//chrome/browser/ui/color/chrome_color_mixers.cc",
"//chrome/browser/ui/color/chrome_color_mixers.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.cc",
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.cc",
@@ -69,7 +78,11 @@ static_library("chrome") {
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.h",
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.cc",
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.h",
"//chrome/browser/ui/frame/window_frame_util.cc",
"//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/ui/native_window_tracker.h",
"//chrome/browser/ui/ui_features.cc",
"//chrome/browser/ui/ui_features.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.cc",
@@ -109,6 +122,8 @@ static_library("chrome") {
"//chrome/browser/ui/view_ids.h",
"//chrome/browser/win/chrome_process_finder.cc",
"//chrome/browser/win/chrome_process_finder.h",
"//chrome/browser/win/titlebar_config.cc",
"//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/titlebar_config.h",
"//chrome/child/v8_crashpad_support_win.cc",
"//chrome/child/v8_crashpad_support_win.h",
@@ -130,6 +145,7 @@ static_library("chrome") {
public_deps = [
"//chrome/browser:dev_ui_browser_resources",
"//chrome/browser/ui/color:mixers",
"//chrome/common",
"//chrome/common:version_header",
"//components/keyed_service/content",
@@ -355,15 +371,20 @@ source_set("plugins") {
deps += [
"//components/strings",
"//media:media_buildflags",
"//ppapi/buildflags",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:ipc",
"//ppapi/shared_impl",
"//services/device/public/mojom",
"//skia",
"//storage/browser",
]
if (enable_plugins) {
deps += [
"//ppapi/buildflags",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:ipc",
"//ppapi/shared_impl",
]
}
}
# This source set is just so we don't have to depend on all of //chrome/browser

View File

@@ -83,7 +83,7 @@ function loadApplicationPackage (packagePath: string) {
});
try {
// Override app name and version.
// Override app's package.json data.
packagePath = path.resolve(packagePath);
const packageJsonPath = path.join(packagePath, 'package.json');
let appPath;
@@ -104,6 +104,16 @@ function loadApplicationPackage (packagePath: string) {
} else if (packageJson.name) {
app.name = packageJson.name;
}
if (packageJson.desktopName) {
app.setDesktopName(packageJson.desktopName);
} else {
app.setDesktopName(`${app.name}.desktop`);
}
// Set v8 flags, deliberately lazy load so that apps that do not use this
// feature do not pay the price
if (packageJson.v8Flags) {
require('v8').setFlagsFromString(packageJson.v8Flags);
}
appPath = packagePath;
}

View File

@@ -68,10 +68,8 @@ an issue:
* [Mac App Store](tutorial/mac-app-store-submission-guide.md)
* [Windows Store](tutorial/windows-store-guide.md)
* [Snapcraft](tutorial/snapcraft.md)
* [ASAR Archives](tutorial/asar-archives.md)
* [Updates](tutorial/updates.md)
* [Deploying an Update Server](tutorial/updates.md#deploying-an-update-server)
* [Implementing Updates in Your App](tutorial/updates.md#implementing-updates-in-your-app)
* [Applying Updates](tutorial/updates.md#applying-updates)
* [Getting Support](tutorial/support.md)
## Detailed Tutorials
@@ -85,7 +83,6 @@ These individual tutorials expand on topics discussed in the guide above.
* Electron Releases & Developer Feedback
* [Versioning Policy](tutorial/electron-versioning.md)
* [Release Timelines](tutorial/electron-timelines.md)
* [Testing Widevine CDM](tutorial/testing-widevine-cdm.md)
---

View File

@@ -246,7 +246,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
* `trafficLightPosition` [Point](structures/point.md) (optional) _macOS_ -
Set a custom position for the traffic light buttons in frameless windows.
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
should have rounded corners on macOS. Default is `true`.
should have rounded corners on macOS. Default is `true`. Setting this property
to `false` will prevent the window from being fullscreenable.
* `fullscreenWindowTitle` boolean (optional) _macOS_ _Deprecated_ - Shows
the title in the title bar in full screen mode on macOS for `hiddenInset`
titleBarStyle. Default is `false`.
@@ -425,13 +426,17 @@ Possible values are:
* On Linux, possible types are `desktop`, `dock`, `toolbar`, `splash`,
`notification`.
* On macOS, possible types are `desktop`, `textured`.
* On macOS, possible types are `desktop`, `textured`, `panel`.
* The `textured` type adds metal gradient appearance
(`NSTexturedBackgroundWindowMask`).
(`NSWindowStyleMaskTexturedBackground`).
* The `desktop` type places the window at the desktop background window level
(`kCGDesktopWindowLevel - 1`). Note that desktop window will not receive
focus, keyboard or mouse events, but you can use `globalShortcut` to receive
input sparingly.
* The `panel` type enables the window to float on top of full-screened apps
by adding the `NSWindowStyleMaskNonactivatingPanel` style mask,normally
reserved for NSPanel, at runtime. Also, the window will appear on all
spaces (desktops).
* On Windows, possible type is `toolbar`.
### Instance Events
@@ -1319,7 +1324,7 @@ win.setSheetOffset(toolbarRect.height)
Starts or stops flashing the window to attract user's attention.
#### `win.setSkipTaskbar(skip)`
#### `win.setSkipTaskbar(skip)` _macOS_ _Windows_
* `skip` boolean

View File

@@ -96,14 +96,6 @@ Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will no
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
throw an exception.
> **NOTE:** Sending non-standard JavaScript types such as DOM objects or
> special Electron objects will throw an exception.
>
> Since the main process does not have support for DOM objects such as
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
> Electron's IPC to the main process, as the main process would have no way to decode
> them. Attempting to send such objects over IPC will result in an error.
The main process should listen for `channel` with
[`ipcMain.handle()`](./ipc-main.md#ipcmainhandlechannel-listener).
@@ -126,6 +118,21 @@ If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRender
If you do not need a response to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
> **Note**
> Sending non-standard JavaScript types such as DOM objects or
> special Electron objects will throw an exception.
>
> Since the main process does not have support for DOM objects such as
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
> Electron's IPC to the main process, as the main process would have no way to decode
> them. Attempting to send such objects over IPC will result in an error.
> **Note**
> If the handler in the main process throws an error,
> the promise returned by `invoke` will reject.
> However, the `Error` object in the renderer process
> will not be the same as the one thrown in the main process.
### `ipcRenderer.sendSync(channel, ...args)`
* `channel` string

View File

@@ -10,11 +10,12 @@ An example of implementing a protocol that has the same effect as the
```javascript
const { app, protocol } = require('electron')
const path = require('path')
const url = require('url')
app.whenReady().then(() => {
protocol.registerFileProtocol('atom', (request, callback) => {
const url = request.url.substr(7)
callback({ path: path.normalize(`${__dirname}/${url}`) })
const filePath = url.fileURLToPath('file://' + request.url.slice('atom://'.length))
callback(filePath)
})
})
```
@@ -175,7 +176,7 @@ property.
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` ProtocolResponse
* `response` [ProtocolResponse](structures/protocol-response.md)
Returns `boolean` - Whether the protocol was successfully registered

View File

@@ -281,7 +281,7 @@ Returns:
* `event` Event
* `details` Object
* `device` [HIDDevice[]](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md)
* `origin` string (optional) - The origin that the device has been revoked from.
Emitted after `HIDDevice.forget()` has been called. This event can be used
to help maintain persistent storage of permissions when
@@ -635,7 +635,7 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
* `notifications` - Request notification creation and the ability to display them in the user's system tray.
* `midi` - Request MIDI access in the `webmidi` API.
* `midiSysex` - Request the use of system exclusive messages in the `webmidi` API.
* `pointerLock` - Request to directly interpret mouse movements as an input method. Click [here](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API) to know more.
* `pointerLock` - Request to directly interpret mouse movements as an input method. Click [here](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API) to know more. These requests always appear to originate from the main frame.
* `fullscreen` - Request for the app to enter fullscreen mode.
* `openExternal` - Request to open links in external applications.
* `unknown` - An unrecognized permission request
@@ -705,7 +705,6 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
* `deviceType` string - The type of device that permission is being requested on, can be `hid` or `serial`.
* `origin` string - The origin URL of the device permission check.
* `device` [HIDDevice](structures/hid-device.md) | [SerialPort](structures/serial-port.md)- the device that permission is being requested for.
* `frame` [WebFrameMain](web-frame-main.md) - WebFrameMain checking the device permission.
Sets the handler which can be used to respond to device permission checks for the `session`.
Returning `true` will allow the device to be permitted and `false` will reject it.
@@ -713,8 +712,8 @@ To clear the handler, call `setDevicePermissionHandler(null)`.
This handler can be used to provide default permissioning to devices without first calling for permission
to devices (eg via `navigator.hid.requestDevice`). If this handler is not defined, the default device
permissions as granted through device selection (eg via `navigator.hid.requestDevice`) will be used.
Additionally, the default behavior of Electron is to store granted device permision through the lifetime
of the corresponding WebContents. If longer term storage is needed, a developer can store granted device
Additionally, the default behavior of Electron is to store granted device permision in memory.
If longer term storage is needed, a developer can store granted device
permissions (eg when handling the `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`.
```javascript
@@ -1050,7 +1049,7 @@ is emitted.
#### `ses.getStoragePath()`
A `string | null` indicating the absolute file system path where data for this
Returns `string | null` - The absolute file system path where data for this
session is persisted on disk. For in memory sessions this returns `null`.
### Instance Properties

View File

@@ -25,15 +25,20 @@ app.whenReady().then(() => {
})
```
__Platform limitations:__
__Platform Considerations__
If you want to keep exact same behaviors on all platforms, you should not
rely on the `click` event; instead, always attach a context menu to the tray icon.
__Linux__
* On Linux the app indicator will be used if it is supported, otherwise
`GtkStatusIcon` will be used instead.
* On Linux distributions that only have app indicator support, you have to
install `libappindicator1` to make the tray icon work.
* The app indicator will be used if it is supported, otherwise
`GtkStatusIcon` will be used instead.
* App indicator will only be shown when it has a context menu.
* When app indicator is used on Linux, the `click` event is ignored.
* On Linux in order for changes made to individual `MenuItem`s to take effect,
* The `click` event is ignored when using the app indicator.
* In order for changes made to individual `MenuItem`s to take effect,
you have to call `setContextMenu` again. For example:
```javascript
@@ -55,10 +60,16 @@ app.whenReady().then(() => {
})
```
* On Windows it is recommended to use `ICO` icons to get best visual effects.
__MacOS__
If you want to keep exact same behaviors on all platforms, you should not
rely on the `click` event and always attach a context menu to the tray icon.
* Icons passed to the Tray constructor should be [Template Images](native-image.md#template-image).
* To make sure your icon isn't grainy on retina monitors, be sure your `@2x` image is 144dpi.
* If you are bundling your application (e.g., with webpack for development), be sure that the file names are not being mangled or hashed. The filename needs to end in Template, and the `@2x` image needs to have the same filename as the standard image, or MacOS will not magically invert your image's colors or use the high density image.
* 16x16 (72dpi) and 32x32@2x (144dpi) work well for most icons.
__Windows__
* It is recommended to use `ICO` icons to get best visual effects.
### `new Tray(image, [guid])`

View File

@@ -1635,6 +1635,8 @@ Opens the devtools.
When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
explicitly passing an empty `mode` can force using last used dock state.
On Windows, if Windows Control Overlay is enabled, Devtools will be opened with `mode: 'detach'`.
#### `contents.closeDevTools()`
Closes the devtools.

View File

@@ -16,7 +16,7 @@ win.loadURL('https://twitter.com')
win.webContents.on(
'did-frame-navigate',
(event, url, isMainFrame, frameProcessId, frameRoutingId) => {
(event, url, httpResponseCode, httpStatusText, isMainFrame, frameProcessId, frameRoutingId) => {
const frame = webFrameMain.fromId(frameProcessId, frameRoutingId)
if (frame) {
const code = 'document.body.innerHTML = document.body.innerHTML.replaceAll("heck", "h*ck")'
@@ -144,6 +144,16 @@ ipcRenderer.on('port', (e, msg) => {
A `string` representing the current URL of the frame.
#### `frame.origin` _Readonly_
A `string` representing the current origin of the frame, serialized according
to [RFC 6454](https://www.rfc-editor.org/rfc/rfc6454). This may be different
from the URL. For instance, if the frame is a child window opened to
`about:blank`, then `frame.origin` will return the parent frame's origin, while
`frame.url` will return the empty string. Pages without a scheme/host/port
triple origin will have the serialized origin of `"null"` (that is, the string
containing the letters n, u, l, l).
#### `frame.top` _Readonly_
A `WebFrameMain | null` representing top frame in the frame hierarchy to which `frame`

View File

@@ -34,9 +34,19 @@ window manager. There is not a direct equivalent for Wayland, and the known
workarounds have unacceptable tradeoffs (e.g. Window.is_skip_taskbar in GNOME
requires unsafe mode), so Electron is unable to support this feature on Linux.
### API Changed: `session.setDevicePermissionHandler(handler)`
The handler invoked when `session.setDevicePermissionHandler(handler)` is used
has a change to its arguments. This handler no longer is passed a frame
`[WebFrameMain](api/web-frame-main.md)`, but instead is passed the `origin`, which
is the origin that is checking for device permission.
## Planned Breaking API Changes (19.0)
None
### Removed: IA32 Linux binaries
This is a result of Chromium 102.0.4999.0 dropping support for IA32 Linux.
This concludes the [removal of support for IA32 Linux](#removed-ia32-linux-support).
## Planned Breaking API Changes (18.0)
@@ -1203,6 +1213,10 @@ not present, then the native module will fail to load on Windows, with an error
message like `Cannot find module`. See the [native module
guide](/docs/tutorial/using-native-node-modules.md) for more.
### Removed: IA32 Linux support
Electron 18 will no longer run on 32-bit Linux systems. See [discontinuing support for 32-bit Linux](https://www.electronjs.org/blog/linux-32bit-support) for more information.
## Breaking API Changes (3.0)
The following list includes the breaking API changes in Electron 3.0.

View File

@@ -135,7 +135,7 @@ is only available in renderer processes.
If [sub-pixel anti-aliasing](https://alienryderflex.com/sub_pixel/) is deactivated, then fonts on LCD screens can look blurry. Example:
![subpixel rendering example]
![Subpixel rendering example](images/subpixel-rendering-screenshot.gif)
Sub-pixel anti-aliasing needs a non-transparent background of the layer containing the font glyphs. (See [this issue](https://github.com/electron/electron/issues/6344#issuecomment-420371918) for more info).
@@ -161,4 +161,3 @@ Notice that just setting the background in the CSS does not have the desired eff
[indexed-db]: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
[message-port]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
[browser-window]: api/browser-window.md
[subpixel rendering example]: images/subpixel-rendering-screenshot.gif

View File

@@ -1,5 +1,4 @@
const { contextBridge, ipcRenderer } = require('electron')
const path = require('path')
contextBridge.exposeInMainWorld('electron', {
startDrag: (fileName) => {

View File

@@ -33,12 +33,16 @@ function createWindow () {
if (permission === 'serial' && details.securityOrigin === 'file:///') {
return true
}
return false
})
mainWindow.webContents.session.setDevicePermissionHandler((details) => {
if (details.deviceType === 'serial' && details.origin === 'file://') {
return true
}
return false
})
mainWindow.loadFile('index.html')

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<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 from Electron renderer!</title>
</head>
<body>
<h1>Hello from Electron renderer!</h1>
<p>👋</p>
<p id="info"></p>
</body>
<script src="./renderer.js"></script>
</html>

View File

@@ -0,0 +1,26 @@
const { app, BrowserWindow } = require('electron');
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
});
win.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

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<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 from Electron renderer!</title>
</head>
<body>
<h1>Hello from Electron renderer!</h1>
<p>👋</p>
<p id="info"></p>
</body>
<script src="./renderer.js"></script>
</html>

View File

@@ -0,0 +1,30 @@
const { app, BrowserWindow } = require('electron');
const path = require('path');
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
},
});
win.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

@@ -0,0 +1,7 @@
const { contextBridge } = require('electron');
contextBridge.exposeInMainWorld('versions', {
node: () => process.versions.node,
chrome: () => process.versions.chrome,
electron: () => process.versions.electron,
});

View File

@@ -0,0 +1,2 @@
const information = document.getElementById('info');
information.innerText = `This app is using Chrome (v${versions.chrome()}), Node.js (v${versions.node()}), and Electron (v${versions.electron()})`;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

View File

@@ -1,26 +1,26 @@
# Application Distribution
---
title: 'Application Packaging'
description: 'To distribute your app with Electron, you need to package and rebrand it. To do this, you can either use specialized tooling or manual approaches.'
slug: application-distribution
hide_title: false
---
## Overview
To distribute your app with Electron, you need to package and rebrand it.
To do this, you can either use specialized tooling or manual approaches.
To distribute your app with Electron, you need to package and rebrand it. To do this, you
can either use specialized tooling or manual approaches.
## With tooling
You can use the following tools to distribute your application:
There are a couple tools out there that exist to package and distribute your Electron app.
We recommend using [Electron Forge](./forge-overview.md). You can check out
its [documentation](https://www.electronforge.io) directly, or refer to the [Packaging and Distribution](./tutorial-5-packaging.md)
part of the Electron tutorial.
* [electron-forge](https://github.com/electron-userland/electron-forge)
* [electron-builder](https://github.com/electron-userland/electron-builder)
* [electron-packager](https://github.com/electron/electron-packager)
## Manual packaging
These tools will take care of all the steps you need to take to end up with a
distributable Electron application, such as bundling your application,
rebranding the executable, and setting the right icons.
If you prefer the manual approach, there are 2 ways to distribute your application:
You can check the example of how to package your app with `electron-forge` in
the [Quick Start guide](quick-start.md#package-and-distribute-your-application).
## Manual distribution
- With prebuilt binaries
- With an app source code archive
### With prebuilt binaries
@@ -29,21 +29,19 @@ binaries](https://github.com/electron/electron/releases). Next, the folder
containing your app should be named `app` and placed in Electron's resources
directory as shown in the following examples.
> *NOTE:* the location of Electron's prebuilt binaries is indicated
:::note
The location of Electron's prebuilt binaries is indicated
with `electron/` in the examples below.
:::
*On macOS:*
```plaintext
```plain title='macOS'
electron/Electron.app/Contents/Resources/app/
├── package.json
├── main.js
└── index.html
```
*On Windows and Linux:*
```plaintext
```plain title='Windows and Linux'
electron/resources/app
├── package.json
├── main.js
@@ -54,7 +52,7 @@ Then execute `Electron.app` on macOS, `electron` on Linux, or `electron.exe`
on Windows, and Electron will start as your app. The `electron` directory
will then be your distribution to deliver to users.
### With an app source code archive
### With an app source code archive (asar)
Instead of shipping your app by copying all of its source files, you can
package your app into an [asar] archive to improve the performance of reading
@@ -65,16 +63,12 @@ To use an `asar` archive to replace the `app` folder, you need to rename the
archive to `app.asar`, and put it under Electron's resources directory like
below, and Electron will then try to read the archive and start from it.
*On macOS:*
```plaintext
```plain title='macOS'
electron/Electron.app/Contents/Resources/
└── app.asar
```
*On Windows and Linux:*
```plaintext
```plain title='Windows'
electron/resources/
└── app.asar
```
@@ -87,47 +81,44 @@ You can find more details on how to use `asar` in the
After bundling your app into Electron, you will want to rebrand Electron
before distributing it to users.
#### macOS
- **Windows:** You can rename `electron.exe` to any name you like, and edit
its icon and other information with tools like [rcedit](https://github.com/electron/rcedit).
- **Linux:** You can rename the `electron` executable to any name you like.
- **macOS:** You can rename `Electron.app` to any name you want, and you also have to rename
the `CFBundleDisplayName`, `CFBundleIdentifier` and `CFBundleName` fields in the
following files:
You can rename `Electron.app` to any name you want, and you also have to rename
the `CFBundleDisplayName`, `CFBundleIdentifier` and `CFBundleName` fields in the
following files:
- `Electron.app/Contents/Info.plist`
- `Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist`
* `Electron.app/Contents/Info.plist`
* `Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist`
You can also rename the helper app to avoid showing `Electron Helper` in the
Activity Monitor, but make sure you have renamed the helper app's executable
file's name.
You can also rename the helper app to avoid showing `Electron Helper` in the
Activity Monitor, but make sure you have renamed the helper app's executable
file's name.
The structure of a renamed app would be like:
The structure of a renamed app would be like:
```plaintext
```plain
MyApp.app/Contents
├── Info.plist
├── MacOS/
│   └── MyApp
└── MyApp
└── Frameworks/
└── MyApp Helper.app
├── Info.plist
└── MacOS/
   └── MyApp Helper
└── MyApp Helper
```
#### Windows
:::note
You can rename `electron.exe` to any name you like, and edit its icon and other
information with tools like [rcedit](https://github.com/electron/rcedit).
#### Linux
You can rename the `electron` executable to any name you like.
### Rebranding by rebuilding Electron from source
It is also possible to rebrand Electron by changing the product name and
it is also possible to rebrand Electron by changing the product name and
building it from source. To do this you need to set the build argument
corresponding to the product name (`electron_product_name = "YourProductName"`)
in the `args.gn` file and rebuild.
Keep in mind this is not recommended as setting up the environment to compile
from source is not trivial and takes significant time.
:::
[asar]: https://github.com/electron/asar

View File

@@ -0,0 +1,175 @@
---
title: ASAR Archives
description: What is ASAR archive and how does it affect the application.
slug: asar-archives
hide_title: false
---
After creating an [application distribution](application-distribution.md), the
app's source code are usually bundled into an [ASAR
archive](https://github.com/electron/asar), which is a simple extensive archive
format designed for Electron apps. By bundling the app we can mitigate issues
around long path names on Windows, speed up `require` and conceal your source
code from cursory inspection.
The bundled app runs in a virtual file system and most APIs would just work
normally, but for some cases you might want to work on ASAR archives explicitly
due to a few caveats.
## Using ASAR Archives
In Electron there are two sets of APIs: Node APIs provided by Node.js and Web
APIs provided by Chromium. Both APIs support reading files from ASAR archives.
### Node API
With special patches in Electron, Node APIs like `fs.readFile` and `require`
treat ASAR archives as virtual directories, and the files in it as normal
files in the filesystem.
For example, suppose we have an `example.asar` archive under `/path/to`:
```sh
$ asar list /path/to/example.asar
/app.js
/file.txt
/dir/module.js
/static/index.html
/static/main.css
/static/jquery.min.js
```
Read a file in the ASAR archive:
```javascript
const fs = require('fs')
fs.readFileSync('/path/to/example.asar/file.txt')
```
List all files under the root of the archive:
```javascript
const fs = require('fs')
fs.readdirSync('/path/to/example.asar')
```
Use a module from the archive:
```javascript
require('./path/to/example.asar/dir/module.js')
```
You can also display a web page in an ASAR archive with `BrowserWindow`:
```javascript
const { BrowserWindow } = require('electron')
const win = new BrowserWindow()
win.loadURL('file:///path/to/example.asar/static/index.html')
```
### Web API
In a web page, files in an archive can be requested with the `file:` protocol.
Like the Node API, ASAR archives are treated as directories.
For example, to get a file with `$.get`:
```html
<script>
let $ = require('./jquery.min.js')
$.get('file:///path/to/example.asar/file.txt', (data) => {
console.log(data)
})
</script>
```
### Treating an ASAR archive as a Normal File
For some cases like verifying the ASAR archive's checksum, we need to read the
content of an ASAR archive as a file. For this purpose you can use the built-in
`original-fs` module which provides original `fs` APIs without `asar` support:
```javascript
const originalFs = require('original-fs')
originalFs.readFileSync('/path/to/example.asar')
```
You can also set `process.noAsar` to `true` to disable the support for `asar` in
the `fs` module:
```javascript
const fs = require('fs')
process.noAsar = true
fs.readFileSync('/path/to/example.asar')
```
## Limitations of the Node API
Even though we tried hard to make ASAR archives in the Node API work like
directories as much as possible, there are still limitations due to the
low-level nature of the Node API.
### Archives Are Read-only
The archives can not be modified so all Node APIs that can modify files will not
work with ASAR archives.
### Working Directory Can Not Be Set to Directories in Archive
Though ASAR archives are treated as directories, there are no actual
directories in the filesystem, so you can never set the working directory to
directories in ASAR archives. Passing them as the `cwd` option of some APIs
will also cause errors.
### Extra Unpacking on Some APIs
Most `fs` APIs can read a file or get a file's information from ASAR archives
without unpacking, but for some APIs that rely on passing the real file path to
underlying system calls, Electron will extract the needed file into a
temporary file and pass the path of the temporary file to the APIs to make them
work. This adds a little overhead for those APIs.
APIs that requires extra unpacking are:
* `child_process.execFile`
* `child_process.execFileSync`
* `fs.open`
* `fs.openSync`
* `process.dlopen` - Used by `require` on native modules
### Fake Stat Information of `fs.stat`
The `Stats` object returned by `fs.stat` and its friends on files in `asar`
archives is generated by guessing, because those files do not exist on the
filesystem. So you should not trust the `Stats` object except for getting file
size and checking file type.
### Executing Binaries Inside ASAR archive
There are Node APIs that can execute binaries like `child_process.exec`,
`child_process.spawn` and `child_process.execFile`, but only `execFile` is
supported to execute binaries inside ASAR archive.
This is because `exec` and `spawn` accept `command` instead of `file` as input,
and `command`s are executed under shell. There is no reliable way to determine
whether a command uses a file in asar archive, and even if we do, we can not be
sure whether we can replace the path in command without side effects.
## Adding Unpacked Files to ASAR archives
As stated above, some Node APIs will unpack the file to the filesystem when
called. Apart from the performance issues, various anti-virus scanners might
be triggered by this behavior.
As a workaround, you can leave various files unpacked using the `--unpack` option.
In the following example, shared libraries of native Node.js modules will not be
packed:
```sh
$ asar pack app app.asar --unpack *.node
```
After running the command, you will notice that a folder named `app.asar.unpacked`
was created together with the `app.asar` file. It contains the unpacked files
and should be shipped together with the `app.asar` archive.

View File

@@ -0,0 +1,53 @@
---
title: 'ASAR Integrity'
description: 'An experimental feature that ensures the validity of ASAR contents at runtime.'
slug: asar-integrity
hide_title: false
---
## Platform Support
Currently ASAR integrity checking is only supported on macOS.
## Requirements
### Electron Forge / Electron Packager
If you are using `>= electron-packager@15.4.0` or `>= @electron-forge/core@6.0.0-beta.61` then all these requirements are met for you automatically and you can skip to [Toggling the Fuse](#toggling-the-fuse).
### Other build systems
In order to enable ASAR integrity checking you need to ensure that your `app.asar` file was generated by a version of the `asar` npm package that supports asar integrity. Support was introduced in version `3.1.0`.
Your must then populate a valid `ElectronAsarIntegrity` dictionary block in your packaged apps `Info.plist`. An example is included below.
```plist
<key>ElectronAsarIntegrity</key>
<dict>
<key>Resources/app.asar</key>
<dict>
<key>algorithm</key>
<string>SHA256</string>
<key>hash</key>
<string>9d1f61ea03c4bb62b4416387a521101b81151da0cfbe18c9f8c8b818c5cebfac</string>
</dict>
</dict>
```
Valid `algorithm` values are currently `SHA256` only. The `hash` is a hash of the ASAR header using the given algorithm. The `asar` package exposes a `getRawHeader` method whose result can then be hashed to generate this value.
## Toggling the Fuse
ASAR integrity checking is currently disabled by default and can be enabled by toggling a fuse. See [Electron Fuses](fuses.md) for more information on what Electron Fuses are and how they work. When enabling this fuse you typically also want to enable the `onlyLoadAppFromAsar` fuse otherwise the validity checking can be bypassed via the Electron app code search path.
```js
require('@electron/fuses').flipFuses(
// E.g. /a/b/Foo.app
pathToPackagedApp,
{
version: FuseVersion.V1,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true
}
)
```

View File

@@ -26,10 +26,8 @@ beginners, using a command line tool is likely to be helpful*.
## electron-forge
A "complete tool for building modern Electron applications". Electron Forge
unifies the existing (and well maintained) build tools for Electron development
into a cohesive package so that anyone can jump right in to Electron
development.
Electron Forge is a tool for packaging and publishing Electron applications. It unifies Electron's tooling ecosystem
into a single extensible interface so that anyone can jump right into making Electron apps.
Forge comes with [a ready-to-use template](https://electronforge.io/templates) using Webpack as a bundler. It includes an example typescript configuration and provides two configuration files to enable easy customization. It uses the same core modules used by the
greater Electron community (like [`electron-packager`](https://github.com/electron/electron-packager))

View File

@@ -1,14 +1,20 @@
# Code Signing
---
title: 'Code Signing'
description: 'Code signing is a security technology that you use to certify that an app was created by you.'
slug: code-signing
hide_title: false
---
Code signing is a security technology that you use to certify that an app was
created by you.
created by you. You should sign your application so it does not trigger any
operating system security checks.
On macOS the system can detect any change to the app, whether the change is
On macOS, the system can detect any change to the app, whether the change is
introduced accidentally or by malicious code.
On Windows, the system assigns a trust level to your code signing certificate
which if you don't have, or if your trust level is low, will cause security
dialogs to appear when users start using your application. Trust level builds
dialogs to appear when users start using your application. Trust level builds
over time so it's better to start code signing as early as possible.
While it is possible to distribute unsigned apps, it is not recommended. Both
@@ -16,20 +22,19 @@ Windows and macOS will, by default, prevent either the download or the execution
of unsigned applications. Starting with macOS Catalina (version 10.15), users
have to go through multiple manual steps to open unsigned applications.
![macOS Catalina Gatekeeper warning: The app cannot be opened because the
developer cannot be verified](../images/gatekeeper.png)
![macOS Catalina Gatekeeper warning: The app cannot be opened because the developer cannot be verified](../images/gatekeeper.png)
As you can see, users get two options: Move the app straight to the trash or
cancel running it. You don't want your users to see that dialog.
If you are building an Electron app that you intend to package and distribute,
it should be code-signed.
it should be code signed.
# Signing & notarizing macOS builds
## Signing & notarizing macOS builds
Properly preparing macOS applications for release requires two steps: First, the
app needs to be code-signed. Then, the app needs to be uploaded to Apple for a
process called "notarization", where automated systems will further verify that
Properly preparing macOS applications for release requires two steps. First, the
app needs to be code signed. Then, the app needs to be uploaded to Apple for a
process called **notarization**, where automated systems will further verify that
your app isn't doing anything to endanger its users.
To start the process, ensure that you fulfill the requirements for signing and
@@ -42,99 +47,23 @@ notarizing your app:
Electron's ecosystem favors configuration and freedom, so there are multiple
ways to get your application signed and notarized.
## `electron-forge`
### Using Electron Forge
If you're using Electron's favorite build tool, getting your application signed
and notarized requires a few additions to your configuration. [Forge](https://electronforge.io) is a
collection of the official Electron tools, using [`electron-packager`],
[`electron-osx-sign`], and [`electron-notarize`] under the hood.
Let's take a look at an example configuration with all required fields. Not all
of them are required: the tools will be clever enough to automatically find a
suitable `identity`, for instance, but we recommend that you are explicit.
Detailed instructions on how to configure your application can be found in the [Electron Forge Code Signing Tutorial](https://www.electronforge.io/guides/code-signing/code-signing-macos).
```json
{
"name": "my-app",
"version": "0.0.1",
"config": {
"forge": {
"packagerConfig": {
"osxSign": {
"identity": "Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)",
"hardened-runtime": true,
"entitlements": "entitlements.plist",
"entitlements-inherit": "entitlements.plist",
"signature-flags": "library"
},
"osxNotarize": {
"appleId": "felix@felix.fun",
"appleIdPassword": "my-apple-id-password",
}
}
}
}
}
```
### Using Electron Packager
The `plist` file referenced here needs the following macOS-specific entitlements
to assure the Apple security mechanisms that your app is doing these things
without meaning any harm:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
```
Note that up until Electron 12, the `com.apple.security.cs.allow-unsigned-executable-memory` entitlement was required
as well. However, it should not be used anymore if it can be avoided.
To see all of this in action, check out Electron Fiddle's source code,
[especially its `electron-forge` configuration
file](https://github.com/electron/fiddle/blob/master/forge.config.js).
If you plan to access the microphone or camera within your app using Electron's APIs, you'll also
need to add the following entitlements:
```xml
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
```
If these are not present in your app's entitlements when you invoke, for example:
```js
const { systemPreferences } = require('electron')
const microphone = systemPreferences.askForMediaAccess('microphone')
```
Your app may crash. See the Resource Access section in [Hardened Runtime](https://developer.apple.com/documentation/security/hardened_runtime) for more information and entitlements you may need.
## `electron-builder`
Electron Builder comes with a custom solution for signing your application. You
can find [its documentation here](https://www.electron.build/code-signing).
## `electron-packager`
If you're not using an integrated build pipeline like Forge or Builder, you
If you're not using an integrated build pipeline like Forge, you
are likely using [`electron-packager`], which includes [`electron-osx-sign`] and
[`electron-notarize`].
If you're using Packager's API, you can pass [in configuration that both signs
and notarizes your
application](https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html).
and notarizes your application](https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html).
```js
const packager = require('electron-packager')
@@ -155,11 +84,11 @@ packager({
})
```
The `plist` file referenced here needs the following macOS-specific entitlements
The `entitlements.plist` file referenced here needs the following macOS-specific entitlements
to assure the Apple security mechanisms that your app is doing these things
without meaning any harm:
```xml
```xml title="entitlements.plist"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@@ -175,11 +104,11 @@ without meaning any harm:
Up until Electron 12, the `com.apple.security.cs.allow-unsigned-executable-memory` entitlement was required
as well. However, it should not be used anymore if it can be avoided.
## Mac App Store
### Signing Mac App Store applications
See the [Mac App Store Guide].
# Signing Windows builds
## Signing Windows builds
Before signing Windows builds, you must do the following:
@@ -190,31 +119,111 @@ Before signing Windows builds, you must do the following:
You can get a code signing certificate from a lot of resellers. Prices vary, so
it may be worth your time to shop around. Popular resellers include:
* [digicert](https://www.digicert.com/code-signing/microsoft-authenticode.htm)
* [Sectigo](https://sectigo.com/ssl-certificates-tls/code-signing)
* Amongst others, please shop around to find one that suits your needs, Google
is your friend 😄
- [digicert](https://www.digicert.com/code-signing/microsoft-authenticode.htm)
- [Sectigo](https://sectigo.com/ssl-certificates-tls/code-signing)
- Amongst others, please shop around to find one that suits your needs! 😄
There are a number of tools for signing your packaged app:
:::caution Keep your certificate password private
Your certificate password should be a **secret**. Do not share it publicly or
commit it to your source code.
:::
* [`electron-winstaller`] will generate an installer for windows and sign it for
you
* [`electron-forge`] can sign installers it generates through the
Squirrel.Windows or MSI targets.
* [`electron-builder`] can sign some of its windows targets
### Using Electron Forge
## Windows Store
Electron Forge is the recommended way to sign your `Squirrel.Windows` and `WiX MSI` installers. Detailed instructions on how to configure your application can be found in the [Electron Forge Code Signing Tutorial](https://www.electronforge.io/guides/code-signing/code-signing-macos).
### Using electron-winstaller (Squirrel.Windows)
[`electron-winstaller`] is a package that can generate Squirrel.Windows installers for your
Electron app. This is the tool used under the hood by Electron Forge's
[Squirrel.Windows Maker][maker-squirrel]. If you're not using Electron Forge and want to use
`electron-winstaller` directly, use the `certificateFile` and `certificatePassword` configuration
options when creating your installer.
```js {10-11}
const electronInstaller = require('electron-winstaller')
// NB: Use this syntax within an async function, Node does not have support for
// top-level await as of Node 12.
try {
await electronInstaller.createWindowsInstaller({
appDirectory: '/tmp/build/my-app-64',
outputDirectory: '/tmp/build/installer64',
authors: 'My App Inc.',
exe: 'myapp.exe',
certificateFile: './cert.pfx',
certificatePassword: 'this-is-a-secret',
})
console.log('It worked!')
} catch (e) {
console.log(`No dice: ${e.message}`)
}
```
For full configuration options, check out the [`electron-winstaller`] repository!
### Using electron-wix-msi (WiX MSI)
[`electron-wix-msi`] is a package that can generate MSI installers for your
Electron app. This is the tool used under the hood by Electron Forge's [MSI Maker][maker-msi].
If you're not using Electron Forge and want to use `electron-wix-msi` directly, use the
`certificateFile` and `certificatePassword` configuration options
or pass in parameters directly to [SignTool.exe] with the `signWithParams` option.
```js {12-13}
import { MSICreator } from 'electron-wix-msi'
// Step 1: Instantiate the MSICreator
const msiCreator = new MSICreator({
appDirectory: '/path/to/built/app',
description: 'My amazing Kitten simulator',
exe: 'kittens',
name: 'Kittens',
manufacturer: 'Kitten Technologies',
version: '1.1.2',
outputDirectory: '/path/to/output/folder',
certificateFile: './cert.pfx',
certificatePassword: 'this-is-a-secret',
})
// Step 2: Create a .wxs template file
const supportBinaries = await msiCreator.create()
// 🆕 Step 2a: optionally sign support binaries if you
// sign you binaries as part of of your packaging script
supportBinaries.forEach(async (binary) => {
// Binaries are the new stub executable and optionally
// the Squirrel auto updater.
await signFile(binary)
})
// Step 3: Compile the template to a .msi file
await msiCreator.compile()
```
For full configuration options, check out the [`electron-wix-msi`] repository!
### Using Electron Builder
Electron Builder comes with a custom solution for signing your application. You
can find [its documentation here](https://www.electron.build/code-signing).
### Signing Windows Store applications
See the [Windows Store Guide].
[Apple Developer Program]: https://developer.apple.com/programs/
[apple developer program]: https://developer.apple.com/programs/
[`electron-builder`]: https://github.com/electron-userland/electron-builder
[`electron-forge`]: https://github.com/electron-userland/electron-forge
[`electron-osx-sign`]: https://github.com/electron-userland/electron-osx-sign
[`electron-packager`]: https://github.com/electron/electron-packager
[`electron-notarize`]: https://github.com/electron/electron-notarize
[`electron-winstaller`]: https://github.com/electron/windows-installer
[Xcode]: https://developer.apple.com/xcode
[`electron-wix-msi`]: https://github.com/felixrieseberg/electron-wix-msi
[xcode]: https://developer.apple.com/xcode
[signing certificates]: https://github.com/electron/electron-osx-sign/wiki/1.-Getting-Started#certificates
[Mac App Store Guide]: mac-app-store-submission-guide.md
[Windows Store Guide]: windows-store-guide.md
[mac app store guide]: ./mac-app-store-submission-guide.md
[windows store guide]: ./windows-store-guide.md
[maker-squirrel]: https://www.electronforge.io/config/makers/squirrel.windows
[maker-msi]: https://www.electronforge.io/config/makers/wix-msi
[signtool.exe]: https://docs.microsoft.com/en-us/dotnet/framework/tools/signtool-exe

View File

@@ -0,0 +1,54 @@
---
title: 'Distribution Overview'
description: 'To distribute your app with Electron, you need to package and rebrand it. To do this, you can either use specialized tooling or manual approaches.'
slug: distribution-overview
hide_title: false
---
Once your app is ready for production, there are a couple steps you need to take before
you can deliver it to your users.
## Packaging
To distribute your app with Electron, you need to package all your resources and assets
into an executable and rebrand it. To do this, you can either use specialized tooling like Electron Forge
or do it manually. See the [Application Packaging][application-packaging] tutorial
for more information.
## Code signing
Code signing is a security technology that you use to certify that an app was
created by you. You should sign your application so it does not trigger the
security checks of your user's operating system.
To get started with each operating system's code signing process, please read the
[Code Signing][code-signing] docs.
## Publishing
Once your app is packaged and signed, you can freely distribute your app directly
to users by uploading your installers online.
To reach more users, you can also choose to upload your app to each operating system's
digital distribution platform (i.e. app store). These require another build step aside
from your direct download app. For more information, check out each individual app store guide:
- [Mac App Store][mac-app]
- [Windows Store][windows-store]
- [Snapcraft (Linux)][snapcraft]
## Updating
Electron's auto-updater allows you to deliver application updates to users
without forcing them to manually download new versions of your application.
Check out the [Updating Applications][updates] guide for details on implementing automatic updates
with Electron.
<!-- Link labels -->
[application-packaging]: ./application-distribution.md
[code-signing]: ./code-signing.md
[mac-app]: ./mac-app-store-submission-guide.md
[windows-store]: ./windows-store-guide.md
[snapcraft]: ./snapcraft.md
[updates]: ./updates.md

View File

@@ -24,10 +24,11 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
| 14.0.0 | -- | 2021-May-27 | 2021-Aug-31 | M93 | v14.17 | 🚫 |
| 15.0.0 | 2021-Jul-20 | 2021-Sep-01 | 2021-Sep-21 | M94 | v16.5 | 🚫 |
| 16.0.0 | 2021-Sep-23 | 2021-Oct-20 | 2021-Nov-16 | M96 | v16.9 | 🚫 |
| 17.0.0 | 2021-Nov-18 | 2022-Jan-06 | 2022-Feb-01 | M98 | v16.13 | |
| 17.0.0 | 2021-Nov-18 | 2022-Jan-06 | 2022-Feb-01 | M98 | v16.13 | 🚫 |
| 18.0.0 | 2022-Feb-03 | 2022-Mar-03 | 2022-Mar-29 | M100 | v16.13 | ✅ |
| 19.0.0 | 2022-Mar-31 | 2022-Apr-26 | 2022-May-24 | M102 | v16.14 | ✅ |
| 20.0.0 | 2022-May-26 | 2022-Jun-21 | 2022-Aug-02 | M104 | TBD | ✅ |
| 20.0.0 | 2022-May-26 | 2022-Jun-21 | 2022-Aug-02 | M104 | v16.15 | ✅ |
| 21.0.0 | 2022-Aug-04 | 2022-Aug-30 | 2022-Sep-27 | M106 | TBD | ✅ |
**Notes:**

56
docs/tutorial/examples.md Normal file
View File

@@ -0,0 +1,56 @@
---
title: 'Examples Overview'
description: 'A set of examples for common Electron features'
slug: examples
hide_title: false
---
# Examples Overview
In this section, we have collected a set of guides for common features
that you may want to implement in your Electron application. Each guide
contains a practical example in a minimal, self-contained example app.
The easiest way to run these examples is by downloading [Electron Fiddle][fiddle].
Once Fiddle is installed, you can press on the "Open in Fiddle" button that you
will find below code samples like the following one:
```fiddle docs/fiddles/quick-start
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])
}
})
```
If there is still something that you do not know how to do, please take a look at the [API][app]
as there is a chance it might be documented just there (and also open an issue requesting the
guide!).
<!-- guide-table-start -->
| Guide | Description |
| :-------------------- | ------------------------------------------------------------------------------------------------------------------- |
| [Message ports] | This guide provides some examples of how you might use MessagePorts in your app to communicate different processes. |
| [Device access] | Learn how to access the device hardware (Bluetooth, USB, Serial). |
| [Keyboard shortcuts] | Configure local and global keyboard shortcuts for your Electron application. |
| [Multithreading] | With Web Workers, it is possible to run JavaScript in OS-level threads |
| [Offscreen rendering] | Offscreen rendering lets you obtain the content of a BrowserWindow in a bitmap, so it can be rendered anywhere. |
| [Spellchecker] | Learn how to use the built-in spellchecker, set languages, etc. |
| [Web embeds] | Discover the different ways to embed third-party web content in your application. |
<!-- guide-table-end -->
## How to...?
You can find the full list of "How to?" in the sidebar. If there is
something that you would like to do that is not documented, please join
our [Discord server][] and let us know!
[discord server]: https://discord.com/invite/electron
[fiddle]: https://www.electronjs.org/fiddle

View File

@@ -0,0 +1,36 @@
# Distributing Apps With Electron Forge
Electron Forge is a tool for packaging and publishing Electron applications.
It unifies Electron's build tooling ecosystem into
a single extensible interface so that anyone can jump right into making Electron apps.
## Getting started
The [Electron Forge docs] contain detailed information on taking your application
from source code to your end users' machines.
This includes:
* Packaging your application [(package)]
* Generating executables and installers for each OS [(make)], and,
* Publishing these files to online platforms to download [(publish)].
For beginners, we recommend following through Electron's [tutorial] to develop, build,
package and publish your first Electron app. If you have already developed an app on your machine
and want to start on packaging and distribution, start from [step 5] of the tutorial.
## Getting help
* 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 Forge, please check the [GitHub 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.
[Electron Forge Docs]: https://www.electronforge.io/
[step 5]: ./tutorial-5-packaging.md
[(package)]: https://www.electronforge.io/cli#package
[(make)]: https://www.electronforge.io/cli#make
[(publish)]: https://www.electronforge.io/cli#publish
[GitHub issue tracker]: https://github.com/electron-userland/electron-forge/issues
[discord]: https://discord.gg/APGC3k5yaH
[tutorial]: https://www.electronjs.org/docs/latest/tutorial/tutorial-prerequisites

View File

@@ -8,6 +8,59 @@ For a subset of Electron functionality it makes sense to disable certain feature
Fuses are the solution to this problem, at a high level they are "magic bits" in the Electron binary that can be flipped when packaging your Electron app to enable / disable certain features / restrictions. Because they are flipped at package time before you code sign your app the OS becomes responsible for ensuring those bits aren't flipped back via OS level code signing validation (Gatekeeper / App Locker).
## Current Fuses
### `runAsNode`
**Default:** Enabled
**@electron/fuses:** `FuseV1Options.RunAsNode`
The runAsNode fuse toggles whether the `ELECTRON_RUN_AS_NODE` environment variable is respected or not. Please note that if this fuse is disabled then `process.fork` in the main process will not function as expected as it depends on this environment variable to function.
### `cookieEncryption`
**Default:** Disabled
**@electron/fuses:** `FuseV1Options.EnableCookieEncryption`
The cookieEncryption fuse toggles whether the cookie store on disk is encrypted using OS level cryptography keys. By default the sqlite database that Chromium uses to store cookies stores the values in plaintext. If you wish to ensure your apps cookies are encrypted in the same way Chrome does then you should enable this fuse. Please note it is a one-way transition, if you enable this fuse existing unencrypted cookies will be encrypted-on-write but if you then disable the fuse again your cookie store will effectively be corrupt and useless. Most apps can safely enable this fuse.
### `nodeOptions`
**Default:** Enabled
**@electron/fuses:** `FuseV1Options.EnableNodeOptionsEnvironmentVariable`
The nodeOptions fuse toggles whether the [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#node_optionsoptions) environment variable is respected or not. This environment variable can be used to pass all kinds of custom options to the Node.js runtime and isn't typically used by apps in production. Most apps can safely disable this fuse.
### `nodeCliInspect`
**Default:** Enabled
**@electron/fuses:** `FuseV1Options.EnableNodeCliInspectArguments`
The nodeCliInspect fuse toggles whether the `--inspect`, `--inspect-brk`, etc. flags are respected or not. When disabled it also ensures that `SIGUSR1` signal does not initialize the main process inspector. Most apps can safely disable this fuse.
### `embeddedAsarIntegrityValidation`
**Default:** Disabled
**@electron/fuses:** `FuseV1Options.EnableEmbeddedAsarIntegrityValidation`
The embeddedAsarIntegrityValidation fuse toggles an experimental feature on macOS that validates the content of the `app.asar` file when it is loaded. This feature is designed to have a minimal performance impact but may marginally slow down file reads from inside the `app.asar` archive.
For more information on how to use asar integrity validation please read the [Asar Integrity](asar-integrity.md) documentation.
### `onlyLoadAppFromAsar`
**Default:** Disabled
**@electron/fuses:** `FuseV1Options.OnlyLoadAppFromAsar`
The onlyLoadAppFromAsar fuse changes the search system that Electron uses to locate your app code. By default Electron will search in the following order `app.asar` -> `app` -> `default_app.asar`. When this fuse is enabled the search order becomes a single entry `app.asar` thus ensuring that when combined with the `embeddedAsarIntegrityValidation` fuse it is impossible to load non-validated code.
### `loadBrowserProcessSpecificV8Snapshot`
**Default:** Disabled
**@electron/fuses:** `FuseV1Options.LoadBrowserProcessSpecificV8Snapshot`
The loadBrowserProcessSpecificV8Snapshot fuse changes which V8 snapshot file is used for the browser process. By default Electron's processes will all use the same V8 snapshot file. When this fuse is enabled the browser process uses the file called `browser_v8_context_snapshot.bin` for its V8 snapshot. The other processes will use the V8 snapshot file that they normally do.
## How do I flip the fuses?
### The easy way
@@ -20,11 +73,18 @@ require('@electron/fuses').flipFuses(
require('electron'),
// Fuses to flip
{
runAsNode: false
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false
}
)
```
You can validate the fuses have been flipped or check the fuse status of an arbitrary Electron app using the fuses CLI.
```bash
npx @electron/fuses read --app /Applications/Foo.app
```
### The hard way
#### Quick Glossary

View File

@@ -1,10 +1,11 @@
# Introduction
---
title: 'Introduction'
description: '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!'
slug: /latest/
hide_title: false
---
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?
# 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
@@ -12,20 +13,12 @@ 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
## Getting started
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.
We recommend you to start with the [tutorial], which guides you through the
process of developing an Electron app and distributing it to users.
The [examples] and [API documentation] are also good places to browse around
and discover new things.
## Running examples with Electron Fiddle
@@ -39,21 +32,45 @@ 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.
```fiddle docs/fiddles/quick-start
```
## What is in the docs?
All the official documentation is available from the sidebar. These
are the different categories and what you can expect on each one:
- **Tutorial**: An end-to-end guide on how to create and publish your first Electron
application.
- **Processes in Electron**: In-depth reference on Electron processes and how to work with them.
- **Best Practices**: Important checklists to keep in mind when developing an Electron app.
- **Examples**: Quick references to add features to your Electron app.
- **Development**: Miscellaneous development guides.
- **Distribution**: Learn how to distribute your app to end users.
- **Testing And Debugging**: How to debug JavaScript, write tests, and other tools used
to create quality Electron applications.
- **References**: Useful links to better understand how the Electron project works
and is organized.
- **Contributing**: Compiling Electron and making contributions can be daunting.
We try to make it easier in this section.
## 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.
- 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.
<!-- Links -->
[tutorial]: tutorial-1-prerequisites.md
[api documentation]: ../api/app.md
[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/
[discord]: https://discord.com/invite/APGC3k5yaH
[examples]: examples.md
[fiddle]: https://electronjs.org/fiddle
[issue-tracker]: https://github.com/electron/electron/issues
[discord]: https://discord.gg/electronjs
[node]: https://nodejs.org/

View File

@@ -232,7 +232,7 @@ how to meet the Mac App Store requirements.
### Upload
The Application Loader should be used to upload the signed app to iTunes
[Apple Transporter][apple-transporter] should be used to upload the signed app to App Store
Connect for processing, making sure you have [created a record][create-record]
before uploading.
@@ -345,7 +345,8 @@ Electron uses following cryptographic algorithms:
[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
[create-record]: https://help.apple.com/app-store-connect/#/dev2cd126805
[apple-transporter]: https://help.apple.com/itc/transporteruserguide/en.lproj/static.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
[user-selected]: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6

View File

@@ -8,8 +8,7 @@ your app.
Here is a very brief example of what a MessagePort is and how it works:
```js
// renderer.js ///////////////////////////////////////////////////////////////
```js title='renderer.js (Renderer Process)'
// MessagePorts are created in pairs. A connected pair of message ports is
// called a channel.
const channel = new MessageChannel()
@@ -28,8 +27,7 @@ port2.postMessage({ answer: 42 })
ipcRenderer.postMessage('port', null, [port1])
```
```js
// main.js ///////////////////////////////////////////////////////////////////
```js title='main.js (Main Process)'
// In the main process, we receive the port.
ipcMain.on('port', (event) => {
// When we receive a MessagePort in the main process, it becomes a
@@ -84,14 +82,84 @@ process, you can listen for the `close` event by calling `port.on('close',
## Example use cases
### Setting up a MessageChannel between two renderers
In this example, the main process sets up a MessageChannel, then sends each port
to a different renderer. This allows renderers to send messages to each other
without needing to use the main process as an in-between.
```js title='main.js (Main Process)'
const { BrowserWindow, app, MessageChannelMain } = require('electron')
app.whenReady().then(async () => {
// create the windows.
const mainWindow = new BrowserWindow({
show: false,
webPreferences: {
contextIsolation: false,
preload: 'preloadMain.js'
}
})
const secondaryWindow = new BrowserWindow({
show: false,
webPreferences: {
contextIsolation: false,
preload: 'preloadSecondary.js'
}
})
// set up the channel.
const { port1, port2 } = new MessageChannelMain()
// once the webContents are ready, send a port to each webContents with postMessage.
mainWindow.once('ready-to-show', () => {
mainWindow.webContents.postMessage('port', null, [port1])
})
secondaryWindow.once('ready-to-show', () => {
secondaryWindow.webContents.postMessage('port', null, [port2])
})
})
```
Then, in your preload scripts you receive the port through IPC and set up the
listeners.
```js title='preloadMain.js and preloadSecondary.js (Preload scripts)'
const { ipcRenderer } = require('electron')
ipcRenderer.on('port', e => {
// port received, make it globally available.
window.electronMessagePort = e.ports[0]
window.electronMessagePort.onmessage = messageEvent => {
// handle message
}
})
```
In this example messagePort is bound to the `window` object directly. It is better
to use `contextIsolation` and set up specific contextBridge calls for each of your
expected messages, but for the simplicity of this example we don't. You can find an
example of context isolation further down this page at [Communicating directly between the main process and the main world of a context-isolated page](#communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page)
That means window.electronMessagePort is globally available and you can call
`postMessage` on it from anywhere in your app to send a message to the other
renderer.
```js title='renderer.js (Renderer Process)'
// elsewhere in your code to send a message to the other renderers message handler
window.electronMessagePort.postmessage('ping')
```
### Worker process
In this example, your app has a worker process implemented as a hidden window.
You want the app page to be able to communicate directly with the worker
process, without the performance overhead of relaying via the main process.
```js
// main.js ///////////////////////////////////////////////////////////////////
```js title='main.js (Main Process)'
const { BrowserWindow, app, ipcMain, MessageChannelMain } = require('electron')
app.whenReady().then(async () => {
@@ -129,8 +197,7 @@ app.whenReady().then(async () => {
})
```
```html
<!-- worker.html ------------------------------------------------------------>
```html title='worker.html'
<script>
const { ipcRenderer } = require('electron')
@@ -153,8 +220,7 @@ ipcRenderer.on('new-client', (event) => {
</script>
```
```html
<!-- app.html --------------------------------------------------------------->
```html title='app.html'
<script>
const { ipcRenderer } = require('electron')
@@ -182,9 +248,7 @@ Electron's built-in IPC methods only support two modes: fire-and-forget
can implement a "response stream", where a single request responds with a
stream of data.
```js
// renderer.js ///////////////////////////////////////////////////////////////
```js title='renderer.js (Renderer Process)'
const makeStreamingRequest = (element, callback) => {
// MessageChannels are lightweight--it's cheap to create a new one for each
// request.
@@ -208,14 +272,12 @@ const makeStreamingRequest = (element, callback) => {
}
makeStreamingRequest(42, (data) => {
console.log('got response data:', event.data)
console.log('got response data:', data)
})
// We will see "got response data: 42" 10 times.
```
```js
// main.js ///////////////////////////////////////////////////////////////////
```js title='main.js (Main Process)'
ipcMain.on('give-me-a-stream', (event, msg) => {
// The renderer has sent us a MessagePort that it wants us to send our
// response over.
@@ -242,8 +304,7 @@ the renderer are delivered to the isolated world, rather than to the main
world. Sometimes you want to deliver messages to the main world directly,
without having to step through the isolated world.
```js
// main.js ///////////////////////////////////////////////////////////////////
```js title='main.js (Main Process)'
const { BrowserWindow, app, MessageChannelMain } = require('electron')
const path = require('path')
@@ -278,8 +339,7 @@ app.whenReady().then(async () => {
})
```
```js
// preload.js ////////////////////////////////////////////////////////////////
```js title='preload.js (Preload Script)'
const { ipcRenderer } = require('electron')
// We need to wait until the main world is ready to receive the message before
@@ -297,8 +357,7 @@ ipcRenderer.on('main-world-port', async (event) => {
})
```
```html
<!-- index.html ------------------------------------------------------------->
```html title='index.html'
<script>
window.onmessage = (event) => {
// event.source === window means the message is coming from the preload

View File

@@ -22,7 +22,6 @@ In `preload.js` use the [`contextBridge`] to inject a method `window.electron.st
```js
const { contextBridge, ipcRenderer } = require('electron')
const path = require('path')
contextBridge.exposeInMainWorld('electron', {
startDrag: (fileName) => {

View File

@@ -1,10 +1,17 @@
---
title: 'Process Model'
description: 'Electron inherits its multi-process architecture from Chromium, which makes the framework architecturally very similar to a modern web browser. This guide will expand on the concepts applied in the tutorial.'
slug: process-model
hide_title: false
---
# Process Model
Electron inherits its multi-process architecture from Chromium, which makes the framework
architecturally very similar to a modern web browser. In this guide, we'll expound on
the conceptual knowledge of Electron that we applied in the minimal [quick start app][].
architecturally very similar to a modern web browser. This guide will expand on the
concepts applied in the [Tutorial][tutorial].
[quick start app]: ./quick-start.md
[tutorial]: ./tutorial-1-prerequisites.md
## Why not a single process?
@@ -27,10 +34,10 @@ visualizes this model:
![Chrome's multi-process architecture](../images/chrome-processes.png)
Electron applications are structured very similarly. As an app developer, you control
two types of processes: main and renderer. These are analogous to Chrome's own browser
and renderer processes outlined above.
two types of processes: [main](#the-main-process) and [renderer](#the-renderer-process).
These are analogous to Chrome's own browser and renderer processes outlined above.
[Chrome Comic]: https://www.google.com/googlebooks/chrome/
[chrome comic]: https://www.google.com/googlebooks/chrome/
## The main process
@@ -40,7 +47,7 @@ to `require` modules and use all of Node.js APIs.
### Window management
The primary purpose of the main process is to create and manage application windows with the
The main process' primary purpose is to create and manage application windows with the
[`BrowserWindow`][browser-window] module.
Each instance of the `BrowserWindow` class creates an application window that loads
@@ -68,7 +75,7 @@ When a `BrowserWindow` instance is destroyed, its corresponding renderer process
terminated as well.
[browser-window]: ../api/browser-window.md
[web-embed]: ./web-embeds.md
[web-embed]: ../tutorial/web-embeds.md
[web-contents]: ../api/web-contents.md
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
@@ -90,7 +97,7 @@ app.on('window-all-closed', () => {
```
[app]: ../api/app.md
[quick-start-lifecycle]: ./quick-start.md#manage-your-windows-lifecycle
[quick-start-lifecycle]: ../tutorial/quick-start.md#manage-your-windows-lifecycle
### Native APIs
@@ -105,7 +112,7 @@ For a full list of Electron's main process modules, check out our API documentat
Each Electron app spawns a separate renderer process for each open `BrowserWindow`
(and each web embed). As its name implies, a renderer is responsible for
*rendering* web content. For all intents and purposes, code ran in renderer processes
_rendering_ web content. For all intents and purposes, code ran in renderer processes
should behave according to web standards (insofar as Chromium does, at least).
Therefore, all user interfaces and app functionality within a single browser
@@ -115,18 +122,22 @@ web.
Although explaining every web spec is out of scope for this guide, the bare minimum
to understand is:
* An HTML file is your entry point for the renderer process.
* UI styling is added through Cascading Style Sheets (CSS).
* Executable JavaScript code can be added through `<script>` elements.
- An HTML file is your entry point for the renderer process.
- UI styling is added through Cascading Style Sheets (CSS).
- Executable JavaScript code can be added through `<script>` elements.
Moreover, this also means that the renderer has no direct access to `require`
or other Node.js APIs. In order to directly include NPM modules in the renderer,
you must use the same bundler toolchains (for example, `webpack` or `parcel`) that you
use on the web.
> Note: Renderer processes can be spawned with a full Node.js environment for ease of
> development. Historically, this used to be the default, but this feature was disabled
> for security reasons.
:::warning
Renderer processes can be spawned with a full Node.js environment for ease of
development. Historically, this used to be the default, but this feature was disabled
for security reasons.
:::
At this point, you might be wondering how your renderer process user interfaces
can interact with Node.js and Electron's native desktop functionality if these
@@ -135,8 +146,9 @@ way to import Electron's content scripts.
## Preload scripts
<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally
<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally
change the statements here. -->
Preload scripts contain code that executes in a renderer process before its web content
begins loading. These scripts run within the renderer context, but are granted more
privileges by having access to Node.js APIs.
@@ -149,8 +161,8 @@ const { BrowserWindow } = require('electron')
//...
const win = new BrowserWindow({
webPreferences: {
preload: 'path/to/preload.js'
}
preload: 'path/to/preload.js',
},
})
//...
```
@@ -165,7 +177,7 @@ the [`contextIsolation`][context-isolation] default.
```js title='preload.js'
window.myAPI = {
desktop: true
desktop: true,
}
```
@@ -184,7 +196,7 @@ securely:
const { contextBridge } = require('electron')
contextBridge.exposeInMainWorld('myAPI', {
desktop: true
desktop: true,
})
```
@@ -195,14 +207,15 @@ console.log(window.myAPI)
This feature is incredibly useful for two main purposes:
* By exposing [`ipcRenderer`][ipcRenderer] helpers to the renderer, you can use
- By exposing [`ipcRenderer`][ipcrenderer] helpers to the renderer, you can use
inter-process communication (IPC) to trigger main process tasks from the
renderer (and vice-versa).
* If you're developing an Electron wrapper for an existing web app hosted on a remote
- If you're developing an Electron wrapper for an existing web app hosted on a remote
URL, you can add custom properties onto the renderer's `window` global that can
be used for desktop-only logic on the web client's side.
[window-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/Window
[context-isolation]: ./context-isolation.md
[context-bridge]: ../api/context-bridge.md
[ipcRenderer]: ../api/ipc-renderer.md
[ipcrenderer]: ../api/ipc-renderer.md
[tutorial]: ./tutorial-1-prerequisites.md

View File

@@ -12,28 +12,10 @@ the GPU service and the network service.
See Chromium's [Sandbox design document][sandbox] for more information.
## Electron's sandboxing policies
Electron comes with a mixed sandbox environment, meaning sandboxed processes can run
alongside privileged ones. By default, renderer processes are not sandboxed, but
utility processes are. Note that as in Chromium, the main (browser) process is
privileged and cannot be sandboxed.
Historically, this mixed sandbox approach was established because having Node.js available
in the renderer is an extremely powerful tool for app developers. Unfortunately, this
feature is also an equally massive security vulnerability.
Theoretically, unsandboxed renderers are not a problem for desktop applications that
only display trusted code, but they make Electron less secure than Chromium for
displaying untrusted web content. However, even purportedly trusted code may be
dangerous — there are countless attack vectors that malicious actors can use, from
cross-site scripting to content injection to man-in-the-middle attacks on remotely loaded
websites, just to name a few. For this reason, we recommend enabling renderer sandboxing
for the vast majority of cases under an abundance of caution.
<!--TODO: update this guide when #28466 is either solved or closed -->
Note that there is an active discussion in the issue tracker to enable renderer sandboxing
by default. See [#28466][issue-28466]) for details.
Starting from Electron 20, the sandbox is enabled for renderer processes without any
further configuration. If you want to disable the sandbox for a process, see the
[Disabling the sandbox for a single process](#disabling-the-sandbox-for-a-single-process)
section.
## Sandbox behaviour in Electron
@@ -46,12 +28,17 @@ When renderer processes in Electron are sandboxed, they behave in the same way a
regular Chrome renderer would. A sandboxed renderer won't have a Node.js
environment initialized.
<!-- TODO(erickzhao): when we have a solid guide for IPC, link it here -->
Therefore, when the sandbox is enabled, renderer processes can only perform privileged
tasks (such as interacting with the filesystem, making changes to the system, or spawning
subprocesses) by delegating these tasks to the main process via inter-process
communication (IPC).
:::note
For more info on inter-process communication, check out our [IPC guide](./ipc.md).
:::
### Preload scripts
In order to allow renderer processes to communicate with the main process, preload
@@ -66,7 +53,7 @@ but can only import a subset of Electron and Node's built-in modules:
In addition, the preload script also polyfills certain Node.js primitives as globals:
* [`Buffer`](https://nodejs.org/api/Buffer.html)
* [`Buffer`](https://nodejs.org/api/buffer.html)
* [`process`](../api/process.md)
* [`clearImmediate`](https://nodejs.org/api/timers.html#timers_clearimmediate_immediate)
* [`setImmediate`](https://nodejs.org/api/timers.html#timers_setimmediate_callback_args)
@@ -83,13 +70,17 @@ privileged APIs to untrusted code running in the renderer process unless
## Configuring the sandbox
### Enabling the sandbox for a single process
For most apps, sandboxing is the best choice. In certain use cases that are incompatible with
the sandbox (for instance, when using native node modules in the renderer),
it is possible to disable the sandbox for specific processes. This comes with security
risks, especially if any untrusted code or content is present in the unsandboxed process.
In Electron, renderer sandboxing can be enabled on a per-process basis with
the `sandbox: true` preference in the [`BrowserWindow`][browser-window] constructor.
### Disabling the sandbox for a single process
```js
// main.js
In Electron, renderer sandboxing can be disabled on a per-process basis with
the `sandbox: false` preference in the [`BrowserWindow`][browser-window] constructor.
```js title='main.js'
app.whenReady().then(() => {
const win = new BrowserWindow({
webPreferences: {
@@ -100,17 +91,30 @@ app.whenReady().then(() => {
})
```
Sandboxing is also disabled whenever Node.js integration is enabled in the renderer.
This can be done through the BrowserWindow constructor with the `nodeIntegration: true` flag.
```js title='main.js'
app.whenReady().then(() => {
const win = new BrowserWindow({
webPreferences: {
nodeIntegration: true
}
})
win.loadURL('https://google.com')
})
```
### Enabling the sandbox globally
If you want to force sandboxing for all renderers, you can also use the
[`app.enableSandbox`][enable-sandbox] API. Note that this API has to be called before the
app's `ready` event.
```js
// main.js
```js title='main.js'
app.enableSandbox()
app.whenReady().then(() => {
// no need to pass `sandbox: true` since `app.enableSandbox()` was called.
// any sandbox:false calls are overridden since `app.enableSandbox()` was called.
const win = new BrowserWindow()
win.loadURL('https://google.com')
})
@@ -139,16 +143,16 @@ issues:
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
1. 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
1. 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
1. 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.

View File

@@ -256,7 +256,7 @@ the sandbox in all renderers. Loading, reading or processing any untrusted
content in an unsandboxed process, including the main process, is not advised.
:::info
For more information on what `contextIsolation` is and how to enable it please
For more information on what Process Sandboxing is and how to enable it please
see our dedicated [Process Sandboxing](sandbox.md) document.
:::info

View File

@@ -1,95 +0,0 @@
# Testing Widevine CDM
In Electron you can use the Widevine CDM library shipped with Chrome browser.
Widevine Content Decryption Modules (CDMs) are how streaming services protect
content using HTML5 video to web browsers without relying on an NPAPI plugin
like Flash or Silverlight. Widevine support is an alternative solution for
streaming services that currently rely on Silverlight for playback of
DRM-protected video content. It will allow websites to show DRM-protected video
content in Firefox without the use of NPAPI plugins. The Widevine CDM runs in an
open-source CDM sandbox providing better user security than NPAPI plugins.
#### Note on VMP
As of [`Electron v1.8.0 (Chrome v59)`](https://electronjs.org/releases#1.8.1),
the below steps are may only be some of the necessary steps to enable Widevine;
any app on or after that version intending to use the Widevine CDM may need to
be signed using a license obtained from [Widevine](https://www.widevine.com/)
itself.
Per [Widevine](https://www.widevine.com/):
> Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP
> provides a method to verify the authenticity of a device platform. For browser
> deployments, this will provide an additional signal to determine if a
> browser-based implementation is reliable and secure.
>
> The proxy integration guide has been updated with information about VMP and
> how to issue licenses.
>
> Widevine recommends our browser-based integrations (vendors and browser-based
> applications) add support for VMP.
To enable video playback with this new restriction,
[castLabs](https://castlabs.com/open-source/downstream/) has created a
[fork](https://github.com/castlabs/electron-releases) that has implemented the
necessary changes to enable Widevine to be played in an Electron application if
one has obtained the necessary licenses from widevine.
## Getting the library
Open `chrome://components/` in Chrome browser, find `Widevine Content Decryption Module`
and make sure it is up to date, then you can find the library files from the
application directory.
### On Windows
The library file `widevinecdm.dll` will be under
`Program Files(x86)/Google/Chrome/Application/CHROME_VERSION/WidevineCdm/_platform_specific/win_(x86|x64)/`
directory.
### On macOS
The library file `libwidevinecdm.dylib` will be under
`/Applications/Google Chrome.app/Contents/Versions/CHROME_VERSION/Google Chrome Framework.framework/Versions/A/Libraries/WidevineCdm/_platform_specific/mac_(x86|x64)/`
directory.
**Note:** Make sure that chrome version used by Electron is greater than or
equal to the `min_chrome_version` value of Chrome's widevine cdm component.
The value can be found in `manifest.json` under `WidevineCdm` directory.
## Using the library
After getting the library files, you should pass the path to the file
with `--widevine-cdm-path` command line switch, and the library's version
with `--widevine-cdm-version` switch. The command line switches have to be
passed before the `ready` event of `app` module gets emitted.
Example code:
```javascript
const { app, BrowserWindow } = require('electron')
// You have to pass the directory that contains widevine library here, it is
// * `libwidevinecdm.dylib` on macOS,
// * `widevinecdm.dll` on Windows.
app.commandLine.appendSwitch('widevine-cdm-path', '/path/to/widevine_library')
// The version of plugin can be got from `chrome://components` page in Chrome.
app.commandLine.appendSwitch('widevine-cdm-version', '1.4.8.866')
let win = null
app.whenReady().then(() => {
win = new BrowserWindow()
win.show()
})
```
## Verifying Widevine CDM support
To verify whether widevine works, you can use following ways:
* Open https://shaka-player-demo.appspot.com/ and load a manifest that uses
`Widevine`.
* Open http://www.dash-player.com/demo/drm-test-area/, check whether the page
says `bitdash uses Widevine in your browser`, then play the video.

View File

@@ -0,0 +1,143 @@
---
title: 'Prerequisites'
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.'
slug: tutorial-prerequisites
hide_title: false
---
:::info Follow along the tutorial
This is **part 1** of the Electron tutorial.
1. **[Prerequisites][prerequisites]**
1. [Building your First App][building your first app]
1. [Using Preload Scripts][preload]
1. [Adding Features][features]
1. [Packaging Your Application][packaging]
1. [Publishing and Updating][updates]
:::
Electron is a framework for building desktop applications using JavaScript,
HTML, and CSS. By embedding [Chromium][chromium] and [Node.js][node] into a
single binary file, Electron allows you to create cross-platform apps that
work on Windows, macOS, and Linux with a single JavaScript codebase.
This tutorial will guide you through the process of developing a desktop
application with Electron and distributing it to end users.
## Assumptions
Electron is a native wrapper layer for web apps and is run in a Node.js environment.
Therefore, this tutorial assumes you are generally familiar with Node and
front-end web development basics. If you need to do some background reading before
continuing, we recommend the following resources:
- [Getting started with the Web (MDN Web Docs)][mdn-guide]
- [Introduction to Node.js][node-guide]
## Required tools
### Code editor
You will need a text editor to write your code. We recommend using [Visual Studio Code],
although you can choose whichever one you prefer.
### Command line
Throughout the tutorial, we will ask you to use various command-line interfaces (CLIs). You can
type these commands into your system's default terminal:
- Windows: Command Prompt or PowerShell
- macOS: Terminal
- Linux: varies depending on distribution (e.g. GNOME Terminal, Konsole)
Most code editors also come with an integrated terminal, which you can also use.
### Git and GitHub
Git is a commonly-used version control system for source code, and GitHub is a collaborative
development platform built on top of it. Although neither is strictly necessary to building
an Electron application, we will use GitHub releases to set up automatic updates later
on in the tutorial. Therefore, we'll require you to:
- [Create a GitHub account](https://github.com/join)
- [Install Git](https://github.com/git-guides/install-git)
If you're unfamiliar with how Git works, we recommend reading GitHub's [Git guides]. You can also
use the [GitHub Desktop] app if you prefer using a visual interface over the command line.
We recommend that you create a local Git repository and publish it to GitHub before starting
the tutorial, and commit your code after every step.
:::info Installing Git via GitHub Desktop
GitHub Desktop will install the latest version of Git on your system if you don't already have
it installed.
:::
### Node.js and npm
To begin developing an Electron app, you need to install the [Node.js][node-download]
runtime and its bundled npm package manager onto your system. We recommend that you
use the latest long-term support (LTS) version.
:::tip
Please install Node.js using pre-built installers for your platform.
You may encounter incompatibility issues with different development tools otherwise.
If you are using macOS, we recommend using a package manager like [Homebrew] or
[nvm] to avoid any directory permission issues.
:::
To check that Node.js was installed correctly, you can use the `-v` flag when
running the `node` and `npm` commands. These should print out the installed
versions.
```sh
$ node -v
v16.14.2
$ npm -v
8.7.0
```
:::caution
Although you need Node.js installed locally to scaffold an Electron project,
Electron **does not use your system's Node.js installation to run its code**. Instead, it
comes bundled with its own Node.js runtime. This means that your end users do not
need to install Node.js themselves as a prerequisite to running your app.
To check which version of Node.js is running in your app, you can access the global
[`process.versions`] variable in the main process or preload script. You can also reference
the list of versions in the [electron/releases] repository.
:::
<!-- Links -->
[chromium]: https://www.chromium.org/
[electron/releases]: https://github.com/electron/releases/blob/master/readme.md#releases
[homebrew]: https://brew.sh/
[mdn-guide]: https://developer.mozilla.org/en-US/docs/Learn/
[node]: https://nodejs.org/
[node-guide]: https://nodejs.dev/en/learn/
[node-download]: https://nodejs.org/en/download/
[nvm]: https://github.com/nvm-sh/nvm
[process-model]: ./process-model.md
[`process.versions`]: https://nodejs.org/api/process.html#processversions
[github]: https://github.com/
[git guides]: https://github.com/git-guides/
[github desktop]: https://desktop.github.com/
[visual studio code]: https://code.visualstudio.com/
<!-- Tutorial links -->
[prerequisites]: tutorial-1-prerequisites.md
[building your first app]: tutorial-2-first-app.md
[preload]: tutorial-3-preload.md
[features]: tutorial-4-adding-features.md
[packaging]: tutorial-5-packaging.md
[updates]: tutorial-6-publishing-updating.md

View File

@@ -0,0 +1,480 @@
---
title: 'Building your First App'
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.'
slug: tutorial-first-app
hide_title: false
---
:::info Follow along the tutorial
This is **part 2** of the Electron tutorial.
1. [Prerequisites][prerequisites]
1. **[Building your First App][building your first app]**
1. [Using Preload Scripts][preload]
1. [Adding Features][features]
1. [Packaging Your Application][packaging]
1. [Publishing and Updating][updates]
:::
## Learning goals
In this part of the tutorial, you will learn how to set up your Electron project
and write a minimal starter application. By the end of this section,
you should be able to run a working Electron app in development mode from
your terminal.
## Setting up your project
:::caution Avoid WSL
If you are on a Windows machine, please do not use [Windows Subsystem for Linux][wsl] (WSL)
when following this tutorial as you will run into issues when trying to execute the
application.
<!--https://www.electronforge.io/guides/developing-with-wsl-->
:::
### Initializing your npm project
Electron apps are scaffolded using npm, with the package.json file
as an entry point. Start by creating a folder and initializing an npm package
within it with `npm init`.
```sh npm2yarn
mkdir my-electron-app && cd my-electron-app
npm init
```
This command will prompt you to configure some fields in your package.json.
There are a few rules to follow for the purposes of this tutorial:
- _entry point_ should be `main.js` (you will be creating that file soon).
- _author_, _license_, and _description_ can be any value, but will be necessary for
[packaging][packaging] later on.
Then, install Electron into your app's **devDependencies**, which is the list of external
development-only package dependencies not required in production.
:::info Why is Electron a devDependency?
This may seem counter-intuitive since your production code is running Electron APIs.
However, packaged apps will come bundled with the Electron binary, eliminating the need to specify
it as a production dependency.
:::
```sh npm2yarn
npm install electron --save-dev
```
Your package.json file should look something like this after initializing your package
and installing Electron. You should also now have a `node_modules` folder containing
the Electron executable, as well as a `package-lock.json` lockfile that specifies
the exact dependency versions to install.
```json title='package.json'
{
"name": "my-electron-app",
"version": "1.0.0",
"description": "Hello World!",
"main": "main.js",
"author": "Jane Doe",
"license": "MIT",
"devDependencies": {
"electron": "19.0.0"
}
}
```
:::info Advanced Electron installation steps
If installing Electron directly fails, please refer to our [Advanced Installation][installation]
documentation for instructions on download mirrors, proxies, and troubleshooting steps.
:::
### Adding a .gitignore
The [`.gitignore`][gitignore] file specifies which files and directories to avoid tracking
with Git. You should place a copy of [GitHub's Node.js gitignore template][gitignore-template]
into your project's root folder to avoid committing your project's `node_modules` folder.
## Running an Electron app
:::tip Further reading
Read [Electron's process model][process-model] documentation to better
understand how Electron's multiple processes work together.
:::
The [`main`][package-json-main] script you defined in package.json is the entry point of any
Electron application. This script controls the **main process**, which runs in a Node.js
environment and is responsible for controlling your app's lifecycle, displaying native
interfaces, performing privileged operations, and managing renderer processes
(more on that later).
Before creating your first Electron app, you will first use a trivial script to ensure your
main process entry point is configured correctly. Create a `main.js` file in the root folder
of your project with a single line of code:
```js title='main.js'
console.log(`Hello from Electron 👋`)
```
Because Electron's main process is a Node.js runtime, you can execute arbitrary Node.js code
with the `electron` command (you can even use it as a [REPL]). To execute this script,
add `electron .` to the `start` command in the [`scripts`][package-scripts]
field of your package.json. This command will tell the Electron executable to look for the main
script in the current directory and run it in dev mode.
```json {8-10} title='package.json'
{
"name": "my-electron-app",
"version": "1.0.0",
"description": "Hello World!",
"main": "main.js",
"author": "Jane Doe",
"license": "MIT",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "^19.0.0"
}
}
```
```sh npm2yarn
npm run start
```
Your terminal should print out `Hello from Electron 👋`. Congratulations,
you have executed your first line of code in Electron! Next, you will learn
how to create user interfaces with HTML and load that into a native window.
## Loading a web page into a BrowserWindow
In Electron, each window displays a web page that can be loaded either from a local HTML
file or a remote web address. For this example, you will be loading in a local file. Start
by creating a barebones web page in an `index.html` file in the root folder of your project:
```html title='index.html'
<!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 from Electron renderer!</title>
</head>
<body>
<h1>Hello from Electron renderer!</h1>
<p>👋</p>
</body>
</html>
```
Now that you have a web page, you can load it into an Electron [BrowserWindow][browser-window].
Replace the contents your `main.js` file with the following code. We will explain each
highlighted block separately.
```js {1,3-10,12-14} title='main.js' showLineNumbers
const { app, BrowserWindow } = require('electron')
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
})
win.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
})
```
### Importing modules
```js title='main.js (Line 1)'
const { app, BrowserWindow } = require('electron')
```
In the first line, we are importing two Electron modules
with CommonJS module syntax:
- [app][app], which controls your application's event lifecycle.
- [BrowserWindow][browser-window], which creates and manages app windows.
:::info Capitalization conventions
You might have noticed the capitalization difference between the **a**pp
and **B**rowser**W**indow modules. Electron follows typical JavaScript conventions here,
where PascalCase modules are instantiable class constructors (e.g. BrowserWindow, Tray,
Notification) whereas camelCase modules are not instantiable (e.g. app, ipcRenderer, webContents).
:::
:::warning ES Modules in Electron
[ECMAScript modules](https://nodejs.org/api/esm.html) (i.e. using `import` to load a module)
are currently not directly supported in Electron. You can find more information about the
state of ESM in Electron in [electron/electron#21457](https://github.com/electron/electron/issues/21457).
:::
### Writing a reusable function to instantiate windows
The `createWindow()` function loads your web page into a new BrowserWindow instance:
```js title='main.js (Lines 3-10)'
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
})
win.loadFile('index.html')
}
```
### Calling your function when the app is ready
```js title='main.js (Lines 12-14)'
app.whenReady().then(() => {
createWindow()
})
```
Many of Electron's core modules are Node.js [event emitters] that adhere to Node's asynchronous
event-driven architecture. The app module is one of these emitters.
In Electron, BrowserWindows can only be created after the app module's [`ready`][app-ready] event
is fired. You can wait for this event by using the [`app.whenReady()`][app-when-ready] API and
calling `createWindow()` once its promise is fulfilled.
:::info
You typically listen to Node.js events by using an emitter's `.on` function.
```diff
+ app.on('ready').then(() => {
- app.whenReady().then(() => {
createWindow()
})
```
However, Electron exposes `app.whenReady()` as a helper specifically for the `ready` event to
avoid subtle pitfalls with directly listening to that event in particular.
See [electron/electron#21972](https://github.com/electron/electron/pull/21972) for details.
:::
At this point, running your Electron application's `start` command should successfully
open a window that displays your web page!
Each web page your app displays in a window will run in a separate process called a
**renderer** process (or simply _renderer_ for short). Renderer processes have access
to the same JavaScript APIs and tooling you use for typical front-end web
development, such as using [webpack] to bundle and minify your code or [React][react]
to build your user interfaces.
## Managing your app's window lifecycle
Application windows behave differently on each operating system. Rather than
enforce these conventions by default, Electron gives you the choice to implement
them in your app code if you wish to follow them. You can implement basic window
conventions by listening for events emitted by the app and BrowserWindow modules.
:::tip Process-specific control flow
Checking against Node's [`process.platform`][node-platform] variable can help you
to run code conditionally on certain platforms. Note that there are only three
possible platforms that Electron can run in: `win32` (Windows), `linux` (Linux),
and `darwin` (macOS).
:::
### Quit the app when all windows are closed (Windows & Linux)
On Windows and Linux, closing all windows will generally quit an application entirely.
To implement this pattern in your Electron app, listen for the app module's
[`window-all-closed`][window-all-closed] event, and call [`app.quit()`][app-quit]
to exit your app if the user is not on macOS.
```js
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
```
### Open a window if none are open (macOS)
In contrast, macOS apps generally continue running even without any windows open.
Activating the app when no windows are available should open a new one.
To implement this feature, listen for the app module's [`activate`][activate]
event, and call your existing `createWindow()` method if no BrowserWindows are open.
Because windows cannot be created before the `ready` event, you should only listen for
`activate` events after your app is initialized. Do this by only listening for activate
events inside your existing `whenReady()` callback.
```js
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
```
## Final starter code
```fiddle docs/fiddles/tutorial-first-app
```
## Optional: Debugging from VS Code
If you want to debug your application using VS Code, you need to attach VS Code to
both the main and renderer processes. Here is a sample configuration for you to
run. Create a launch.json configuration in a new `.vscode` folder in your project:
```json title='.vscode/launch.json'
{
"version": "0.2.0",
"compounds": [
{
"name": "Main + renderer",
"configurations": ["Main", "Renderer"],
"stopAll": true
}
],
"configurations": [
{
"name": "Renderer",
"port": 9222,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}"
},
{
"name": "Main",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
},
"args": [".", "--remote-debugging-port=9222"],
"outputCapture": "std",
"console": "integratedTerminal"
}
]
}
```
The "Main + renderer" option will appear when you select "Run and Debug"
from the sidebar, allowing you to set breakpoints and inspect all the variables among
other things in both the main and renderer processes.
What we have done in the `launch.json` file is to create 3 configurations:
- `Main` is used to start the main process and also expose port 9222 for remote debugging
(`--remote-debugging-port=9222`). This is the port that we will use to attach the debugger
for the `Renderer`. Because the main process is a Node.js process, the type is set to
`node`.
- `Renderer` is used to debug the renderer process. Because the main process is the one
that creates the process, we have to "attach" to it (`"request": "attach"`) instead of
creating a new one.
The renderer process is a web one, so the debugger we have to use is `chrome`.
- `Main + renderer` is a [compound task] that executes the previous ones simultaneously.
:::caution
Because we are attaching to a process in `Renderer`, it is possible that the first lines of
your code will be skipped as the debugger will not have had enough time to connect before they are
being executed.
You can work around this by refreshing the page or setting a timeout before executing the code
in development mode.
:::
:::info Further reading
If you want to dig deeper in the debugging area, the following guides provide more information:
- [Application Debugging]
- [DevTools Extensions][devtools extension]
:::
## Summary
Electron applications are set up using npm packages. The Electron executable should be installed
in your project's `devDependencies` and can be run in development mode using a script in your
package.json file.
The executable runs the JavaScript entry point found in the `main` property of your package.json.
This file controls Electron's **main process**, which runs an instance of Node.js and is
responsible for your app's lifecycle, displaying native interfaces, performing privileged operations,
and managing renderer processes.
**Renderer processes** (or renderers for short) are responsible for display graphical content. You can
load a web page into a renderer by pointing it to either a web address or a local HTML file.
Renderers behave very similarly to regular web pages and have access to the same web APIs.
In the next section of the tutorial, we will be learning how to augment the renderer process with
privileged APIs and how to communicate between processes.
<!-- Links -->
[activate]: ../api/app.md#event-activate-macos
[advanced-installation]: installation.md
[app]: ../api/app.md
[app-quit]: ../api/app.md#appquit
[app-ready]: ../api/app.md#event-ready
[app-when-ready]: ../api/app.md#appwhenready
[application debugging]: ./application-debugging.md
[browser-window]: ../api/browser-window.md
[commonjs]: https://nodejs.org/docs/../api/modules.html#modules_modules_commonjs_modules
[compound task]: https://code.visualstudio.com/Docs/editor/tasks#_compound-tasks
[devtools extension]: ./devtools-extension.md
[event emitters]: https://nodejs.org/api/events.html#events
[gitignore]: https://git-scm.com/docs/gitignore
[gitignore-template]: https://github.com/github/gitignore/blob/main/Node.gitignore
[installation]: ./installation.md
[node-platform]: https://nodejs.org/api/process.html#process_process_platform
[package-json-main]: https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main
[package-scripts]: https://docs.npmjs.com/cli/v7/using-npm/scripts
[process-model]: process-model.md
[react]: https://reactjs.org
[repl]: ./repl.md
[sandbox]: ./sandbox.md
[webpack]: https://webpack.js.org
[window-all-closed]: ../api/app.md#event-window-all-closed
[wsl]: https://docs.microsoft.com/en-us/windows/wsl/about#what-is-wsl-2
<!-- Tutorial links -->
[prerequisites]: tutorial-1-prerequisites.md
[building your first app]: tutorial-2-first-app.md
[preload]: tutorial-3-preload.md
[features]: tutorial-4-adding-features.md
[packaging]: tutorial-5-packaging.md
[updates]: tutorial-6-publishing-updating.md

View File

@@ -0,0 +1,289 @@
---
title: 'Using Preload Scripts'
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.'
slug: tutorial-preload
hide_title: false
---
:::info Follow along the tutorial
This is **part 3** of the Electron tutorial.
1. [Prerequisites][prerequisites]
1. [Building your First App][building your first app]
1. **[Using Preload Scripts][preload]**
1. [Adding Features][features]
1. [Packaging Your Application][packaging]
1. [Publishing and Updating][updates]
:::
## Learning goals
In this part of the tutorial, you will learn what a preload script is and how to use one
to securely expose privileged APIs into the renderer process. You will also learn how to
communicate between main and renderer processes with Electron's inter-process
communication (IPC) modules.
## What is a preload script?
Electron's main process is a Node.js environment that has full operating system access.
On top of [Electron modules][modules], you can also access [Node.js built-ins][node-api],
as well as any packages installed via npm. On the other hand, renderer processes run web
pages and do not run Node.js by default for security reasons.
To bridge Electron's different process types together, we will need to use a special script
called a **preload**.
## Augmenting the renderer with a preload script
A BrowserWindow's preload script runs in a context that has access to both the HTML DOM
and a limited subset of Node.js and Electron APIs.
:::info Preload script sandboxing
From Electron 20 onwards, preload scripts are **sandboxed** by default and no longer have access
to a full Node.js environment. Practically, this means that you have a polyfilled `require`
function that only has access to a limited set of APIs.
| Available API | Details |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Electron modules | Renderer process modules |
| Node.js modules | [`events`](https://nodejs.org/api/events.html), [`timers`](https://nodejs.org/api/timers.html), [`url`](https://nodejs.org/api/url.html) |
| Polyfilled globals | [`Buffer`](https://nodejs.org/api/buffer.html), [`process`](../api/process.md), [`clearImmediate`](https://nodejs.org/api/timers.html#timers_clearimmediate_immediate), [`setImmediate`](https://nodejs.org/api/timers.html#timers_setimmediate_callback_args) |
For more information, check out the [Process Sandboxing](./sandbox.md) guide.
:::
Preload scripts are injected before a web page loads in the renderer,
similar to a Chrome extension's [content scripts][content-script]. To add features to your renderer
that require privileged access, you can define [global] objects through the
[contextBridge][contextbridge] API.
To demonstrate this concept, you will create a preload script that exposes your app's
versions of Chrome, Node, and Electron into the renderer.
Add a new `preload.js` script that exposes selected properties of Electron's `process.versions`
object to the renderer process in a `versions` global variable.
```js title="preload.js"
const { contextBridge } = require('electron')
contextBridge.exposeInMainWorld('versions', {
node: () => process.versions.node,
chrome: () => process.versions.chrome,
electron: () => process.versions.electron,
// we can also expose variables, not just functions
})
```
To attach this script to your renderer process, pass its path to the
`webPreferences.preload` option in the BrowserWindow constructor:
```js {8-10} title="main.js"
const { app, BrowserWindow } = require('electron')
const path = require('path')
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
},
})
win.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
})
```
:::info
There are two Node.js concepts that are used here:
- The [`__dirname`][dirname] string points to the path of the currently executing script
(in this case, your project's root folder).
- The [`path.join`][path-join] API joins multiple path segments together, creating a
combined path string that works across all platforms.
:::
At this point, the renderer has access to the `versions` global, so let's display that
information in the window. This variable can be accessed via `window.versions` or simply
`versions`. Create a `renderer.js` script that uses the [`document.getElementById`]
DOM API to replace the displayed text for the HTML element with `info` as its `id` property.
```js title="renderer.js"
const information = document.getElementById('info')
information.innerText = `This app is using Chrome (v${versions.chrome()}), Node.js (v${versions.node()}), and Electron (v${versions.electron()})`
```
Then, modify your `index.html` by adding a new element with `info` as its `id` property,
and attach your `renderer.js` script:
```html {18,20} title="index.html"
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<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 from Electron renderer!</title>
</head>
<body>
<h1>Hello from Electron renderer!</h1>
<p>👋</p>
<p id="info"></p>
</body>
<script src="./renderer.js"></script>
</html>
```
After following the above steps, your app should look something like this:
![Electron app showing This app is using Chrome (v102.0.5005.63), Node.js (v16.14.2), and Electron (v19.0.3)](../images/preload-example.png)
And the code should look like this:
```fiddle docs/fiddles/tutorial-preload
```
## Communicating between processes
As we have mentioned above, Electron's main and renderer process have distinct responsibilities
and are not interchangeable. This means it is not possible to access the Node.js APIs directly
from the renderer process, nor the HTML Document Object Model (DOM) from the main process.
The solution for this problem is to use Electron's `ipcMain` and `ipcRenderer` modules for
inter-process communication (IPC). To send a message from your web page to the main process,
you can set up a main process handler with `ipcMain.handle` and
then expose a function that calls `ipcRenderer.invoke` to trigger the handler in your preload script.
To illustrate, we will add a global function to the renderer called `ping()`
that will return a string from the main process.
First, set up the `invoke` call in your preload script:
```js {1,7} title="preload.js"
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('versions', {
node: () => process.versions.node,
chrome: () => process.versions.chrome,
electron: () => process.versions.electron,
ping: () => ipcRenderer.invoke('ping'),
// we can also expose variables, not just functions
})
```
:::caution IPC security
Notice how we wrap the `ipcRenderer.invoke('ping')` call in a helper function rather
than expose the `ipcRenderer` module directly via context bridge. You **never** want to
directly expose the entire `ipcRenderer` module via preload. This would give your renderer
the ability to send arbitrary IPC messages to the main process, which becomes a powerful
attack vector for malicious code.
:::
Then, set up your `handle` listener in the main process. We do this _before_
loading the HTML file so that the handler is guaranteed to be ready before
you send out the `invoke` call from the renderer.
```js {1,11} title="main.js"
const { ipcMain } = require('electron')
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
},
})
ipcMain.handle('ping', () => 'pong')
win.loadFile('index.html')
}
```
Once you have the sender and receiver set up, you can now send messages from the renderer
to the main process through the `'ping'` channel you just defined.
```js title='renderer.js'
const func = async () => {
const response = await window.versions.ping()
console.log(response) // prints out 'pong'
}
func()
```
:::info
For more in-depth explanations on using the `ipcRenderer` and `ipcMain` modules,
check out the full [Inter-Process Communication][ipc] guide.
:::
## Summary
A preload script contains code that runs before your web page is loaded into the browser
window. It has access to both DOM APIs and Node.js environment, and is often used to
expose privileged APIs to the renderer via the `contextBridge` API.
Because the main and renderer processes have very different responsibilities, Electron
apps often use the preload script to set up inter-process communication (IPC) interfaces
to pass arbitrary messages between the two kinds of processes.
In the next part of the tutorial, we will be showing you resources on adding more
functionality to your app, then teaching you distributing your app to users.
<!-- Links -->
[advanced-installation]: ./installation.md
[application debugging]: ./application-debugging.md
[app]: ../api/app.md
[app-ready]: ../api/app.md#event-ready
[app-when-ready]: ../api/app.md#appwhenready
[browser-window]: ../api/browser-window.md
[commonjs]: https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules
[compound task]: https://code.visualstudio.com/Docs/editor/tasks#_compound-tasks
[content-script]: https://developer.chrome.com/docs/extensions/mv3/content_scripts/
[contextbridge]: ../api/context-bridge.md
[context-isolation]: ./context-isolation.md
[`document.getelementbyid`]: https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById
[devtools-extension]: ./devtools-extension.md
[dirname]: https://nodejs.org/api/modules.html#modules_dirname
[global]: https://developer.mozilla.org/en-US/docs/Glossary/Global_object
[ipc]: ./ipc.md
[mdn-csp]: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
[modules]: ../api/app.md
[node-api]: https://nodejs.org/dist/latest/docs/api/
[package-json-main]: https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main
[package-scripts]: https://docs.npmjs.com/cli/v7/using-npm/scripts
[path-join]: https://nodejs.org/api/path.html#path_path_join_paths
[process-model]: ./process-model.md
[react]: https://reactjs.org
[sandbox]: ./sandbox.md
[webpack]: https://webpack.js.org
<!-- Tutorial links -->
[prerequisites]: tutorial-1-prerequisites.md
[building your first app]: tutorial-2-first-app.md
[preload]: tutorial-3-preload.md
[features]: tutorial-4-adding-features.md
[packaging]: tutorial-5-packaging.md
[updates]: tutorial-6-publishing-updating.md

View File

@@ -0,0 +1,77 @@
---
title: 'Adding Features'
description: 'In this step of the tutorial, we will share some resources you should read to add features to your application'
slug: tutorial-adding-features
hide_title: false
---
:::info Follow along the tutorial
This is **part 4** of the Electron tutorial.
1. [Prerequisites][prerequisites]
1. [Building your First App][building your first app]
1. [Using Preload Scripts][preload]
1. **[Adding Features][features]**
1. [Packaging Your Application][packaging]
1. [Publishing and Updating][updates]
:::
## Adding application complexity
If you have been following along, you should have a functional Electron application
with a static user interface. From this starting point, you can generally progress
in developing your app in two broad directions:
1. Adding complexity to your renderer process' web app code
1. Deeper integrations with the operating system and Node.js
It is important to understand the distinction between these two broad concepts. For the
first point, Electron-specific resources are not necessary. Building a pretty to-do
list in Electron is just pointing your Electron BrowserWindow to a pretty
to-do list web app. Ultimately, you are building your renderer's UI using the same tools
(HTML, CSS, JavaScript) that you would on the web. Therefore, Electron's docs will
not go in-depth on how to use standard web tools.
On the other hand, Electron also provides a rich set of tools that allow
you to integrate with the desktop environment, from creating tray icons to adding
global shortcuts to displaying native menus. It also gives you all the power of a
Node.js environment in the main process. This set of capabilities separates
Electron applications from running a website in a browser tab, and are the
focus of Electron's documentation.
## How-to examples
Electron's documentation has many tutorials to help you with more advanced topics
and deeper operating system integrations. To get started, check out the
[How-To Examples][how-to] doc.
:::note Let us know if something is missing!
If you can't find what you are looking for, please let us know on [GitHub] or in
our [Discord server][discord]!
:::
## What's next?
For the rest of the tutorial, we will be shifting away from application code
and giving you a look at how you can get your app from your developer machine
into end users' hands.
<!-- Link labels -->
[discord]: https://discord.com/invite/APGC3k5yaH
[github]: https://github.com/electron/electronjs.org-new/issues/new
[how-to]: ./examples.md
[node-platform]: https://nodejs.org/api/process.html#process_process_platform
<!-- Tutorial links -->
[prerequisites]: tutorial-1-prerequisites.md
[building your first app]: tutorial-2-first-app.md
[preload]: tutorial-3-preload.md
[features]: tutorial-4-adding-features.md
[packaging]: tutorial-5-packaging.md
[updates]: tutorial-6-publishing-updating.md

View File

@@ -0,0 +1,232 @@
---
title: 'Packaging Your Application'
description: 'To distribute your app with Electron, you need to package it and create installers.'
slug: tutorial-packaging
hide_title: false
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
:::info Follow along the tutorial
This is **part 5** of the Electron tutorial.
1. [Prerequisites][prerequisites]
1. [Building your First App][building your first app]
1. [Using Preload Scripts][preload]
1. [Adding Features][features]
1. **[Packaging Your Application][packaging]**
1. [Publishing and Updating][updates]
:::
## Learning goals
In this part of the tutorial, we'll be going over the basics of packaging and distributing
your app with [Electron Forge].
## Using Electron Forge
Electron does not have any tooling for packaging and distribution bundled into its core
modules. Once you have a working Electron app in dev mode, you need to use
additional tooling to create a packaged app you can distribute to your users (also known
as a **distributable**). Distributables can be either installers (e.g. MSI on Windows) or
portable executable files (e.g. `.app` on macOS).
Electron Forge is an all-in-one tool that handles the packaging and distribution of Electron
apps. Under the hood, it combines a lot of existing Electron tools (e.g. [`electron-packager`],
[`@electron/osx-sign`], [`electron-winstaller`], etc.) into a single interface so you do not
have to worry about wiring them all together.
### Importing your project into Forge
You can install Electron Forge's CLI in your project's `devDependencies` and import your
existing project with a handy conversion script.
```sh npm2yarn
npm install --save-dev @electron-forge/cli
npx electron-forge import
```
Once the conversion script is done, Forge should have added a few scripts
to your `package.json` file.
```json title='package.json'
//...
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
},
//...
```
:::info CLI documentation
For more information on `make` and other Forge APIs, check out
the [Electron Forge CLI documentation].
:::
You should also notice that your package.json now has a few more packages installed
under your `devDependencies`, and contains an added `config.forge` field with an array
of makers configured. **Makers** are Forge plugins that create distributables from
your source code. You should see multiple makers in the pre-populated configuration,
one for each target platform.
### Creating a distributable
To create a distributable, use your project's new `make` script, which runs the
`electron-forge make` command.
```sh npm2yarn
npm run make
```
This `make` command contains two steps:
1. It will first run `electron-forge package` under the hood, which bundles your app
code together with the Electron binary. The packaged code is generated into a folder.
1. It will then use this packaged app folder to create a separate distributable for each
configured maker.
After the script runs, you should see an `out` folder containing both the distributable
and a folder containing the packaged application code.
```plain title='macOS output example'
out/
├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip
├── ...
└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app
```
The distributable in the `out/make` folder should be ready to launch! You have now
created your first bundled Electron application.
:::tip Distributable formats
Electron Forge can be configured to create distributables in different OS-specific formats
(e.g. DMG, deb, MSI, etc.). See Forge's [Makers] documentation for all configuration options.
:::
:::tip Creating and Adding Application Icons
Setting custom application icons requires a few additions to your config. Check out [Forge's icon tutorial] for more information.
:::
:::note Packaging without Electron Forge
If you want to manually package your code, or if you're just interested understanding the
mechanics behind packaging an Electron app, check out the full [Application Packaging]
documentation.
:::
## Important: signing your code
In order to distribute desktop applications to end users, we _highly recommended_ for you
to **code sign** your Electron app. Code signing is an important part of shipping
desktop applications, and is mandatory for the auto-update step in the final part
of the tutorial.
Code signing is a security technology that you use to certify that a desktop app was
created by a known source. Windows and macOS have their own OS-specific code signing
systems that will make it difficult for users to download or launch unsigned applications.
If you already have code signing certificates for Windows and macOS, you can set your
credentials in your Forge configuration. Otherwise, please refer to the full
[Code Signing] documentation to learn how to purchase a certificate and for more information
on the desktop app code signing process.
On macOS, code signing is done at the app packaging level. On Windows, distributable installers
are signed instead.
<Tabs>
<TabItem value="macos" label="macOS" default>
```json title='package.json' {6-18}
{
//...
"config": {
"forge": {
//...
"packagerConfig": {
"osxSign": {
"identity": "Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)",
"hardened-runtime": true,
"entitlements": "entitlements.plist",
"entitlements-inherit": "entitlements.plist",
"signature-flags": "library"
},
"osxNotarize": {
"appleId": "felix@felix.fun",
"appleIdPassword": "this-is-a-secret"
}
}
//...
}
}
//...
}
```
</TabItem>
<TabItem value="windows" label="Windows">
```json title='package.json' {6-14}
{
//...
"config": {
"forge": {
//...
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"certificateFile": "./cert.pfx",
"certificatePassword": "this-is-a-secret"
}
}
]
//...
}
}
//...
}
```
</TabItem>
</Tabs>
## Summary
Electron applications need to be packaged to be distributed to users. In this tutorial,
you imported your app into Electron Forge and configured it to package your app and
generate installers.
In order for your application to be trusted by the user's system, you need to digitally
certify that the distributable is authentic and untampered by code signing it. Your app
can be signed through Forge once you configure it to use your code signing certificate
information.
[`@electron/osx-sign`]: https://github.com/electron/osx-sign
[application packaging]: ./application-distribution.md
[code signing]: ./code-signing.md
[`electron-packager`]: https://github.com/electron/electron-packager
[`electron-winstaller`]: https://github.com/electron/windows-installer
[electron forge]: https://www.electronforge.io
[electron forge cli documentation]: https://www.electronforge.io/cli#commands
[makers]: https://www.electronforge.io/config/makers
[Forge's icon tutorial]: https://www.electronforge.io/guides/create-and-add-icons
<!-- Tutorial links -->
[prerequisites]: tutorial-1-prerequisites.md
[building your first app]: tutorial-2-first-app.md
[preload]: tutorial-3-preload.md
[features]: tutorial-4-adding-features.md
[packaging]: tutorial-5-packaging.md
[updates]: tutorial-6-publishing-updating.md

View File

@@ -0,0 +1,251 @@
---
title: 'Publishing and Updating'
description: "There are several ways to update an Electron application. The easiest and officially supported one is taking advantage of the built-in Squirrel framework and Electron's autoUpdater module."
slug: tutorial-publishing-updating
hide_title: false
---
:::info Follow along the tutorial
This is **part 6** of the Electron tutorial.
1. [Prerequisites][prerequisites]
1. [Building your First App][building your first app]
1. [Using Preload Scripts][preload]
1. [Adding Features][features]
1. [Packaging Your Application][packaging]
1. **[Publishing and Updating][updates]**
:::
## Learning goals
If you've been following along, this is the last step of the tutorial! In this part,
you will publish your app to GitHub releases and integrate automatic updates
into your app code.
## Using update.electronjs.org
The Electron maintainers provide a free auto-updating service for open-source apps
at https://update.electronjs.org. Its requirements are:
- Your app runs on macOS or Windows
- Your app has a public GitHub repository
- Builds are published to [GitHub releases]
- Builds are [code signed][code-signed]
At this point, we'll assume that you have already pushed all your
code to a public GitHub repository.
:::info Alternative update services
If you're using an alternate repository host (e.g. GitLab or Bitbucket) or if
you need to keep your code repository private, please refer to our
[step-by-step guide][update-server] on hosting your own Electron update server.
:::
## Publishing a GitHub release
Electron Forge has [Publisher] plugins that can automate the distribution
of your packaged application to various sources. In this tutorial, we will
be using the GitHub Publisher, which will allow us to publish
our code to GitHub releases.
### Generating a personal access token
Forge cannot publish to any repository on GitHub without permission. You
need to pass in an authenticated token that gives Forge access to
your GitHub releases. The easiest way to do this is to
[create a new personal access token (PAT)][new-pat]
with the `public_repo` scope, which gives write access to your public repositories.
**Make sure to keep this token a secret.**
### Setting up the GitHub Publisher
#### Installing the module
Forge's [GitHub Publisher] is a plugin that
needs to be installed in your project's `devDependencies`:
```sh npm2yarn
npm install --save-dev @electron-forge/publisher-github
```
#### Configuring the publisher in Forge
Once you have it installed, you need to set it up in your Forge
configuration. A full list of options is documented in the Forge's
[`PublisherGitHubConfig`] API docs.
```json title='package.json' {6-16}
{
//...
"config": {
"forge": {
"publishers": [
{
"name": "@electron-forge/publisher-github",
"config": {
"repository": {
"owner": "github-user-name",
"name": "github-repo-name"
},
"prerelease": false,
"draft": true
}
}
]
}
}
//...
}
```
:::tip Drafting releases before publishing
Notice that you have configured Forge to publish your release as a draft.
This will allow you to see the release with its generated artifacts
without actually publishing it to your end users. You can manually
publish your releases via GitHub after writing release notes and
double-checking that your distributables work.
:::
#### Setting up your authentication token
You also need to make the Publisher aware of your authentication token.
By default, it will use the value stored in the `GITHUB_TOKEN` environment
variable.
### Running the publish command
Add Forge's [publish command] to your npm scripts.
```json {6} title='package.json'
//...
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish"
},
//...
```
This command will run your configured makers and publish the output distributables to a new
GitHub release.
```sh npm2yarn
npm run publish
```
By default, this will only publish a single distributable for your host operating system and
architecture. You can publish for different architectures by passing in the `--arch` flag to your
Forge commands.
The name of this release will correspond to the `version` field in your project's package.json file.
:::tip Tagging releases
Optionally, you can also [tag your releases in Git][git-tag] so that your
release is associated with a labeled point in your code history. npm comes
with a handy [`npm version`](https://docs.npmjs.com/cli/v8/commands/npm-version)
command that can handle the version bumping and tagging for you.
:::
#### Bonus: Publishing in GitHub Actions
Publishing locally can be painful, especially because you can only create distributables
for your host operating system (i.e. you can't publish a Window `.exe` file from macOS).
A solution for this would be to publish your app via automation workflows
such as [GitHub Actions], which can run tasks in the
cloud on Ubuntu, macOS, and Windows. This is the exact approach taken by [Electron Fiddle].
You can refer to Fiddle's [Build and Release pipeline][fiddle-build]
and [Forge configuration][fiddle-forge-config]
for more details.
## Instrumenting your updater code
Now that we have a functional release system via GitHub releases, we now need to tell our
Electron app to download an update whenever a new release is out. Electron apps do this
via the [autoUpdater] module, which reads from an update server feed to check if a new version
is available for download.
The update.electronjs.org service provides an updater-compatible feed. For example, Electron
Fiddle v0.28.0 will check the endpoint at https://update.electronjs.org/electron/fiddle/darwin/v0.28.0
to see if a newer GitHub release is available.
After your release is published to GitHub, the update.electronjs.org service should work
for your application. The only step left is to configure the feed with the autoUpdater module.
To make this process easier, the Electron team maintains the [`update-electron-app`] module,
which sets up the autoUpdater boilerplate for update.electronjs.org in one function
call — no configuration required. This module will search for the update.electronjs.org
feed that matches your project's package.json `"repository"` field.
First, install the module as a runtime dependency.
```sh npm2yarn
npm install update-electron-app
```
Then, import the module and call it immediately in the main process.
```js title='main.js'
require('update-electron-app')()
```
And that is all it takes! Once your application is packaged, it will update itself for each new
GitHub release that you publish.
## Summary
In this tutorial, we configured Electron Forge's GitHub Publisher to upload your app's
distributables to GitHub releases. Since distributables cannot always be generated
between platforms, we recommend setting up your building and publishing flow
in a Continuous Integration pipeline if you do not have access to machines.
Electron applications can self-update by pointing the autoUpdater module to an update server feed.
update.electronjs.org is a free update server provided by Electron for open-source applications
published on GitHub releases. Configuring your Electron app to use this service is as easy as
installing and importing the `update-electron-app` module.
If your application is not eligible for update.electronjs.org, you should instead deploy your
own update server and configure the autoUpdater module yourself.
:::info 🌟 You're done!
From here, you have officially completed our tutorial to Electron. Feel free to explore the
rest of our docs and happy developing! If you have questions, please stop by our community
[Discord server].
:::
[autoupdater]: ../api/auto-updater.md
[code-signed]: ./code-signing.md
[discord server]: https://discord.com/invite/APGC3k5yaH
[electron fiddle]: https://electronjs.org/fiddle
[fiddle-build]: https://github.com/electron/fiddle/blob/master/.github/workflows/build.yaml
[fiddle-forge-config]: https://github.com/electron/fiddle/blob/master/forge.config.js
[github actions]: https://github.com/features/actions
[github publisher]: https://www.electronforge.io/config/publishers/github
[github releases]: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
[git tag]: https://git-scm.com/book/en/v2/Git-Basics-Tagging
[new-pat]: https://github.com/settings/tokens/new
[publish command]: https://www.electronforge.io/cli#publish
[publisher]: https://www.electronforge.io/config/publishers
[`publishergithubconfig`]: https://js.electronforge.io/publisher/github/interfaces/publishergithubconfig
[`update-electron-app`]: https://github.com/electron/update-electron-app
[update-server]: ./updates.md
<!-- Tutorial links -->
[prerequisites]: tutorial-1-prerequisites.md
[building your first app]: tutorial-2-first-app.md
[preload]: tutorial-3-preload.md
[features]: tutorial-4-adding-features.md
[packaging]: tutorial-5-packaging.md
[updates]: tutorial-6-publishing-updating.md

View File

@@ -1,11 +1,16 @@
# Updating Applications
---
title: 'Updating Applications'
description: "There are several ways to update an Electron application. The easiest and officially supported one is taking advantage of the built-in Squirrel framework and Electron's autoUpdater module."
slug: updates
hide_title: false
---
There are several ways to update an Electron application. The easiest and
officially supported one is taking advantage of the built-in
There are several ways to provide automatic updates to your Electron application.
The easiest and officially supported one is taking advantage of the built-in
[Squirrel](https://github.com/Squirrel) framework and
Electron's [autoUpdater](../api/auto-updater.md) module.
## Using `update.electronjs.org`
## Using update.electronjs.org
The Electron team maintains [update.electronjs.org], a free and open-source
webservice that Electron apps can use to self-update. The service is designed
@@ -13,72 +18,77 @@ for Electron apps that meet the following criteria:
- App runs on macOS or Windows
- App has a public GitHub repository
- Builds are published to GitHub Releases
- Builds are code-signed
- Builds are published to [GitHub Releases][gh-releases]
- Builds are [code-signed](./code-signing.md)
The easiest way to use this service is by installing [update-electron-app],
a Node.js module preconfigured for use with update.electronjs.org.
Install the module:
Install the module using your Node.js package manager of choice:
```sh
```sh npm2yarn
npm install update-electron-app
```
Invoke the updater from your app's main process file:
Then, invoke the updater from your app's main process file:
```js
```js title="main.js"
require('update-electron-app')()
```
By default, this module will check for updates at app startup, then every ten
minutes. When an update is found, it will automatically be downloaded in the background. When the download completes, a dialog is displayed allowing the user
to restart the app.
minutes. When an update is found, it will automatically be downloaded in the background.
When the download completes, a dialog is displayed allowing the user to restart the app.
If you need to customize your configuration, you can
[pass options to `update-electron-app`][update-electron-app]
[pass options to update-electron-app][update-electron-app]
or
[use the update service directly][update.electronjs.org].
## Deploying an Update Server
## Using other update services
If you're developing a private Electron application, or if you're not
publishing releases to GitHub Releases, it may be necessary to run your own
update server.
### Step 1: Deploying an update server
Depending on your needs, you can choose from one of these:
- [Hazel][hazel] Update server for private or open-source apps which can be
deployed for free on [Vercel][vercel]. It pulls from [GitHub Releases][gh-releases]
and leverages the power of GitHub's CDN.
deployed for free on [Vercel][vercel]. It pulls from [GitHub Releases][gh-releases]
and leverages the power of GitHub's CDN.
- [Nuts][nuts] Also uses [GitHub Releases][gh-releases], but caches app
updates on disk and supports private repositories.
updates on disk and supports private repositories.
- [electron-release-server][electron-release-server] Provides a dashboard for
handling releases and does not require releases to originate on GitHub.
handling releases and does not require releases to originate on GitHub.
- [Nucleus][nucleus] A complete update server for Electron apps maintained by
Atlassian. Supports multiple applications and channels; uses a static file store
to minify server cost.
Atlassian. Supports multiple applications and channels; uses a static file store
to minify server cost.
## Implementing Updates in Your App
Once you've deployed your update server, you can instrument your app code to receive and
apply the updates with Electron's [autoUpdater] module.
Once you've deployed your update server, continue with importing the required
modules in your code. The following code might vary for different server
software, but it works like described when using
[Hazel][hazel].
### Step 2: Receiving updates in your app
**Important:** Please ensure that the code below will only be executed in
your packaged app, and not in development. You can use
[electron-is-dev](https://github.com/sindresorhus/electron-is-dev) to check for
the environment.
First, import the required modules in your main process code. The following code might
vary for different server software, but it works like described when using [Hazel][hazel].
```javascript
:::warning Check your execution environment!
Please ensure that the code below will only be executed in your packaged app, and not in development.
You can use the [app.isPackaged](../api/app.md#appispackaged-readonly) API to check the environment.
:::
```javascript title='main.js'
const { app, autoUpdater, dialog } = require('electron')
```
Next, construct the URL of the update server and tell
Next, construct the URL of the update server feed and tell
[autoUpdater](../api/auto-updater.md) about it:
```javascript
```javascript title='main.js'
const server = 'https://your-deployment-url.com'
const url = `${server}/update/${process.platform}/${app.getVersion()}`
@@ -87,32 +97,32 @@ autoUpdater.setFeedURL({ url })
As the final step, check for updates. The example below will check every minute:
```javascript
```javascript title='main.js'
setInterval(() => {
autoUpdater.checkForUpdates()
}, 60000)
```
Once your application is [packaged](../tutorial/application-distribution.md),
Once your application is [packaged](./application-distribution.md),
it will receive an update for each new
[GitHub Release](https://help.github.com/articles/creating-releases/) that you
publish.
## Applying Updates
### Step 3: Notifying users when updates are available
Now that you've configured the basic update mechanism for your application, you
need to ensure that the user will get notified when there's an update. This
can be achieved using the autoUpdater API
[events](../api/auto-updater.md#events):
can be achieved using the [autoUpdater API events](../api/auto-updater.md#events):
```javascript
```javascript title="main.js"
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
const dialogOpts = {
type: 'info',
buttons: ['Restart', 'Later'],
title: 'Application Update',
message: process.platform === 'win32' ? releaseNotes : releaseName,
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
detail:
'A new version has been downloaded. Restart the application to apply the updates.',
}
dialog.showMessageBox(dialogOpts).then((returnValue) => {
@@ -125,16 +135,22 @@ Also make sure that errors are
[being handled](../api/auto-updater.md#event-error). Here's an example
for logging them to `stderr`:
```javascript
autoUpdater.on('error', message => {
```javascript title="main.js"
autoUpdater.on('error', (message) => {
console.error('There was a problem updating the application')
console.error(message)
})
```
## Handling Updates Manually
:::info Handling updates manually
Because the requests made by Auto Update aren't under your direct control, you may find situations that are difficult to handle (such as if the update server is behind authentication). The `url` field does support files, which means that with some effort, you can sidestep the server-communication aspect of the process. [Here's an example of how this could work](https://github.com/electron/electron/issues/5020#issuecomment-477636990).
Because the requests made by autoUpdate aren't under your direct control, you may find situations
that are difficult to handle (such as if the update server is behind authentication). The `url`
field supports the `file://` protocol, which means that with some effort, you can sidestep the
server-communication aspect of the process by loading your update from a local directory.
[Here's an example of how this could work](https://github.com/electron/electron/issues/5020#issuecomment-477636990).
:::
[vercel]: https://vercel.com
[hazel]: https://github.com/vercel/hazel

View File

@@ -41,10 +41,9 @@ as quoted from [MSDN][msdn-jumplist]:
> confuse the user who does not expect that portion of the destination list to
> change.
![IE](https://i-msdn.sec.s-msft.com/dynimg/IC420539.png)
![Taskbar JumpList](../images/windows-taskbar-jumplist.png)
> NOTE: The screenshot above is an example of general tasks of
Internet Explorer
> NOTE: The screenshot above is an example of general tasks for Microsoft Edge
Unlike the dock menu in macOS which is a real menu, user tasks in Windows work
like application shortcuts. For example, when a user clicks a task, the program
@@ -109,7 +108,7 @@ As quoted from [MSDN][msdn-thumbnail]:
> For example, Windows Media Player might offer standard media transport controls
> such as play, pause, mute, and stop.
![player](https://i-msdn.sec.s-msft.com/dynimg/IC420540.png)
![Thumbnail toolbar](../images/windows-taskbar-thumbnail-toolbar.png)
> NOTE: The screenshot above is an example of thumbnail toolbar of Windows
Media Player
@@ -176,7 +175,7 @@ As quoted from [MSDN][msdn-icon-overlay]:
> network status, messenger status, or new mail. The user should not be
> presented with constantly changing overlays or animations.
![Overlay on taskbar button](https://i-msdn.sec.s-msft.com/dynimg/IC420441.png)
![Overlay on taskbar button](../images/windows-taskbar-icon-overlay.png)
> NOTE: The screenshot above is an example of overlay on a taskbar button

View File

@@ -19,14 +19,12 @@ template("electron_repack_percent") {
# All sources should also have deps for completeness.
sources = [
"$root_gen_dir/components/components_resources_${percent}_percent.pak",
"$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
"$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
]
deps = [
"//components/resources",
"//content/app/resources",
"//third_party/blink/public:scaled_resources_${percent}_percent",
"//ui/resources",
]

View File

@@ -23,6 +23,7 @@ filenames = {
lib_sources_linux = [
"shell/browser/browser_linux.cc",
"shell/browser/electron_browser_main_parts_linux.cc",
"shell/browser/lib/power_observer_linux.cc",
"shell/browser/lib/power_observer_linux.h",
"shell/browser/linux/unity_service.cc",
@@ -85,6 +86,8 @@ filenames = {
"shell/browser/ui/message_box_win.cc",
"shell/browser/ui/tray_icon_win.cc",
"shell/browser/ui/views/electron_views_delegate_win.cc",
"shell/browser/ui/views/win_icon_painter.cc",
"shell/browser/ui/views/win_icon_painter.h",
"shell/browser/ui/views/win_frame_view.cc",
"shell/browser/ui/views/win_frame_view.h",
"shell/browser/ui/views/win_caption_button.cc",
@@ -105,6 +108,8 @@ filenames = {
"shell/browser/ui/win/notify_icon.h",
"shell/browser/ui/win/taskbar_host.cc",
"shell/browser/ui/win/taskbar_host.h",
"shell/browser/win/dark_mode.cc",
"shell/browser/win/dark_mode.h",
"shell/browser/win/scoped_hstring.cc",
"shell/browser/win/scoped_hstring.h",
"shell/common/api/electron_api_native_image_win.cc",
@@ -165,6 +170,8 @@ filenames = {
"shell/browser/ui/cocoa/electron_native_widget_mac.mm",
"shell/browser/ui/cocoa/electron_ns_window_delegate.h",
"shell/browser/ui/cocoa/electron_ns_window_delegate.mm",
"shell/browser/ui/cocoa/electron_ns_panel.h",
"shell/browser/ui/cocoa/electron_ns_panel.mm",
"shell/browser/ui/cocoa/electron_ns_window.h",
"shell/browser/ui/cocoa/electron_ns_window.mm",
"shell/browser/ui/cocoa/electron_preview_item.h",

View File

@@ -1,49 +1,376 @@
libcxx_headers = [
"//buildtools/third_party/libc++/trunk/include/CMakeLists.txt",
"//buildtools/third_party/libc++/trunk/include/__algorithm/adjacent_find.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/all_of.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/any_of.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/binary_search.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/clamp.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/comp.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/comp_ref_type.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/copy.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/copy_backward.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/copy_if.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/copy_n.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/count.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/count_if.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/equal.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/equal_range.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/fill.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/fill_n.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/find.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/find_end.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/find_first_of.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/find_if.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/find_if_not.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/for_each.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/for_each_n.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/generate.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/generate_n.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/half_positive.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/in_found_result.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/in_fun_result.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/in_in_out_result.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/in_in_result.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/in_out_out_result.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/in_out_result.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/includes.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/inplace_merge.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/is_heap.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/is_heap_until.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/is_partitioned.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/is_permutation.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/is_sorted.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/is_sorted_until.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/iter_swap.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/lexicographical_compare.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/lower_bound.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/make_heap.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/max.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/max_element.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/merge.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/min.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/min_element.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/min_max_result.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/minmax.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/minmax_element.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/mismatch.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/move.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/move_backward.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/next_permutation.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/none_of.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/nth_element.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/partial_sort.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/partial_sort_copy.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/partition.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/partition_copy.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/partition_point.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/pop_heap.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/prev_permutation.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/push_heap.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/ranges_find.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/ranges_find_if.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/ranges_find_if_not.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/ranges_max_element.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/ranges_min.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/ranges_min_element.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/ranges_mismatch.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/ranges_swap_ranges.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/remove.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/remove_copy.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/remove_copy_if.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/remove_if.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/replace.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/replace_copy.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/replace_copy_if.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/replace_if.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/reverse.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/reverse_copy.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/rotate.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/rotate_copy.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/sample.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/search.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/search_n.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/set_difference.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/set_intersection.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/set_symmetric_difference.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/set_union.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/shift_left.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/shift_right.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/shuffle.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/sift_down.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/sort.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/sort_heap.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/stable_partition.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/stable_sort.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/swap_ranges.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/transform.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/unique.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/unique_copy.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/unwrap_iter.h",
"//buildtools/third_party/libc++/trunk/include/__algorithm/upper_bound.h",
"//buildtools/third_party/libc++/trunk/include/__assert",
"//buildtools/third_party/libc++/trunk/include/__availability",
"//buildtools/third_party/libc++/trunk/include/__bit/bit_cast.h",
"//buildtools/third_party/libc++/trunk/include/__bit/byteswap.h",
"//buildtools/third_party/libc++/trunk/include/__bit_reference",
"//buildtools/third_party/libc++/trunk/include/__bits",
"//buildtools/third_party/libc++/trunk/include/__bsd_locale_defaults.h",
"//buildtools/third_party/libc++/trunk/include/__bsd_locale_fallbacks.h",
"//buildtools/third_party/libc++/trunk/include/__charconv/chars_format.h",
"//buildtools/third_party/libc++/trunk/include/__charconv/from_chars_result.h",
"//buildtools/third_party/libc++/trunk/include/__charconv/to_chars_result.h",
"//buildtools/third_party/libc++/trunk/include/__chrono/calendar.h",
"//buildtools/third_party/libc++/trunk/include/__chrono/convert_to_timespec.h",
"//buildtools/third_party/libc++/trunk/include/__chrono/duration.h",
"//buildtools/third_party/libc++/trunk/include/__chrono/file_clock.h",
"//buildtools/third_party/libc++/trunk/include/__chrono/high_resolution_clock.h",
"//buildtools/third_party/libc++/trunk/include/__chrono/steady_clock.h",
"//buildtools/third_party/libc++/trunk/include/__chrono/system_clock.h",
"//buildtools/third_party/libc++/trunk/include/__chrono/time_point.h",
"//buildtools/third_party/libc++/trunk/include/__compare/common_comparison_category.h",
"//buildtools/third_party/libc++/trunk/include/__compare/compare_partial_order_fallback.h",
"//buildtools/third_party/libc++/trunk/include/__compare/compare_strong_order_fallback.h",
"//buildtools/third_party/libc++/trunk/include/__compare/compare_three_way.h",
"//buildtools/third_party/libc++/trunk/include/__compare/compare_three_way_result.h",
"//buildtools/third_party/libc++/trunk/include/__compare/compare_weak_order_fallback.h",
"//buildtools/third_party/libc++/trunk/include/__compare/is_eq.h",
"//buildtools/third_party/libc++/trunk/include/__compare/ordering.h",
"//buildtools/third_party/libc++/trunk/include/__compare/partial_order.h",
"//buildtools/third_party/libc++/trunk/include/__compare/strong_order.h",
"//buildtools/third_party/libc++/trunk/include/__compare/synth_three_way.h",
"//buildtools/third_party/libc++/trunk/include/__compare/three_way_comparable.h",
"//buildtools/third_party/libc++/trunk/include/__compare/weak_order.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/arithmetic.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/assignable.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/boolean_testable.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/class_or_enum.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/common_reference_with.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/common_with.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/constructible.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/convertible_to.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/copyable.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/derived_from.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/destructible.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/different_from.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/equality_comparable.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/invocable.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/movable.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/predicate.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/regular.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/relation.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/same_as.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/semiregular.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/swappable.h",
"//buildtools/third_party/libc++/trunk/include/__concepts/totally_ordered.h",
"//buildtools/third_party/libc++/trunk/include/__config",
"//buildtools/third_party/libc++/trunk/include/__config_site.in",
"//buildtools/third_party/libc++/trunk/include/__coroutine/coroutine_handle.h",
"//buildtools/third_party/libc++/trunk/include/__coroutine/coroutine_traits.h",
"//buildtools/third_party/libc++/trunk/include/__coroutine/noop_coroutine_handle.h",
"//buildtools/third_party/libc++/trunk/include/__coroutine/trivial_awaitables.h",
"//buildtools/third_party/libc++/trunk/include/__debug",
"//buildtools/third_party/libc++/trunk/include/__errc",
"//buildtools/third_party/libc++/trunk/include/__functional_03",
"//buildtools/third_party/libc++/trunk/include/__functional_base",
"//buildtools/third_party/libc++/trunk/include/__functional_base_03",
"//buildtools/third_party/libc++/trunk/include/__filesystem/copy_options.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/directory_entry.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/directory_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/directory_options.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/file_status.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/file_time_type.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/file_type.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/filesystem_error.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/operations.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/path.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/path_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/perm_options.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/perms.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/recursive_directory_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/space_info.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/u8path.h",
"//buildtools/third_party/libc++/trunk/include/__format/format_arg.h",
"//buildtools/third_party/libc++/trunk/include/__format/format_args.h",
"//buildtools/third_party/libc++/trunk/include/__format/format_context.h",
"//buildtools/third_party/libc++/trunk/include/__format/format_error.h",
"//buildtools/third_party/libc++/trunk/include/__format/format_fwd.h",
"//buildtools/third_party/libc++/trunk/include/__format/format_parse_context.h",
"//buildtools/third_party/libc++/trunk/include/__format/format_string.h",
"//buildtools/third_party/libc++/trunk/include/__format/format_to_n_result.h",
"//buildtools/third_party/libc++/trunk/include/__format/formatter.h",
"//buildtools/third_party/libc++/trunk/include/__format/formatter_bool.h",
"//buildtools/third_party/libc++/trunk/include/__format/formatter_char.h",
"//buildtools/third_party/libc++/trunk/include/__format/formatter_floating_point.h",
"//buildtools/third_party/libc++/trunk/include/__format/formatter_integer.h",
"//buildtools/third_party/libc++/trunk/include/__format/formatter_integral.h",
"//buildtools/third_party/libc++/trunk/include/__format/formatter_pointer.h",
"//buildtools/third_party/libc++/trunk/include/__format/formatter_string.h",
"//buildtools/third_party/libc++/trunk/include/__format/parser_std_format_spec.h",
"//buildtools/third_party/libc++/trunk/include/__functional/binary_function.h",
"//buildtools/third_party/libc++/trunk/include/__functional/binary_negate.h",
"//buildtools/third_party/libc++/trunk/include/__functional/bind.h",
"//buildtools/third_party/libc++/trunk/include/__functional/bind_back.h",
"//buildtools/third_party/libc++/trunk/include/__functional/bind_front.h",
"//buildtools/third_party/libc++/trunk/include/__functional/binder1st.h",
"//buildtools/third_party/libc++/trunk/include/__functional/binder2nd.h",
"//buildtools/third_party/libc++/trunk/include/__functional/compose.h",
"//buildtools/third_party/libc++/trunk/include/__functional/default_searcher.h",
"//buildtools/third_party/libc++/trunk/include/__functional/function.h",
"//buildtools/third_party/libc++/trunk/include/__functional/hash.h",
"//buildtools/third_party/libc++/trunk/include/__functional/identity.h",
"//buildtools/third_party/libc++/trunk/include/__functional/invoke.h",
"//buildtools/third_party/libc++/trunk/include/__functional/is_transparent.h",
"//buildtools/third_party/libc++/trunk/include/__functional/mem_fn.h",
"//buildtools/third_party/libc++/trunk/include/__functional/mem_fun_ref.h",
"//buildtools/third_party/libc++/trunk/include/__functional/not_fn.h",
"//buildtools/third_party/libc++/trunk/include/__functional/operations.h",
"//buildtools/third_party/libc++/trunk/include/__functional/perfect_forward.h",
"//buildtools/third_party/libc++/trunk/include/__functional/pointer_to_binary_function.h",
"//buildtools/third_party/libc++/trunk/include/__functional/pointer_to_unary_function.h",
"//buildtools/third_party/libc++/trunk/include/__functional/ranges_operations.h",
"//buildtools/third_party/libc++/trunk/include/__functional/reference_wrapper.h",
"//buildtools/third_party/libc++/trunk/include/__functional/unary_function.h",
"//buildtools/third_party/libc++/trunk/include/__functional/unary_negate.h",
"//buildtools/third_party/libc++/trunk/include/__functional/unwrap_ref.h",
"//buildtools/third_party/libc++/trunk/include/__functional/weak_result_type.h",
"//buildtools/third_party/libc++/trunk/include/__hash_table",
"//buildtools/third_party/libc++/trunk/include/__ios/fpos.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/access.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/advance.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/back_insert_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/common_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/concepts.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/counted_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/data.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/default_sentinel.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/distance.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/empty.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/erase_if_container.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/front_insert_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/incrementable_traits.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/indirectly_comparable.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/insert_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/istream_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/istreambuf_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/iter_move.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/iter_swap.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/iterator_traits.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/mergeable.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/move_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/next.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/ostream_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/ostreambuf_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/permutable.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/prev.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/projected.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/readable_traits.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/reverse_access.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/reverse_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/size.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/sortable.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/unreachable_sentinel.h",
"//buildtools/third_party/libc++/trunk/include/__iterator/wrap_iter.h",
"//buildtools/third_party/libc++/trunk/include/__libcpp_version",
"//buildtools/third_party/libc++/trunk/include/__locale",
"//buildtools/third_party/libc++/trunk/include/__mbstate_t.h",
"//buildtools/third_party/libc++/trunk/include/__memory/addressof.h",
"//buildtools/third_party/libc++/trunk/include/__memory/allocation_guard.h",
"//buildtools/third_party/libc++/trunk/include/__memory/allocator.h",
"//buildtools/third_party/libc++/trunk/include/__memory/allocator_arg_t.h",
"//buildtools/third_party/libc++/trunk/include/__memory/allocator_traits.h",
"//buildtools/third_party/libc++/trunk/include/__memory/auto_ptr.h",
"//buildtools/third_party/libc++/trunk/include/__memory/compressed_pair.h",
"//buildtools/third_party/libc++/trunk/include/__memory/concepts.h",
"//buildtools/third_party/libc++/trunk/include/__memory/construct_at.h",
"//buildtools/third_party/libc++/trunk/include/__memory/pointer_safety.h",
"//buildtools/third_party/libc++/trunk/include/__memory/pointer_traits.h",
"//buildtools/third_party/libc++/trunk/include/__memory/ranges_construct_at.h",
"//buildtools/third_party/libc++/trunk/include/__memory/ranges_uninitialized_algorithms.h",
"//buildtools/third_party/libc++/trunk/include/__memory/raw_storage_iterator.h",
"//buildtools/third_party/libc++/trunk/include/__memory/shared_ptr.h",
"//buildtools/third_party/libc++/trunk/include/__memory/temporary_buffer.h",
"//buildtools/third_party/libc++/trunk/include/__memory/uninitialized_algorithms.h",
"//buildtools/third_party/libc++/trunk/include/__memory/unique_ptr.h",
"//buildtools/third_party/libc++/trunk/include/__memory/uses_allocator.h",
"//buildtools/third_party/libc++/trunk/include/__memory/voidify.h",
"//buildtools/third_party/libc++/trunk/include/__mutex_base",
"//buildtools/third_party/libc++/trunk/include/__node_handle",
"//buildtools/third_party/libc++/trunk/include/__nullptr",
"//buildtools/third_party/libc++/trunk/include/__numeric/accumulate.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/adjacent_difference.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/exclusive_scan.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/gcd_lcm.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/inclusive_scan.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/inner_product.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/iota.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/midpoint.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/partial_sum.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/reduce.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/transform_exclusive_scan.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/transform_inclusive_scan.h",
"//buildtools/third_party/libc++/trunk/include/__numeric/transform_reduce.h",
"//buildtools/third_party/libc++/trunk/include/__random/bernoulli_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/binomial_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/cauchy_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/chi_squared_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/clamp_to_integral.h",
"//buildtools/third_party/libc++/trunk/include/__random/default_random_engine.h",
"//buildtools/third_party/libc++/trunk/include/__random/discard_block_engine.h",
"//buildtools/third_party/libc++/trunk/include/__random/discrete_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/exponential_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/extreme_value_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/fisher_f_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/gamma_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/generate_canonical.h",
"//buildtools/third_party/libc++/trunk/include/__random/geometric_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/independent_bits_engine.h",
"//buildtools/third_party/libc++/trunk/include/__random/is_seed_sequence.h",
"//buildtools/third_party/libc++/trunk/include/__random/is_valid.h",
"//buildtools/third_party/libc++/trunk/include/__random/knuth_b.h",
"//buildtools/third_party/libc++/trunk/include/__random/linear_congruential_engine.h",
"//buildtools/third_party/libc++/trunk/include/__random/log2.h",
"//buildtools/third_party/libc++/trunk/include/__random/lognormal_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/mersenne_twister_engine.h",
"//buildtools/third_party/libc++/trunk/include/__random/negative_binomial_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/normal_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/piecewise_constant_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/piecewise_linear_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/poisson_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/random_device.h",
"//buildtools/third_party/libc++/trunk/include/__random/ranlux.h",
"//buildtools/third_party/libc++/trunk/include/__random/seed_seq.h",
"//buildtools/third_party/libc++/trunk/include/__random/shuffle_order_engine.h",
"//buildtools/third_party/libc++/trunk/include/__random/student_t_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/subtract_with_carry_engine.h",
"//buildtools/third_party/libc++/trunk/include/__random/uniform_int_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/uniform_random_bit_generator.h",
"//buildtools/third_party/libc++/trunk/include/__random/uniform_real_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__random/weibull_distribution.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/access.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/all.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/common_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/concepts.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/copyable_box.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/counted.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/dangling.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/data.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/drop_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/empty.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/empty_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/enable_borrowed_range.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/enable_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/iota_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/join_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/non_propagating_cache.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/owning_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/range_adaptor.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/rbegin.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/ref_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/rend.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/reverse_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/single_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/size.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/subrange.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/take_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/transform_view.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/view_interface.h",
"//buildtools/third_party/libc++/trunk/include/__ranges/views.h",
"//buildtools/third_party/libc++/trunk/include/__split_buffer",
"//buildtools/third_party/libc++/trunk/include/__std_stream",
"//buildtools/third_party/libc++/trunk/include/__string",
@@ -51,14 +378,12 @@ libcxx_headers = [
"//buildtools/third_party/libc++/trunk/include/__support/fuchsia/xlocale.h",
"//buildtools/third_party/libc++/trunk/include/__support/ibm/gettod_zos.h",
"//buildtools/third_party/libc++/trunk/include/__support/ibm/limits.h",
"//buildtools/third_party/libc++/trunk/include/__support/ibm/locale_mgmt_aix.h",
"//buildtools/third_party/libc++/trunk/include/__support/ibm/locale_mgmt_zos.h",
"//buildtools/third_party/libc++/trunk/include/__support/ibm/nanosleep.h",
"//buildtools/third_party/libc++/trunk/include/__support/ibm/support.h",
"//buildtools/third_party/libc++/trunk/include/__support/ibm/xlocale.h",
"//buildtools/third_party/libc++/trunk/include/__support/musl/xlocale.h",
"//buildtools/third_party/libc++/trunk/include/__support/newlib/xlocale.h",
"//buildtools/third_party/libc++/trunk/include/__support/nuttx/xlocale.h",
"//buildtools/third_party/libc++/trunk/include/__support/openbsd/xlocale.h",
"//buildtools/third_party/libc++/trunk/include/__support/solaris/floatingpoint.h",
"//buildtools/third_party/libc++/trunk/include/__support/solaris/wchar.h",
@@ -68,11 +393,30 @@ libcxx_headers = [
"//buildtools/third_party/libc++/trunk/include/__support/xlocale/__nop_locale_mgmt.h",
"//buildtools/third_party/libc++/trunk/include/__support/xlocale/__posix_l_fallback.h",
"//buildtools/third_party/libc++/trunk/include/__support/xlocale/__strtonum_fallback.h",
"//buildtools/third_party/libc++/trunk/include/__thread/poll_with_backoff.h",
"//buildtools/third_party/libc++/trunk/include/__thread/timed_backoff_policy.h",
"//buildtools/third_party/libc++/trunk/include/__threading_support",
"//buildtools/third_party/libc++/trunk/include/__tree",
"//buildtools/third_party/libc++/trunk/include/__tuple",
"//buildtools/third_party/libc++/trunk/include/__undef_macros",
"//buildtools/third_party/libc++/trunk/include/__utility/as_const.h",
"//buildtools/third_party/libc++/trunk/include/__utility/auto_cast.h",
"//buildtools/third_party/libc++/trunk/include/__utility/cmp.h",
"//buildtools/third_party/libc++/trunk/include/__utility/declval.h",
"//buildtools/third_party/libc++/trunk/include/__utility/exchange.h",
"//buildtools/third_party/libc++/trunk/include/__utility/forward.h",
"//buildtools/third_party/libc++/trunk/include/__utility/in_place.h",
"//buildtools/third_party/libc++/trunk/include/__utility/integer_sequence.h",
"//buildtools/third_party/libc++/trunk/include/__utility/move.h",
"//buildtools/third_party/libc++/trunk/include/__utility/pair.h",
"//buildtools/third_party/libc++/trunk/include/__utility/piecewise_construct.h",
"//buildtools/third_party/libc++/trunk/include/__utility/priority_tag.h",
"//buildtools/third_party/libc++/trunk/include/__utility/rel_ops.h",
"//buildtools/third_party/libc++/trunk/include/__utility/swap.h",
"//buildtools/third_party/libc++/trunk/include/__utility/to_underlying.h",
"//buildtools/third_party/libc++/trunk/include/__utility/transaction.h",
"//buildtools/third_party/libc++/trunk/include/__utility/unreachable.h",
"//buildtools/third_party/libc++/trunk/include/__variant/monostate.h",
"//buildtools/third_party/libc++/trunk/include/algorithm",
"//buildtools/third_party/libc++/trunk/include/any",
"//buildtools/third_party/libc++/trunk/include/array",
@@ -99,6 +443,7 @@ libcxx_headers = [
"//buildtools/third_party/libc++/trunk/include/complex.h",
"//buildtools/third_party/libc++/trunk/include/concepts",
"//buildtools/third_party/libc++/trunk/include/condition_variable",
"//buildtools/third_party/libc++/trunk/include/coroutine",
"//buildtools/third_party/libc++/trunk/include/csetjmp",
"//buildtools/third_party/libc++/trunk/include/csignal",
"//buildtools/third_party/libc++/trunk/include/cstdarg",
@@ -111,6 +456,7 @@ libcxx_headers = [
"//buildtools/third_party/libc++/trunk/include/ctgmath",
"//buildtools/third_party/libc++/trunk/include/ctime",
"//buildtools/third_party/libc++/trunk/include/ctype.h",
"//buildtools/third_party/libc++/trunk/include/cuchar",
"//buildtools/third_party/libc++/trunk/include/cwchar",
"//buildtools/third_party/libc++/trunk/include/cwctype",
"//buildtools/third_party/libc++/trunk/include/deque",
@@ -122,7 +468,6 @@ libcxx_headers = [
"//buildtools/third_party/libc++/trunk/include/experimental/algorithm",
"//buildtools/third_party/libc++/trunk/include/experimental/coroutine",
"//buildtools/third_party/libc++/trunk/include/experimental/deque",
"//buildtools/third_party/libc++/trunk/include/experimental/filesystem",
"//buildtools/third_party/libc++/trunk/include/experimental/forward_list",
"//buildtools/third_party/libc++/trunk/include/experimental/functional",
"//buildtools/third_party/libc++/trunk/include/experimental/iterator",
@@ -205,6 +550,7 @@ libcxx_headers = [
"//buildtools/third_party/libc++/trunk/include/type_traits",
"//buildtools/third_party/libc++/trunk/include/typeindex",
"//buildtools/third_party/libc++/trunk/include/typeinfo",
"//buildtools/third_party/libc++/trunk/include/uchar.h",
"//buildtools/third_party/libc++/trunk/include/unordered_map",
"//buildtools/third_party/libc++/trunk/include/unordered_set",
"//buildtools/third_party/libc++/trunk/include/utility",

View File

@@ -18,4 +18,4 @@
}
]
}
}
}

View File

@@ -72,9 +72,8 @@ BrowserWindow.getAllWindows = () => {
BrowserWindow.getFocusedWindow = () => {
for (const window of BrowserWindow.getAllWindows()) {
const hasWC = window.webContents && !window.webContents.isDestroyed();
if (!window.isDestroyed() && hasWC) {
if (window.isFocused() || window.isDevToolsFocused()) return window;
if (!window.isDestroyed() && window.webContents && !window.webContents.isDestroyed()) {
if (window.isFocused() || window.webContents.isDevToolsFocused()) return window;
}
}
return null;

View File

@@ -1,3 +1,3 @@
const { nativeTheme } = process._linkedBinding('electron_common_native_theme');
const { nativeTheme } = process._linkedBinding('electron_browser_native_theme');
module.exports = nativeTheme;

View File

@@ -1,7 +1,7 @@
const {
Notification: ElectronNotification,
isSupported
} = process._linkedBinding('electron_common_notification');
} = process._linkedBinding('electron_browser_notification');
ElectronNotification.isSupported = isSupported;

View File

@@ -1,6 +1,6 @@
import { EventEmitter } from 'events';
const { createScreen } = process._linkedBinding('electron_common_screen');
const { createScreen } = process._linkedBinding('electron_browser_screen');
let _screen: Electron.Screen;

View File

@@ -475,12 +475,14 @@ WebContents.prototype.loadURL = function (url, options) {
const removeListeners = () => {
this.removeListener('did-finish-load', finishListener);
this.removeListener('did-fail-load', failListener);
this.removeListener('did-navigate-in-page', finishListener);
this.removeListener('did-start-navigation', navigationListener);
this.removeListener('did-stop-loading', stopLoadingListener);
this.removeListener('destroyed', stopLoadingListener);
};
this.on('did-finish-load', finishListener);
this.on('did-fail-load', failListener);
this.on('did-navigate-in-page', finishListener);
this.on('did-start-navigation', navigationListener);
this.on('did-stop-loading', stopLoadingListener);
this.on('destroyed', stopLoadingListener);
@@ -504,6 +506,7 @@ WebContents.prototype._callWindowOpenHandler = function (event: Electron.Event,
if (!this._windowOpenHandler) {
return defaultResponse;
}
const response = this._windowOpenHandler(details);
if (typeof response !== 'object') {
@@ -666,7 +669,15 @@ WebContents.prototype._init = function () {
postBody,
disposition
};
const result = this._callWindowOpenHandler(event, details);
let result: ReturnType<typeof this._callWindowOpenHandler>;
try {
result = this._callWindowOpenHandler(event, details);
} catch (err) {
event.preventDefault();
throw err;
}
const options = result.browserWindowConstructorOptions;
if (!event.defaultPrevented) {
openGuestWindow({
@@ -697,7 +708,15 @@ WebContents.prototype._init = function () {
referrer,
postBody
};
const result = this._callWindowOpenHandler(event, details);
let result: ReturnType<typeof this._callWindowOpenHandler>;
try {
result = this._callWindowOpenHandler(event, details);
} catch (err) {
event.preventDefault();
throw err;
}
windowOpenOutlivesOpenerOption = result.outlivesOpener;
windowOpenOverriddenOptions = result.browserWindowConstructorOptions;
if (!event.defaultPrevented) {

View File

@@ -7,7 +7,7 @@ import { webViewEvents } from '@electron/internal/browser/web-view-events';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
interface GuestInstance {
elementInstanceId?: number;
elementInstanceId: number;
visibilityState?: VisibilityState;
embedder: Electron.WebContents;
guest: Electron.WebContents;
@@ -46,6 +46,7 @@ function makeWebPreferences (embedder: Electron.WebContents, params: Record<stri
webSecurity: !params.disablewebsecurity,
enableBlinkFeatures: params.blinkfeatures,
disableBlinkFeatures: params.disableblinkfeatures,
partition: params.partition,
...parsedWebPreferences
};
@@ -87,14 +88,26 @@ function makeLoadURLOptions (params: Record<string, any>) {
// Create a new guest instance.
const createGuest = function (embedder: Electron.WebContents, embedderFrameId: number, elementInstanceId: number, params: Record<string, any>) {
const webPreferences = makeWebPreferences(embedder, params);
const event = eventBinding.createWithSender(embedder);
const { instanceId } = params;
embedder.emit('will-attach-webview', event, webPreferences, params);
if (event.defaultPrevented) {
return -1;
}
// eslint-disable-next-line no-undef
const guest = (webContents as typeof ElectronInternal.WebContents).create({
...webPreferences,
type: 'webview',
partition: params.partition,
embedder
});
const guestInstanceId = guest.id;
guestInstances.set(guestInstanceId, {
elementInstanceId,
guest,
embedder
});
@@ -108,11 +121,8 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
// Init guest web view after attached.
guest.once('did-attach' as any, function (this: Electron.WebContents, event: Electron.Event) {
const params = this.attachParams!;
delete this.attachParams;
const previouslyAttached = this.viewInstanceId != null;
this.viewInstanceId = params.instanceId;
this.viewInstanceId = instanceId;
// Only load URL and set size on first attach
if (previouslyAttached) {
@@ -120,7 +130,7 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
}
if (params.src) {
this.loadURL(params.src, params.opts);
this.loadURL(params.src, makeLoadURLOptions(params));
}
embedder.emit('did-attach-webview', event, guest);
});
@@ -173,78 +183,25 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
}
});
if (attachGuest(embedder, embedderFrameId, elementInstanceId, guestInstanceId, params)) {
return guestInstanceId;
}
return -1;
};
// Attach the guest to an element of embedder.
const attachGuest = function (embedder: Electron.WebContents, embedderFrameId: number, elementInstanceId: number, guestInstanceId: number, params: Record<string, any>) {
// Destroy the old guest when attaching.
const key = `${embedder.id}-${elementInstanceId}`;
const oldGuestInstanceId = embedderElementsMap.get(key);
if (oldGuestInstanceId != null) {
// Reattachment to the same guest is just a no-op.
if (oldGuestInstanceId === guestInstanceId) {
return false;
}
const oldGuestInstance = guestInstances.get(oldGuestInstanceId);
if (oldGuestInstance) {
oldGuestInstance.guest.detachFromOuterFrame();
}
}
const guestInstance = guestInstances.get(guestInstanceId);
// If this isn't a valid guest instance then do nothing.
if (!guestInstance) {
console.error(new Error(`Guest attach failed: Invalid guestInstanceId ${guestInstanceId}`));
return false;
}
const { guest } = guestInstance;
if (guest.hostWebContents !== embedder) {
console.error(new Error(`Guest attach failed: Access denied to guestInstanceId ${guestInstanceId}`));
return false;
}
const { instanceId } = params;
// If this guest is already attached to an element then remove it
if (guestInstance.elementInstanceId) {
const oldKey = `${guestInstance.embedder.id}-${guestInstance.elementInstanceId}`;
embedderElementsMap.delete(oldKey);
// Remove guest from embedder if moving across web views
if (guest.viewInstanceId !== instanceId) {
webViewManager.removeGuest(guestInstance.embedder, guestInstanceId);
guestInstance.embedder._sendInternal(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${guest.viewInstanceId}`);
}
}
const webPreferences = makeWebPreferences(embedder, params);
const event = eventBinding.createWithSender(embedder);
embedder.emit('will-attach-webview', event, webPreferences, params);
if (event.defaultPrevented) {
if (guest.viewInstanceId == null) guest.viewInstanceId = instanceId;
guest.destroy();
return false;
}
guest.attachParams = { instanceId, src: params.src, opts: makeLoadURLOptions(params) };
embedderElementsMap.set(key, guestInstanceId);
guest.setEmbedder(embedder);
guestInstance.embedder = embedder;
guestInstance.elementInstanceId = elementInstanceId;
watchEmbedder(embedder);
webViewManager.addGuest(guestInstanceId, embedder, guest, webPreferences);
guest.attachToIframe(embedder, embedderFrameId);
return true;
return guestInstanceId;
};
// Remove an guest-embedder relationship.

View File

@@ -5,7 +5,7 @@
* out-of-process (cross-origin) are created here. "Embedder" roughly means
* "parent."
*/
import { BrowserWindow } from 'electron/main';
import { BrowserWindow, deprecate } from 'electron/main';
import type { BrowserWindowConstructorOptions, Referrer, WebContents, LoadURLOptions } from 'electron/main';
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
@@ -155,6 +155,10 @@ function emitDeprecatedNewWindowEvent ({ event, embedder, guest, windowOpenArgs,
...parseContentTypeFormat(postData)
} : null;
if (embedder.listenerCount('new-window') > 0) {
deprecate.log('The new-window event is deprecated and will be removed. Please use contents.setWindowOpenHandler() instead.');
}
embedder.emit(
'new-window',
event,

View File

@@ -68,6 +68,10 @@ ipcMainUtils.handleSync(IPC_MESSAGES.BROWSER_SANDBOX_LOAD, async function (event
};
});
ipcMainUtils.handleSync(IPC_MESSAGES.BROWSER_NONSANDBOX_LOAD, function (event) {
return { preloadPaths: event.sender._getPreloadPaths() };
});
ipcMainInternal.on(IPC_MESSAGES.BROWSER_PRELOAD_ERROR, function (event, preloadPath: string, error: Error) {
event.sender.emit('preload-error', event, preloadPath, error);
});

23
lib/common/.eslintrc.json Normal file
View File

@@ -0,0 +1,23 @@
{
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
"electron",
"electron/main",
"electron/renderer"
],
"patterns": [
"./*",
"../*",
"@electron/internal/browser/*",
"@electron/internal/isolated_renderer/*",
"@electron/internal/renderer/*",
"@electron/internal/sandboxed_worker/*",
"@electron/internal/worker/*"
]
}
]
}
}

View File

@@ -1,5 +1,6 @@
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
// eslint-disable-next-line no-restricted-imports
import type * as ipcRendererUtilsModule from '@electron/internal/renderer/ipc-renderer-internal-utils';
const clipboard = process._linkedBinding('electron_common_clipboard');

View File

@@ -3,12 +3,12 @@ export const enum IPC_MESSAGES {
BROWSER_GET_LAST_WEB_PREFERENCES = 'BROWSER_GET_LAST_WEB_PREFERENCES',
BROWSER_PRELOAD_ERROR = 'BROWSER_PRELOAD_ERROR',
BROWSER_SANDBOX_LOAD = 'BROWSER_SANDBOX_LOAD',
BROWSER_NONSANDBOX_LOAD = 'BROWSER_NONSANDBOX_LOAD',
BROWSER_WINDOW_CLOSE = 'BROWSER_WINDOW_CLOSE',
BROWSER_GET_PROCESS_MEMORY_INFO = 'BROWSER_GET_PROCESS_MEMORY_INFO',
GUEST_INSTANCE_VISIBILITY_CHANGE = 'GUEST_INSTANCE_VISIBILITY_CHANGE',
GUEST_VIEW_INTERNAL_DESTROY_GUEST = 'GUEST_VIEW_INTERNAL_DESTROY_GUEST',
GUEST_VIEW_INTERNAL_DISPATCH_EVENT = 'GUEST_VIEW_INTERNAL_DISPATCH_EVENT',
GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST = 'GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST',

View File

@@ -0,0 +1,18 @@
{
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
"electron",
"electron/main"
],
"patterns": [
"./*",
"../*",
"@electron/internal/browser/*"
]
}
]
}
}

View File

@@ -0,0 +1,18 @@
{
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
"electron",
"electron/main"
],
"patterns": [
"./*",
"../*",
"@electron/internal/browser/*"
]
}
]
}
}

View File

@@ -1,4 +1,4 @@
import { ipcRenderer } from 'electron';
import { ipcRenderer } from 'electron/renderer';
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import type * as webViewInitModule from '@electron/internal/renderer/web-view/web-view-init';

View File

@@ -2,6 +2,7 @@ import * as path from 'path';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import type * as ipcRendererInternalModule from '@electron/internal/renderer/ipc-renderer-internal';
import type * as ipcRendererUtilsModule from '@electron/internal/renderer/ipc-renderer-internal-utils';
const Module = require('module');
@@ -38,6 +39,7 @@ require('../common/reset-search-paths');
require('@electron/internal/common/init');
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal') as typeof ipcRendererInternalModule;
const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils') as typeof ipcRendererUtilsModule;
process.getProcessMemoryInfo = () => {
return ipcRendererInternal.invoke<Electron.ProcessMemoryInfo>(IPC_MESSAGES.BROWSER_GET_PROCESS_MEMORY_INFO);
@@ -48,15 +50,8 @@ const { hasSwitch, getSwitchValue } = process._linkedBinding('electron_common_co
const { mainFrame } = process._linkedBinding('electron_renderer_web_frame');
const nodeIntegration = mainFrame.getWebPreference('nodeIntegration');
const preloadScript = mainFrame.getWebPreference('preload');
const preloadScripts = mainFrame.getWebPreference('preloadScripts');
const appPath = hasSwitch('app-path') ? getSwitchValue('app-path') : null;
// The webContents preload script is loaded after the session preload scripts.
if (preloadScript) {
preloadScripts.push(preloadScript);
}
// Common renderer initialization
require('@electron/internal/renderer/common-init');
@@ -127,8 +122,9 @@ if (nodeIntegration) {
}
}
const { preloadPaths } = ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_NONSANDBOX_LOAD);
// Load the preload scripts.
for (const preloadScript of preloadScripts) {
for (const preloadScript of preloadPaths) {
try {
Module._load(preloadScript);
} catch (error) {

View File

@@ -2,7 +2,7 @@ import { internalContextBridge } from '@electron/internal/renderer/api/context-b
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
import { webFrame } from 'electron/renderer';
import { IPC_MESSAGES } from '../common/ipc-messages';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
const { contextIsolationEnabled } = internalContextBridge;

View File

@@ -1,7 +1,8 @@
import { webFrame } from 'electron';
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');
let shouldLog: boolean | null = null;
const { platform, execPath, env } = process;

View File

@@ -1,4 +1,4 @@
import { webFrame, WebFrame } from 'electron';
import { webFrame, WebFrame } from 'electron/renderer';
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';

View File

@@ -6,7 +6,6 @@ const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_fr
export interface GuestViewDelegate {
dispatchEvent (eventName: string, props: Record<string, any>): void;
reset(): void;
}
const DEPRECATED_EVENTS: Record<string, string> = {
@@ -14,11 +13,6 @@ const DEPRECATED_EVENTS: Record<string, string> = {
} as const;
export function registerEvents (viewInstanceId: number, delegate: GuestViewDelegate) {
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${viewInstanceId}`, function () {
delegate.reset();
delegate.dispatchEvent('destroyed', {});
});
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`, function (event, eventName, props) {
if (DEPRECATED_EVENTS[eventName] != null) {
delegate.dispatchEvent(DEPRECATED_EVENTS[eventName], props);
@@ -29,7 +23,6 @@ export function registerEvents (viewInstanceId: number, delegate: GuestViewDeleg
}
export function deregisterEvents (viewInstanceId: number) {
ipcRendererInternal.removeAllListeners(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${viewInstanceId}`);
ipcRendererInternal.removeAllListeners(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`);
}

View File

@@ -186,7 +186,10 @@ export class SrcAttribute extends WebViewAttribute {
opts.userAgent = useragent;
}
(this.webViewImpl.webviewNode as Electron.WebviewTag).loadURL(this.getValue(), opts);
(this.webViewImpl.webviewNode as Electron.WebviewTag).loadURL(this.getValue(), opts)
.catch(err => {
console.error('Unexpected error while loading URL', err);
});
}
}

View File

@@ -55,8 +55,7 @@ const defineWebViewElement = (hooks: WebViewImplHooks) => {
}
if (!internal.elementAttached) {
hooks.guestViewInternal.registerEvents(internal.viewInstanceId, {
dispatchEvent: internal.dispatchEvent.bind(internal),
reset: internal.reset.bind(internal)
dispatchEvent: internal.dispatchEvent.bind(internal)
});
internal.elementAttached = true;
(internal.attributes.get(WEB_VIEW_CONSTANTS.ATTRIBUTE_SRC) as SrcAttribute).parse();

View File

@@ -191,7 +191,7 @@ export class WebViewImpl {
attachGuestInstance (guestInstanceId: number) {
if (guestInstanceId === -1) {
// Do nothing
this.dispatchEvent('destroyed');
return;
}

View File

@@ -0,0 +1,18 @@
{
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
"electron",
"electron/main"
],
"patterns": [
"./*",
"../*",
"@electron/internal/browser/*"
]
}
]
}
}

18
lib/worker/.eslintrc.json Normal file
View File

@@ -0,0 +1,18 @@
{
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
"electron",
"electron/main"
],
"patterns": [
"./*",
"../*",
"@electron/internal/browser/*"
]
}
]
}
}

View File

@@ -70,8 +70,30 @@ function isInstalled () {
// unzips and makes path.txt point at the correct executable
function extractFile (zipPath) {
return extract(zipPath, { dir: path.join(__dirname, 'dist') })
.then(() => fs.promises.writeFile(path.join(__dirname, 'path.txt'), platformPath));
return new Promise((resolve, reject) => {
const distPath = process.env.ELECTRON_OVERRIDE_DIST_PATH || path.join(__dirname, 'dist');
extract(zipPath, { dir: path.join(__dirname, 'dist') })
.then(() => {
// If the zip contains an "electron.d.ts" file,
// move that up
const srcTypeDefPath = path.join(distPath, 'electron.d.ts');
const targetTypeDefPath = path.join(__dirname, 'electron.d.ts');
const hasTypeDefinitions = fs.existsSync(srcTypeDefPath);
if (hasTypeDefinitions) {
try {
fs.renameSync(srcTypeDefPath, targetTypeDefPath);
} catch (err) {
reject(err);
}
}
// Write a "path.txt" file.
return fs.promises.writeFile(path.join(__dirname, 'path.txt'), platformPath);
})
.catch((err) => reject(err));
});
}
function getPlatformPath () {

View File

@@ -1,10 +1,11 @@
{
"name": "electron",
"version": "20.0.0-nightly.20220524",
"version": "0.0.0-development",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {
"@azure/storage-blob": "^12.9.0",
"@electron/asar": "^3.2.1",
"@electron/docs-parser": "^0.12.4",
"@electron/typescript-definitions": "^8.9.5",
"@octokit/auth-app": "^2.10.0",
@@ -31,7 +32,6 @@
"@types/webpack-env": "^1.16.3",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"asar": "^3.1.0",
"aws-sdk": "^2.814.0",
"check-for-leaks": "^1.2.1",
"colors": "1.4.0",
@@ -77,7 +77,7 @@
"scripts": {
"asar": "asar",
"generate-version-json": "node script/generate-version-json.js",
"lint": "node ./script/lint.js && npm run lint:clang-format && npm run lint:docs",
"lint": "node ./script/lint.js && npm run lint:docs",
"lint:js": "node ./script/lint.js --js",
"lint:clang-format": "python3 script/run-clang-format.py -r -c shell/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
"lint:clang-tidy": "ts-node ./script/run-clang-tidy.ts",
@@ -94,6 +94,7 @@
"gn-typescript-definitions": "npm run create-typescript-definitions && shx cp electron.d.ts",
"pre-flight": "pre-flight",
"gn-check": "node ./script/gn-check.js",
"gn-format": "python3 script/run-gn-format.py",
"precommit": "lint-staged",
"preinstall": "node -e 'process.exit(0)'",
"prepack": "check-for-leaks",
@@ -124,7 +125,7 @@
],
"*.{gn,gni}": [
"npm run gn-check",
"python3 script/run-gn-format.py"
"npm run gn-format"
],
"*.py": [
"node script/lint.js --py --fix --only --"
@@ -145,4 +146,4 @@
"resolutions": {
"nan": "nodejs/nan#16fa32231e2ccd89d2804b3f765319128b20c4ac"
}
}
}

1
patches/angle/.patches Normal file
View File

@@ -0,0 +1 @@
cherry-pick-b8636b57b8f2.patch

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