Compare commits

...

247 Commits

Author SHA1 Message Date
trop[bot]
debf490418 fix: crash when calling non-reentrant function in loadURL (#40160)
fix: crash when calling non-reentrant function in loadURL

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-10-10 14:40:42 +02:00
trop[bot]
d3c763fadc fix: all children showing when showing child window (#40104)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-10-09 15:16:30 -07:00
trop[bot]
5628d59bd9 fix: crashed events deprecation (#40110)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-10-06 09:55:43 -04:00
Pedro Pontes
0cff246afb chore: cherry-pick 2 changes from Release-1-M117 (#40079)
* chore: [24-x-y] cherry-pick 2 changes from Release-1-M117

* b0ad701a609a from v8
* b11e7d07a6f4 from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-10-05 13:53:05 -04:00
Samuel Attard
543f7c3fdb chore: cherry-pick 3fbd1dca6a4d from libvpx (#40025)
* chore: cherry-pick 3fbd1dca6a4d from libvpx

* build: update patches config

* chore: update patches

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-09-28 03:34:22 -07:00
Athul Iddya
e51dee4e81 fix: use generic capturer to list both screens and windows when possible (#39711)
Screensharing with PipeWire via XDG Desktop Portal requires explicit
user permission via permission dialogs. Chromium has separate tabs for
screens and windows and thus its portal implementation requests
permissions separately for each. However, the screencast portal has no
such limitation and supports both screens and windows in a single
request.

WebRTC now supports this type of capture in a new method called
called `CreateGenericCapturer`. The `desktopCapturer` implementation has
been modified to use it. Additionally, Chromium has been patched to use
same generic capturer to ensure that the source IDs remain valid for
`getUserMedia`.
2023-09-25 14:17:45 -04:00
trop[bot]
384f44d042 ci: fix linux builds of forks (#39942)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-21 10:04:03 -04:00
Samuel Attard
edb117a239 build: use afs on aks instead of circle cache (#39913)
* build: use afs on aks instead of circle cache (#39881)

* build: use afs on aks instead of circle cache

* build: do not use aks logic on linux hosts checking out for macOS

* build: fix gn-check could-be-aks

* build: sigh

* build: no ls mnt

* build: keep build alive while debugging

* build: make debuggable

---------

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

* build: also update node build

---------

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-19 15:13:32 +02:00
trop[bot]
3f864b28a0 build: fixup autoninja (#39901)
chore: set GOMA_DIR for autoninja

(cherry picked from commit 94f24bde4d)
(cherry picked from commit 90c1f6e1cb8d22d94dd01791dc4b9c3e0a7e86fc)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-18 20:36:38 -04:00
trop[bot]
97bf8c8325 build: run on circle hosts for forks (#39864)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2023-09-14 14:42:51 -04:00
Samuel Attard
4a9b36703b build: use aks backed runners for linux builds (#39837)
* build: use aks backed runners for linux builds (#39403)

* build: test aks runner

* build: stress test

* build: use super-large nodes for publish jobs

* build: try using aks for everything...

* build: shared host not great

* build: clean up

* build: apparently tests dont run in kube infra?

* build: do not change test size

* ci: fixup known hosts for linux publish (#39437)

* ci: fixup known hosts for linux publish

* build: use 2023 known hosts

* build: use rebuilt docker image

* Revert "build: use rebuilt docker image"

This reverts commit f9506a9cc0.

---------

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

---------

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-12 16:52:24 -07:00
Samuel Attard
0508e25549 chore: cherry-pick b2eab7500a18 from chromium (#39826)
* chore: cherry-pick b2eab7500a18 from chromium

* chore: update patches

---------

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-12 11:44:16 -07:00
trop[bot]
0641412e98 fix: ensure app load is limited to real asar files when appropriate (#39810)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-09-11 14:12:21 -07:00
Pedro Pontes
c574fedc84 chore: cherry-pick 3 changes from Release-3-M116 (#39757)
* chore: [24-x-y] cherry-pick 3 changes from Release-3-M116

* 74a2eb9c8cb2 from chromium
* 038530c94a06 from v8
* 26175b0903d8 from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-09-11 09:37:27 +02:00
trop[bot]
3cb87f49ad build: fix depot_tools patch application (#39752)
build: fix depot_tools patch application (cherry picked from commit 34b79c15c2)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-09-06 20:10:17 -04:00
Pedro Pontes
94586037cd chore: cherry-pick 1 changes from Release-2-M116 (#39688)
* chore: [24-x-y] cherry-pick 1 changes from Release-2-M116

* 35c06406a658 from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-08-30 10:09:28 -04:00
trop[bot]
d6cea5fc0c fix: assert module in the renderer process (#39621)
* fix: assert module in the renderer process

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

* chore: update patches after trop

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-08-28 13:13:02 -04:00
Pedro Pontes
0284dfb2a9 chore: cherry-pick 3 changes from Release-1-M116 (#39647)
* chore: [24-x-y] cherry-pick 2 changes from Release-1-M116

* 1939f7b78eda from chromium
* e4669a74888d from angle

* chore: [24-x-y] cherry-pick missing changes from Release-1-M116

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-08-28 15:19:05 +09:00
trop[bot]
2c07dab03a fix: ensure windows respect fullscreenability with different resizability values (#39643)
* fix: ensure child windows respect fullscreenability/resizability when parent is fullscreen

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

* test: add an extra resize test

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>
2023-08-28 11:05:25 +09:00
trop[bot]
b3912c65ff ci: explicitly use python3 to start goma (#39655)
ci: explicitly use python3 to start goma (#39650)

* ci: explicitly use python3 to start goma

* ci: explicitly use python3 for goma

(cherry picked from commit 83760bd5c6)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-08-25 14:59:06 +02:00
trop[bot]
0641a85498 fix: dangling raw_ptr in ElectronBrowserMainParts dtor (#39591)
* fix: dangling raw_ptr in ElectronBrowserMainParts dtor

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

* fixup! fix: dangling raw_ptr in ElectronBrowserMainParts dtor

Browser::WhenReady() holds a reference to JsEnv isolate so must come after

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-08-21 13:49:54 +02:00
trop[bot]
cec0e9c871 fix: use tiled edges to calculate frame inset sizes in Linux (#39567)
Adapt to the window frame size calculation changes in CL 3970920 by
setting the inset sizes to 0 for tiled edges.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Athul Iddya <athul@iddya.com>
2023-08-21 17:03:30 +09:00
trop[bot]
63883adbe0 fix: explorer restart does not recreated thumbnail toolbar buttons (#39585)
fix: explorer restart does not recreated thumbnail toolbar buttons.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: harada <harada@thinkridge.com>
2023-08-21 17:03:08 +09:00
Pedro Pontes
f22a5b80eb chore: cherry-pick 5 changes from Release-0-M116 (#39558)
* chore: [24-x-y] cherry-pick 3 changes from Release-0-M116

* 8ff63d378f2c from v8
* 5486190be556 from angle
* d671b099a57d from v8

* chore: update patches

* chore: cherry-pick missing changes

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-08-21 09:39:53 +09:00
trop[bot]
6e36eba667 docs: note macOS bounds Tray offset (#39553)
* docs: note macOS bounds Tray offset

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

* Update docs/api/browser-window.md

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

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>
2023-08-17 11:29:31 +02:00
trop[bot]
693c9d7484 docs: add missing webview render-process-gone event (#39544)
docs: add mising webview 'render-process-gone' event

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-08-17 10:33:04 +02:00
trop[bot]
f08d5f1e02 fix: crash when calling BrowserWindow.moveTop() on modal children (#39526)
fix: crash when calling moveTop() on modal children

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-16 14:12:08 -04:00
trop[bot]
ec4c609e4f refactor: clean up Node.js cli arg parsing (#39509)
* refactor: clean up Node.js arg parsing

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

* chore: feedback from review

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>
2023-08-16 09:45:30 +02:00
trop[bot]
89d57368d8 fix: macOS tray button selection with VoiceOver (#39447)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-14 10:35:51 +02:00
Shelley Vohr
e0b1723dd1 fix: update chrome.i18n for Manifest v3 (#39442)
* fix: update `chrome.i18n` for Manifest v3

* chore: remove i18n JSON spec (#39391)
2023-08-11 14:46:31 +02:00
trop[bot]
7698575651 feat: allow more Node.js cli flags in main process (#39372)
* feat: allow more Node.js cli flags in main process

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

* docs: update cli switch documentation

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>
2023-08-10 09:41:56 +02:00
Shelley Vohr
baf3081e1d docs: correct powerSaveBlocker.stop(id) return type (#39443) 2023-08-09 21:41:39 +02:00
trop[bot]
d49364fa53 fix: avoid package.json check on built-in modules (#39423)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-08-09 14:45:59 +02:00
trop[bot]
04af0337bc fix: removeBrowserView draggable region removal (#39407)
fix: removeBrowserView draggable region removal

Closes https://github.com/electron/electron/issues/39377.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-08 12:10:10 +02:00
trop[bot]
08dd28204b ci: fix hang when validating AppVeyor artifacts (#39399)
ci: fix hang when validating AppVeyor artifacts (#39362)

(cherry picked from commit 1eb6e45a36)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-08-07 18:12:58 -04:00
trop[bot]
09bb5eef2a test: add some environment variables for controlling tests (#39364)
chore: add some environment variables for controlling tests

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2023-08-04 08:39:13 +09:00
trop[bot]
faae88d0fe docs: clean up removed systemPreferences methods (#39350)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-08-03 15:52:13 +02:00
Keeley Hammond
3484a5606e chore: cherry-pick 4 changes from Release-0-M115 (#39267)
* chore: [24-x-y] cherry-pick 4 changes from Release-0-M115

* 90c9a89aa794 from chromium
* 933b9fad3a53 from chromium
* b03973561862 from chromium
* c60a1ab717c7 from chromium

* chore: update patches, remove redundent patches

* 4373801: Use rtc::scoped_refptr for webrtc::DataChannel objects

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

* 4564316: Remove SiteInstanceDeleting from content/public API.

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

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-02 15:09:53 +02:00
Athul Iddya
0cc1893c8c chore: cherry-pick 2 changes from webrtc (#39273) 2023-08-01 16:57:51 +02:00
trop[bot]
88604f2fb8 fix: reparenting after BrowserWindow.destroy() (#39307)
fix: reparenting after BrowserWindow.destroy()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-01 15:25:42 +02:00
trop[bot]
144a70b1d1 fix: skip artifact validation for doc-only PRs (#39303)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-07-31 13:47:48 -04:00
trop[bot]
e2d17db85b feat: add senderIsMainFrame to messages sent via ipcRenderer.sendTo() (#39207)
* feat: add `senderIsMainFrame` to messages sent via `ipcRenderer.sendTo()` (#38868)

* feat: add isMainFrame to events emitted via ipcRenderer.sendTo()

* chore: rename isMainFrame to senderIsMainFrame

Co-authored-by: Milan Burda <milan.burda@gmail.com>

* once -> emittedOnce

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-07-27 22:59:32 +02:00
trop[bot]
ae9593d0e4 fix: do not resolve electron entrypoints on disk (#39250)
* fix: do not resolve electron entrypoints on disk

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

* chore: update .patches file after trop

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-07-27 12:55:28 -07:00
trop[bot]
e239cf9ac5 fix: traffic lights not working when child windows are restored via parent window (#39243)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-07-26 14:12:20 +02:00
Milan Burda
ccca1cf5ab fix: asar integration for require('node:child_process') (#39236)
fix: asar integration for require('node:child_process') (#38742)
2023-07-26 10:13:51 +02:00
trop[bot]
348243e7e5 fix: resizable: false should disable fullscreen button at start (#39230)
fix: resizable should disable fullscreen button at start

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-07-25 20:34:02 +02:00
trop[bot]
bcffbb1c7e ci: fail appveyor build if artifacts are missing (#39217)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-07-25 12:04:43 -04:00
trop[bot]
a5fc0c139d docs: document idleDetector permissions (#39212)
doc: document idleDetector permissions

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-07-25 11:36:56 +02:00
trop[bot]
491358e18e build: fix Appveyor test workflow checkout (#39169)
* build: fix Appveyor test workflow checkout

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

* fix: +refs/pull/num/merge -> +refs/pull/num/head

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

* chore: add to appveyor-woa as well

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>
2023-07-20 13:22:37 +02:00
trop[bot]
115e4976da build: fixup Codespaces build-tools setup (#39143)
* build: fixup Codespaces build-tools setup

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

* oops evm.testing1.json -> evm.testing.json

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>
2023-07-19 10:56:32 +02:00
Shelley Vohr
be3a3d554d fix: file selection when disallowed on macOS (#39097) 2023-07-18 10:42:20 +02:00
Shelley Vohr
549221d0f1 fix: navigator.connection not working as intended (#39100)
fix: navigator.connection not working as intended
2023-07-13 19:25:25 -04:00
trop[bot]
34e961a6dd fix: BrowserWindow.moveAbove() not working for child windows (#39072)
fix: BrowserWindow.moveAbove() not working for child windows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-07-13 15:33:56 +09:00
trop[bot]
92ac9267f0 fix: use StartUpdating method for PipeWire capturer (#39050)
* fix: use StartUpdating method for PipeWire capturer

Fixed a crash related to PipeWire capturer by adapting to Chromium's
interface changes. Chromium expects a call to
`NativeDesktopMediaList::StartUpdating` with an implementation of
`DesktopMediaListObserver` for delegated capturers like PipeWire. This
interface allows listening to user permission events and listing
sources only after the user has made a choice on the permission dialog.

The interface has been implemented by an inner class to allow listening
to screen and window capture permissions concurrently using two
instances of the class. A patch that was resetting the capturer on the
first refresh has been changed to exclude PipeWire. PipeWire capturer
object will follow the lifecycle of `NativeDesktopMediaList`, as is the
case in Chromium.

Fixes #37463

Co-authored-by: Athul Iddya <athul@iddya.com>

* fix: wait for thumbnails from PipeWire when necessary

The PipeWire stream starts after the dialog is dismissed. If the sources
are listed immediately afterwards, the thumbnail may not have been
generated by that time. Explicitly wait for both thumbnail generation
and a selection on the source dialog before listing sources.

Co-authored-by: Athul Iddya <athul@iddya.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Athul Iddya <athul@iddya.com>
2023-07-11 15:17:52 +02:00
trop[bot]
6a20f61102 fix: webview crash when removing in close event (#39009)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-07-10 13:42:24 +02:00
trop[bot]
2136769836 build: disable unneeded depot_tools update on Windows CI (#39018)
build: disable unneeded depot_tools update

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-07-10 10:43:57 +02:00
trop[bot]
c998d2fb41 fix: Notification 'Show' button visible when no actions exist (#39012)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-07-07 09:58:35 +02:00
Pedro Pontes
fa768aa749 chore: cherry-pick 4 changes from Release-3-M114 (#38947)
* chore: [24-x-y] cherry-pick 4 changes from Release-3-M114

* 85beff6fd302 from chromium
* 60b93798c991 from chromium
* a1efa5343880 from v8
* d20849d07107 from webrtc

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-06-29 12:44:26 -07:00
trop[bot]
f7e22ed743 fix: child window may have opener removed (#38932)
* fix: child window may have opener removed

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

* Update chromium-spec.ts

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2023-06-27 11:34:12 -04:00
Charles Kerr
437bf7d1fd refactor: api web contents ownership (#38894)
refactor: api web contents ownership (#38695)

* refactor: aggregate api::WebContents::exclusive_access_manager_ directly

* refactor: make WebContents::devtools_file_system_indexer_ scoped_refptr const

* refactor: make WebContents::file_task_runner_ scoped_refptr const

* refactor: make WebContents::print_task_runner_ scoped_refptr const
2023-06-22 13:01:27 -05:00
trop[bot]
d0b2a4e48f refactor: prefer base::Contains() over find() + end() (#38890)
refactor: prefer base::Contains() over find() + end() (#38443)

* refactor: use base::Contains() in KeyWeakMap::Has()

* refactor: use base::Contains() in WebRequest::RequestFilter::MatchesType()

* refactor: use base::Contains() in BaseWindow::AddBrowserView()

* refactor: use base::Contains() in DeepFreeze()

* refactor: use base::Contains() in Clipboard::Read()

* Revert "refactor: use base::Contains() in BaseWindow::AddBrowserView()"
This reverts commit 60152359d3978451ebdd7c8eed602c2fb8a9cafa.

* refactor: use base::Contains() in BaseWindow::AddBrowserView()

* refactor: use base::Contains() in IsDevToolsFileSystemAdded()

* refactor: use base::Contains() in MessagePort::DisentanglePorts()

* refactor: use base::Contains() in PowerSaveBlocker::IsStarted()

* refactor: use base::Contains() in SpellCheckClient::OnSpellCheckDone()

* refactor: use base::Contains() in ShowTaskDialogWstr()

* refactor: use base::Contains() in PrintViewManagerElectron::ScriptedPrint()

* refactor: use base::Contains() in PrintViewManagerElectron::DidGetPrintedPagesCount()

* refactor: use base::Contains() in NativeWindow::AddDraggableRegionProvider()

* refactor: use base::Contains() in ElectronBindings::ActivateUVLoop()

* refactor: use base::Contains() in NativeWindowViews::IsVisibleOnAllWorkspaces()

* refactor: use base::Contains() in HidChooserController::OnDeviceAdded()

* refactor: use base::Contains() in ElectronSandboxedRendererClient::WillReleaseScriptContext()

* refactor: use base::Contains() in ElectronRendererClient::WillDestroyWorkerContextOnWorkerThread()

* refactor: use base::Contains() in GlobalShortcut::OnKeyPressed()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-22 13:06:35 +02:00
trop[bot]
192295697e fix: crash calling BrowserWindow.removeBrowserView() with destroyed webContents (#38884)
fix: crash calling removeBrowserView() with destroyed webContents

https://github.com/electron/electron/issues/37642

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-06-22 11:22:30 +02:00
trop[bot]
e47bdb67f8 fix: set minimize visibility true with enable (#38881)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2023-06-22 10:31:06 +02:00
trop[bot]
25dee92c57 refactor: remove unused InspectableWebContentsView::GetWebView() (#38819)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-16 12:43:47 -05:00
trop[bot]
053031e96c refactor: constexpr lookup tables (#38807)
* refactor: constexpr lookup tables (#38771)

* refactor: use a constexpr lookup table in GetPathConstant()

* refactor: use a constexpr lookup table in SystemPreferences::GetColor()

* refactor: use a constexpr lookup table in SimpleURLLoaderWrapper::Create()

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

* fix: use MakeFixedFlatMap() instead of MakeFixedFlatMapSorted()

The latter compiles faster but does not exist in 24-x-y

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-16 10:03:09 +02:00
trop[bot]
1e64527ec3 feat: support node: prefixed requires in sandboxed renderer preloads (#38727)
feat: support node: prefixed requires in sandboxed renderer preloads

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-06-15 12:00:01 +02:00
trop[bot]
1645aece38 fix: preferCSSPageSize error type (#38792)
fix: preferCSSPageSize error type

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-06-14 11:03:13 -07:00
Pedro Pontes
1f66b20392 chore: cherry-pick 3 changes from Release-2-M114 (#38787)
* chore: [24-x-y] cherry-pick 1 changes from Release-2-M114

* 2e76270cf65e from v8

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-06-14 11:02:59 -07:00
trop[bot]
8df8cad3a0 refactor: use compile-time cli arg sets. (#38770)
We're currently building these on the heap with `std::set<std::string>`
but this can be a very small compile-time container instead.

Marking as 'refactor' rather than 'perf' since this isn't called often,
but moving from heap to compile-time is good and using this container
makes the code more readable.
2023-06-13 16:28:30 -05:00
trop[bot]
6d111ddbe3 fix: reparenting UAF crash on macOS (#38677)
* fix: reparenting UAF crash on macOS

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

* Update api-browser-window-spec.ts

* Update api-browser-window-spec.ts

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-06-13 15:54:09 -04:00
trop[bot]
2c9f2e81e8 perf: prefer base::StringPiece over std::string for build-time strings (#38736)
* perf: use base::StringPiece in InclusionStatusToString()

The strings are all build-time constants and this is a private function

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

* perf: use base::StringPiece in ErrorCodeToString()

The strings are all build-time constants and this is a private function

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

* perf: use base::StringPiece in MessageSourceToString()

The strings are all build-time constants and this is a private function

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

* perf: use base::StringPiece in CursorTypeToString()

The strings are all build-time constants and this is a private function

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

* perf: use base::StringPiece in MediaStreamTypeToString()

The strings are all build-time constants and this is a private function

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

* perf: use base::StringPiece in ModifiersToArray()

The strings are all build-time constants and this is a private function

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

* perf: use base::StringPiece in WebFrameRenderer::MaybeGetRenderFrame()

The strings are all build-time constants and this is a private function

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-12 16:22:15 -05:00
trop[bot]
14c6c397d0 fix: menu bar visibility when exiting full screen (#38681)
* fix:visibility of menu bar when exiting full screen

Co-authored-by: wugaosheng <wugaosheng@kylinos.cn>

* format code

Co-authored-by: wugaosheng <wugaosheng@kylinos.cn>

* format code

Co-authored-by: wugaosheng <wugaosheng@kylinos.cn>

* Modify comments

Co-authored-by: wugaosheng <wugaosheng@kylinos.cn>

* add menu bar visibility test

Co-authored-by: wugaosheng <wugaosheng@kylinos.cn>

* format code

Co-authored-by: wugaosheng <wugaosheng@kylinos.cn>

* change code

Co-authored-by: wugaosheng <wugaosheng@kylinos.cn>

* platform related in test

Co-authored-by: wugaosheng <wugaosheng@kylinos.cn>

* Update api-browser-window-spec.ts

* Update api-browser-window-spec.ts

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: wugaosheng <wugaosheng@kylinos.cn>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-06-12 15:50:07 +02:00
Keeley Hammond
3ce4c24c4b chore: cherry-pick 8 changes from Release-0-M114 (#38536)
* chore: [24-x-y] cherry-pick 4 changes from Release-0-M114

* e6b75a8b4900 from chromium
* 3b0607d14060 from v8
* 9c6dfc733fce from v8
* ea1cd76358e0 from chromium

* chore: remove one invalid patch, fix another

* chore: add missing backports.

* chore: update patches

---------

Co-authored-by: Pedro Pontes <pepontes@microsoft.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2023-06-09 17:29:30 -07:00
trop[bot]
97018c7be1 build: use upstream's presubmit cpplint filters. (#38687)
* build: use upstream's presubmit cpplint filters.

Our list of filters has fallen out-of-sync with upstream tests and so
our checks don't match those in the Google + Chromium guides.

The checks in this PR come from depot_tools and are copied manually
since the depot_tools code is python but our linter is js. 🤷
Perhaps we should rewrite in python?

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

* fixup! build: use upstream's presubmit cpplint filters.

chore: make linter happy with my linter changes

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-09 12:27:00 -07:00
trop[bot]
42c90f3eeb build: move uploadIndexJson to just before publishRelease (#38701)
* build: move uploadIndexJson to just before publishRelease

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* chore: move uploadNodeShasums as well

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* build: upload node checksums before validating them

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-06-09 12:22:22 -07:00
trop[bot]
bb2f62f95f refactor: add SessionPreferences::CreateForBrowserContext() (#38712)
Copy the NativeWindowRelay::CreateForWebContents() idiom
to simplify SessionPreferences's constructor and lifecycle.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-09 12:21:02 -07:00
Samuel Attard
b60166eddc chore: cherry-pick 94af9d13a14b from chromium (#38711)
* chore: cherry-pick 94af9d13a14b from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-06-09 12:08:56 -05:00
trop[bot]
1b762ef8a1 fix: dangling pointer warning when updating menus (#38689)
fix: dangling raw_ptr warning when updating menus

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-08 13:28:23 -04:00
trop[bot]
3815e90434 fix: bad error passing webContents.print(null) (#38640)
fix: bad error passing webContents.print(null)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-06-07 23:53:05 -07:00
trop[bot]
65fba6f51b refactor: remove unused OffScreenRenderWidgetHostView fields (#38651)
* refactor: remove unused field OffScreenRenderWidgetHostView::last_time_

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

* refactor: remove unused field OffScreenRenderWidgetHostView::last_scroll_offset_

Unused since 1a9e253

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

* refactor: remove unused field OffScreenRenderWidgetHostView::paint_callback_running_

assigned to, but unread, since 81bf158

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-07 23:50:38 -07:00
Pedro Pontes
5e6d99a6af chore: cherry-pick 2 changes from Release-1-M114 (#38654)
* chore: [24-x-y] cherry-pick 2 changes from Release-1-M114

* 73af1a19a901 from v8
* 0035a4a8dac2 from v8

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-06-07 23:49:37 -07:00
trop[bot]
bfb3b6d9a4 build: improve error output in release.js (#38664)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-06-07 23:48:17 -07:00
Keeley Hammond
45caec231c build: uuaw @octokit/request to 6.2.5 (#38644)
build: uuaw occtokit/rest to 6.2.5
2023-06-07 14:26:15 -07:00
trop[bot]
7254da337b fix: sync api::Screen wrapper method sigs to upstream (#38631)
refactor: sync api::Screen getter sigs to upstream

ui::Display GetAllDisplays(), GetPrimaryDisplay(), GetDisplayMatching(),
and GetDisplayNearestPoint() methods are all const, so make our wrappers
const too.

ui::Display GetAllDisplays() returns a const reference, so make our
wrapper return a const reference too. This avoids creating a new
std::vector<display::Display> each time it's called.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-07 10:45:17 -05:00
trop[bot]
612775dad5 refactor: remove redundant resizing strategy equality check (#38618)
* refactor: remove redundant resizing strategy equality check

Upstream already checks this.

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

* refactor: remove devtools_settings.h from iwc header

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

* refactor: remove unused <vectro> from iwc header

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-07 09:28:39 +02:00
trop[bot]
66845e7aa3 docs: removed outdated Appveyor doc (#38628)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-06-06 23:11:49 -07:00
trop[bot]
31380eeb87 fix: account for BrowserView bounds in setting autofill popup bounds (#38608)
fix: account for BrowserView bounds in setting autofill popup bounds

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-06-06 21:50:43 +02:00
trop[bot]
0f4fce9448 refactor: in NativeWindowViews, aggregate fields directly (#38602)
Manual backport of #38559

Manual backport needed due to very minor code shear

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-06 11:26:33 -05:00
trop[bot]
f933ce3755 refactor: use process_util.h helpers (#38604)
refactor: use process_util.h helpers

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-06-06 14:29:42 +02:00
David Sanders
4845dd7a71 chore: type check JS in docs (#38600) 2023-06-06 17:14:07 +09:00
trop[bot]
bd0e65292f chore: remove unused electron::api::View code (#38586)
chore: remove unused electron::api::View code (#38561)

chore: remove unused electron::api::View methods

Remove code that was added in 2c8dc9e but never used.

Manually backport #38561 .

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-06-05 16:45:38 +02:00
trop[bot]
22bd19ddc1 docs: clarify which electron modules are exposed in sandboxed renderers (#38578)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-06-05 11:34:21 +02:00
trop[bot]
580c04e69f docs: fix SerialPort typing (#38582)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-06-05 10:19:16 +02:00
trop[bot]
99a78dc37c build: fix doc-only early exit on Appveyor (#38550)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-06-01 15:09:16 -04:00
John Kleinschmidt
18b2a4e957 feat: add USB protected classes handler (#38498)
feat: add USB protected classes handler (#38263)

* feat: add USB protected classes handler

* chore: apply review suggestions

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

* chore: update docs

* chore: apply review suggestions

* update doc per suggestion

---------

Co-authored-by: Charles Kerr <charles@charleskerr.com>
(cherry picked from commit b4ec363b3d)
2023-06-01 10:12:48 -04:00
trop[bot]
a21fa57cae refactor: remove unused switches (#38531)
* refactor: remove unused declaration of electron::kSHA1Certificate

usage removed in 13a1d79

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

* refactor: remove unused declaration of electron::kSHA1MajorDescription

usage removed in 13a1d79

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

* refactor: remove unused declaration of electron::kSHA1MinorDescription

usage removed in 13a1d79

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

* refactor: remove unused declaration of electron::kCertificateError

usage removed in 13a1d79

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

* refactor: remove unused declaration of electron::kValidCertificate

usage removed in 13a1d79

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

* refactor: remove unused declaration of electron::kValidCertificateDescription

usage removed in 13a1d79

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

* refactor: remove unused declaration of electron::kSecureProtocol, kSecureProtocolDescription

usage removed in 497f5a1

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

* refactor: remove electron::options::kPreloadScripts

removed in bad8d5e0

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

* refactor: remove electron::options::kImageAnimationPolicy

removed in 385d0f5

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-05-31 16:52:24 -05:00
trop[bot]
54fe508125 build: combine and elaborate on exposed BoringSSL ciphers (#38522)
build: combine and elaborate on exposed BoringSSL ciphers

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-31 14:31:12 -04:00
trop[bot]
a662023207 docs: add <webview> new-window event removal to breaking-changes.md (#38525)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-05-31 14:30:51 -04:00
trop[bot]
017fd30e89 chore: make contentTracing.stopRecording() failure clearer (#38520)
chore: make contentTracing.stopRecording() failure clearer

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-31 11:28:22 -04:00
trop[bot]
2281fbbe6c fix: DCHECK minimizing parent window with non-modal child (#38508)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-31 10:28:44 -04:00
trop[bot]
eece0dcbe1 ci: clean up docs only change logic (#38494)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-31 09:52:49 -04:00
trop[bot]
5a8243fe32 chore: process.mainModule -> require.main (#38478)
chore: process.mainModule -> require.main

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-30 10:52:57 +02:00
trop[bot]
2fc0c83cd6 build: make ReactiveObjC/Mantle deps format consistent (#38479)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-30 10:52:45 +02:00
trop[bot]
100bea3b37 docs: ensure app.md examples are runnable (#38439)
docs: ensure app.md examples are runnable

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-25 09:58:24 +02:00
trop[bot]
6e30bf2ce9 fix: linker error missing uv__strtok (#38394)
fix: linker error missing uv__strtok

This symbol is referenced inside what seems to be dead code
in `uv__search_path` in third_party/electron_node/deps/uv/src/unix/core.c
When compiling in LTO mode, the reference is removed,
but not during a non-LTO build.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Bruno Pitrus <brunopitrus@hotmail.com>
2023-05-24 15:05:27 -04:00
David Sanders
2ef49a5333 chore: fix lint:js-in-markdown script (#38334) 2023-05-24 20:00:47 +02:00
trop[bot]
01f4b2c915 fix: MediaDevices missing DisplayMediaInformation (#38434)
fix: MediaDevices missing DisplayMediaInformation

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-24 19:15:29 +02:00
trop[bot]
e8c05bccd1 docs: disablewebsecurity on webview-tag can not be changed for an active session (#38399)
disablewebsecurity on webview-tag can not be changed for an active session

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>
2023-05-22 15:19:22 -04:00
trop[bot]
61daccb001 fix: getNormalBounds() for transparent windows on Windows (#38349)
fix: getNormalBounds for transparent windows on Windows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-22 13:21:08 +02:00
Shelley Vohr
4cfd732908 feat: support Mica/Acrylic on Windows (#38361) 2023-05-18 16:57:41 -04:00
trop[bot]
2594d94760 feat: add missing 'cursor-changed' type values (#38364)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-18 16:55:06 -04:00
David Sanders
c9ff49c827 docs: fix typing of message box type value (#38375) 2023-05-18 20:53:32 +02:00
electron-roller[bot]
31f5e3c356 chore: bump chromium to 112.0.5615.204 (24-x-y) (#38350)
* chore: bump chromium in DEPS to 112.0.5615.204

* chore: update patches

* refactor: add WebViewGuestDelegate::GetGuestDelegateWeakPtr()

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

This approach copied from GuestViewBase::GetGuestDelegateWeakPtr() approach in that same commit.

(cherry picked from commit 3f3ab39e3a1077f71aa90319d7a81d53cfb3c55e)

---------

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: Charles Kerr <charles@charleskerr.com>
2023-05-18 12:15:10 -04:00
trop[bot]
0c3e4e8dd7 build: modify gclient.py with unified patch (#38360)
* build: modify gclient.py with unified patch

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

* ci: ensure depot_tools does not update

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

* ci: move auto-update disable outside if

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>
2023-05-17 16:37:42 -04:00
trop[bot]
37b227d427 docs: fix devtools-open-url ts definition (#38354)
docs: fix devtools-open-url ts definition

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-17 16:20:57 -04:00
trop[bot]
d8e7457ab0 fix: win.isMaximized() for transparent windows on Windows (#38343)
* fix: win.isMaximized() for transparent windows

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

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-05-17 13:09:55 +02:00
Pedro Pontes
4c46a940fc chore: cherry-pick 81d7b3e6138c from chromium (#38271)
* chore: cherry-pick 81d7b3e6138c from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-05-16 16:32:42 -04:00
electron-roller[bot]
94c6d89579 chore: bump chromium to 112.0.5615.183 (24-x-y) (#38319)
* chore: bump chromium in DEPS to 112.0.5615.183

* 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>
2023-05-16 16:24:51 -04:00
David Sanders
ff2dfe67c5 chore: migrate to @electron/lint-roller for Markdown linting (#38282)
chore: migrate to @electron/lint-roller for Markdown linting (#38191)
2023-05-16 11:19:49 -07:00
trop[bot]
9cf44a0229 fix: unify BrowserWindow.isVisible() logic cross-platform (#38313)
fix: unify BrowserWindow.isVisible() logic cross-platform

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-16 11:16:14 -04:00
trop[bot]
696f9894e6 fix: isMaximized after minimize/fullscreen on macOS (#38308)
fix: isMaximized after isMinimized on macOS

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-16 14:28:37 +02:00
trop[bot]
814dc6e16d fix: enable BrowserWindow.id access post-destruction (#38310)
fix: enable BrowserWindow id access post-destruction

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-16 12:52:05 +02:00
David Sanders
ad800081ce test: prewarm Node headers cache if specifying Electron version (#38298)
test: prewarm Node headers cache if specifying Electron version (#38287)
2023-05-16 11:47:43 +02:00
trop[bot]
a22e2a778e build: drop python2 from CI (#38303) 2023-05-16 09:21:54 +02:00
Shelley Vohr
34f181db5d docs: fix typing of session.setDevicePermissionHandler (#38228)
docs: fix typing of session.setDevicePermissionHandler

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-05-09 12:07:54 -04:00
Shelley Vohr
9aa49570a1 docs: update dead link to Apple Human Interface notification guidelines (#38227)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: astone123 <adams@cypress.io>
2023-05-09 12:07:19 -04:00
Shelley Vohr
ea68961d50 fix: handle AXManualAccessibility attribute cross-protocol (#38224)
fix: handle `AXManualAccessibility` attribute cross-protocol (#38142)

* fix: handle AXManualAccessibility attribute cross-protocol

* Update shell/browser/mac/electron_application.mm



---------

Co-authored-by: Robo <hop2deep@gmail.com>
2023-05-09 12:04:31 -04:00
Shelley Vohr
7ddcd7eaba refactor: remove IPC from mouse_util (#38221)
refactor: remove IPC from mouse_util (#38183)
2023-05-09 12:02:22 -04:00
Shelley Vohr
00de69508e feat: net.resolveHost (#38153)
feat: net.resolveHost
2023-05-04 15:45:15 -04:00
Alexey Kuzmin
7302832dbe test: use await to call "closeWindow" (#38173) 2023-05-04 14:27:00 +02:00
David Sanders
549c6dd0ec fix: falsy transparent shouldn't affect webContents background (#38158) 2023-05-03 15:27:52 +02:00
Shelley Vohr
1df9dbad51 chore: correct extra qualification causing build error with gcc (#38145)
* chore: correct extra qualification causing build error with GCC

Co-authored-by: Bruno Pitrus <brunopitrus@hotmail.com>

* fixup for lint

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>

* chore: fix lint

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Bruno Pitrus <brunopitrus@hotmail.com>
Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>
2023-05-02 20:44:29 -04:00
Shelley Vohr
a051ee5d41 fix: AXManualAccessibility showing failure (#38147)
fix: AXManualAccessibility showing failure

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
2023-05-02 20:44:08 -04:00
trop[bot]
912aa52b9b feat: add thermal states to powerMonitor (#38027)
* feat: add thermal states to powerMonitor

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

* update docs

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>
2023-05-01 09:26:23 -04:00
Felix Rieseberg
6b2a63fd53 fix: crash on missing RenderWidgetHostView (#38136)
fix: crash on missing `RenderWidgetHostView` (#38100)

chore: fix crash on missing RenderWidgetHostView

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-01 09:23:02 -04:00
trop[bot]
8b7a54d9ec docs: fix start highlight tutorial-2-first-app.md (#38113)
doc: fix start highlight tutorial-2-first-app.md

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Francis Chartrand <chartrandf@users.noreply.github.com>
2023-04-25 13:16:51 +02:00
Black-Hole️
b30f8e13d8 fix: webContents return type incorrect (#38111)
fix: webContents return type incorrect (#38026)

* fix: webContents type incorrect

* fix: ci failed

* fix: ci failed 2
2023-04-25 13:16:30 +02:00
trop[bot]
9f028cc45c chore: always lint JS in docs/fiddles (#38108)
* chore: always lint JS in docs/fiddles

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-04-24 19:45:40 +02:00
Keeley Hammond
00163df35d chore: cherry-pick 1 changes from Release-2-M112 (#38082)
* chore: [24-x-y] cherry-pick 1 changes from Release-2-M112

* [ec53103cc72d](https://chromium-review.googlesource.com/) from chromium

* chore: update patch
2023-04-24 10:17:44 +02:00
trop[bot]
8761af5cbb fix: crash in utilityProcess when generating code from strings (#38041)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-04-24 13:23:04 +09:00
electron-roller[bot]
4e06c64d23 chore: bump chromium to 112.0.5615.165 (24-x-y) (#38047)
chore: bump chromium in DEPS to 112.0.5615.165

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2023-04-23 22:17:14 +02:00
trop[bot]
fb55fc46b0 fix: defaults broken in shell.openExternal() options (#38072)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-04-21 12:43:52 -07:00
electron-roller[bot]
c91dc20429 chore: bump chromium to 112.0.5615.138 (24-x-y) (#38031)
chore: bump chromium in DEPS to 112.0.5615.138

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2023-04-20 14:20:06 +02:00
trop[bot]
6bb78d7fff build: fix building with no PDF support (#38007)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Alexey Kuzmin <alex.s.kuzmin@gmail.com>
2023-04-17 20:19:20 -04:00
trop[bot]
4a9f347c20 chore: initial linting fixes for JS in docs/fiddles (#37838)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-17 11:55:06 -04:00
trop[bot]
85ad7844dd docs: add note to win.setFullScreen(flag) (#37996)
docs: add note to win.setFullScreen(flag)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-17 12:11:02 +02:00
trop[bot]
b345ffd2f3 chore: replace uses of ComPtr::GetAddressOf() with ComPtr::operator& (#37992)
chore: replace uses of ComPtr::GetAddressOf() with ComPtr::operator&

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-17 10:38:30 +02:00
trop[bot]
35056392a8 docs: update github.com links (#37989)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-16 17:06:31 -07:00
electron-roller[bot]
0a69431dda chore: bump chromium to 112.0.5615.121 (24-x-y) (#37985)
chore: bump chromium in DEPS to 112.0.5615.121

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2023-04-15 21:19:12 -07:00
trop[bot]
56122f1491 fix: swipe event emission on macOS (#37965)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-14 09:19:15 -07:00
trop[bot]
31500cc485 fix: defaultFontFamily in webPreferences (#37968)
* fix: defaultFontFamily in webPreferences

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* chore: check if default_font_family_ is empty

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>
2023-04-13 21:09:16 -04:00
electron-roller[bot]
a0987ae0de chore: bump chromium to 112.0.5615.87 (24-x-y) (#37974)
chore: bump chromium in DEPS to 112.0.5615.87

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2023-04-13 13:07:08 -04:00
trop[bot]
f9faad71d5 docs: Fix the syntax error for code fragment (#37960)
By using `app.on('ready').then(xxx)`, application will throw a TypeError

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Zenkie Bear <62818957+ZenkieBear@users.noreply.github.com>
2023-04-13 13:28:19 +02:00
trop[bot]
3a027a743b fix: menus on Linux after window modification (#37906)
* fix: menus on Linux after window modification

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* test: don't run on CI

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* chore: fix .patches

* test: refactor since types are off

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2023-04-13 11:26:51 +02:00
John Kleinschmidt
63388b3616 build: revert clang revert (#37934)
* build: revert clang revert

* ci: use newer clang for 32-bit Linux ARM

Fixes crash on compiling skia/skia/SkPatchUtils.cpp
2023-04-13 15:05:45 +09:00
trop[bot]
2e7bfb4e0d fix: recommended node-gyp version in node.h error (#37927)
fix: recommended node-gyp version in node.h error

In
https://github.com/electron/electron/blob/main/docs/tutorial/using-native-node-modules.md#using-npm,
we recommend setting the `npm_config_disturl` variable but doing that
does not work on node-gyp v8.4.0 because after
https://github.com/nodejs/node-gyp/pull/2497
landed, the dist URL was read only from `gyp.opts['dist-url']`. The fix
for reading the value from `npm_config_disturl` by parsing
`gyp.opts.disturl` was landed in
https://github.com/nodejs/node-gyp/pull/2547 and that change was
released in node-gyp v9.0.0, so this change updates the error macro to
recommend node-gyp v9.0.0 as the minimum required version.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Darshan Sen <raisinten@gmail.com>
2023-04-11 10:04:51 -07:00
trop[bot]
95729e64e4 fix: exceptions during function/promise result conversions live in calling world (#37925)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-04-11 09:23:26 -07:00
trop[bot]
6f9cc3ce32 chore: use nested namespaces (#37915)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-11 12:39:14 +02:00
trop[bot]
55df7a369e fix: broken buttons in PDF viewer (#37918)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-11 12:00:17 +02:00
trop[bot]
a6d934f2a2 chore: use emplace when possible (#37910)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-11 11:53:18 +02:00
trop[bot]
78404eb23f chore: change some for loops to range-based (#37913)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-11 11:49:30 +02:00
David Sanders
59fe35388d chore: enforce consistent Markdown style for strong and emphasis (#37845) 2023-04-11 16:22:57 +09:00
trop[bot]
81e3cef294 fix: showAboutPanel also on linux (#37872)
showAboutPanel also on linux

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
2023-04-11 16:20:47 +09:00
trop[bot]
ae54e3768c test: support 'latest'/'latest@X' Electron version strings (#37867)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-11 15:21:55 +09:00
trop[bot]
4de542d524 fix: exceptions in nested conversions live in the target world (#37897)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-04-10 18:00:58 -07:00
Keeley Hammond
9f1bb29528 docs: update 24-x-y breaking changes (#37880) 2023-04-06 21:23:54 -07:00
trop[bot]
309cd19d19 docs: update 21-x-y EOL dates (#37870)
* docs: update 21-x-y EOL dates

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

* doc: update node versions

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2023-04-06 13:01:36 -07:00
Fedor Indutny
14985e29e0 feat: session.resolveHost (#37847)
feat: session.resolveHost (#37690)

* feat: session.resolveHost

Expose Chromium's host resolution API through the Session object.

* Update shell/browser/api/electron_api_session.cc



* address feedback

* fix tests

* address feedback

* Add options

* Update shell/browser/api/electron_api_session.cc



* Update shell/browser/net/resolve_host_function.cc



* lint

* return object

* add missing file

* fix crash

* handle scope

* links

---------

Co-authored-by: Fedor Indutny <indutny@signal.org>
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2023-04-06 10:23:44 -04:00
David Sanders
4fc59bcbef test: remove workaround for fixed Menu.closePopup issue (#37846)
test: remove workaround for fixed Menu.closePopup issue (#37802)
2023-04-06 18:52:18 +09:00
electron-roller[bot]
0a153e7dca chore: bump chromium to 112.0.5615.50 (24-x-y) (#37833)
chore: bump chromium in DEPS to 112.0.5615.50

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2023-04-05 15:50:00 -04:00
Jeremy Rose
5517655962 fix: apply csp correctly when contextIsolation: false (#37839) 2023-04-05 12:11:40 -07:00
trop[bot]
663b741d3f docs: fix app.getPreferredSystemLanguages() return type (#37835)
docs: fix app.getPreferredSystemLanguages() return type

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-05 11:08:38 -04:00
trop[bot]
ba6ac2a087 fix: Fn+F fullscreen transitioning on macOS (#37823)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-05 16:37:59 +09:00
trop[bot]
3c131923f3 chore: combine parallel/test-v8-stats v8 patches (#37818)
* chore: combine parallel/test-v8-stats v8 patches

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

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-04-04 15:16:28 +02:00
trop[bot]
0c2cb44976 fix: record helper error messages in electron_main_mac (#37810)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2023-04-03 15:25:21 -07:00
Keeley Hammond
a2d0af4bc3 build: strip warnings from stdout in get_release (#37795)
build: strip warnings from stdout in `get_release` (#37277)

build: strip warnings from stdout in get_release

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-03 12:40:35 +02:00
Keeley Hammond
82869b88f1 refactor: createThumbnailFromPath takes size not maxSize (#37796)
refactor: `createThumbnailFromPath` takes `size` not `maxSize` (#37362)

refactor: createThumbnailFromPath takes size not maxSize
2023-04-03 12:39:50 +02:00
trop[bot]
ff01742f8e fix: set background color for menu bar on Windows (#37785)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-01 10:44:26 +02:00
trop[bot]
0fc69fcaf4 build: fix build-tools schema in config (#37777)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-31 17:59:34 +02:00
trop[bot]
505e98e694 docs: update references to @electron/rebuild (#37776)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2023-03-31 17:46:26 +02:00
electron-roller[bot]
5c6dd3fdef chore: bump chromium to 112.0.5615.49 (24-x-y) (#37767)
* chore: bump chromium in DEPS to 112.0.5615.49

* fix: Store the thread stack start in TLS.

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

Fixes #37454

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-03-30 20:06:12 -04:00
trop[bot]
5f68f374d8 docs: remove save-to-disk disposition (#37769)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2023-03-30 20:38:36 +02:00
trop[bot]
0af7d3c99b docs: add links to IPC event structures (#37770)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-03-30 20:38:13 +02:00
trop[bot]
b6070c34d4 docs: update docs.microsoft.com links to learn.microsoft.com (#37751)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-03-30 09:41:35 -04:00
trop[bot]
6101b9cd29 fix: draggable regions shouldn't capture clicks on frames windows (#37741)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-28 13:34:14 -04:00
trop[bot]
363fb370ac docs: updated package.json content and electron version in build first app guide (#37743)
* Docs: updated package.json content and electron version in build first app guide

Co-authored-by: Mikołaj <32898551+dufipl@users.noreply.github.com>

* docs: removed caret from electron version

Co-authored-by: Mikołaj Sawicki <32898551+dufipl@users.noreply.github.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Mikołaj <32898551+dufipl@users.noreply.github.com>
2023-03-28 12:31:45 -04:00
trop[bot]
58d0564825 chore: generator objects can't be sent over the context bridge (#37730)
chore: generator objects can't be sent over the context bridge (#37593)

* chore: generator objects can't be sent over the context bridge

* Trigger Build

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-28 11:15:28 -04:00
trop[bot]
f38c3d91a2 fix: crash in MessagePortMain with some postMessage params (#37726)
* fix: crash in MessagePortMain postMessage

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

* Update shell/browser/api/message_port.cc

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

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>
2023-03-28 10:29:02 -04:00
trop[bot]
7682c2d950 docs: fixup incorrect value for disabling sandbox (#37723)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Peter Xu <sysu.peter.hsu@gmail.com>
2023-03-27 18:28:14 -04:00
electron-roller[bot]
7588eb5a72 chore: bump chromium to 112.0.5615.39 (24-x-y) (#37700)
* chore: bump chromium in DEPS to 112.0.5615.39

* chore: update patches

* chore: update chromium/add_maximized_parameter_to_linuxui_getwindowframeprovider.patch

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

Our patch changes the signature of `LinuxUiTheme::GetWindowFrameProvider()`.
Upstream 4295455 added a new subclass (FallbackLinuxUi) so sync its version
of GetWindowFrameProvider() to match our changes.

(cherry picked from commit 79408b5fb8)

---------

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: Charles Kerr <charles@charleskerr.com>
2023-03-27 13:22:01 -04:00
trop[bot]
ce82646f5c fix: allow cancelling of bluetooth requests (#37717)
* fix: allow cancelling of bluetooth requests

allows cancelling of bluetooth requests when no devices present

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

* docs: update docs to reflect how bluetooth works.

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>
2023-03-27 12:54:36 -04:00
Erick Zhao
1cd40681a9 docs: delete synopsis.md (#37687)
docs: delete synopsis.md (#37580)

* docs: delete synopsis.md

* remove code references to doc
2023-03-27 12:24:06 -04:00
trop[bot]
7892de74ee docs: change MSDN links to new Microsoft docs (#37703)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2023-03-27 09:38:14 -04:00
John Kleinschmidt
d4798f64e7 ci: update appveyor image to e-112.0.5615.29 (#37683) 2023-03-23 19:33:13 -04:00
trop[bot]
c77eb753e5 ci: fixup gn check to actually run gn check (#37679)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-03-23 18:26:26 -04:00
trop[bot]
da3d5967aa docs: update notifications tutorial (#37640)
* docs: update notifications tutorial

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

* delete unused assets

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2023-03-22 10:17:51 -04:00
electron-roller[bot]
8d9e23cf88 chore: bump chromium to 112.0.5615.29 (24-x-y) (#37598)
* chore: bump chromium in DEPS to 112.0.5615.29

* chore: update patches

* ci: make sure that strip_binary.gni is properly preserved

(cherry picked from commit afb446c328)

* fixup: ci: make sure that strip_binary.gni is properly preserved

---------

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>
2023-03-20 22:20:17 -04:00
trop[bot]
080fb8e648 fix: don't set delegate for QLPreviewPanel (#37578)
fix: don't set delegate for QLPreviewPanel

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Spiegel <jeremy.spiegel@frontapp.com>
2023-03-20 20:17:30 -04:00
trop[bot]
7da962fb82 fix: invoke app.dock.{hide|show} instead of duplicating logic (#37625)
fix: invoke app.dock.{hide|show} instead of duplicating logic

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-20 13:37:13 -04:00
trop[bot]
73f4440d0c docs: update broken links (#37621)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-03-20 12:28:00 -04:00
trop[bot]
3c5cd4c2eb fix: properly bubble up cookie creation failure message (#37597)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-16 17:52:43 +01:00
trop[bot]
62aad2481f feat: add enableLocalEcho flag to setDisplayMediaRequestHandler() callback (#37528)
* feat: add enableLocalEcho flag to setDisplayMediaRequestHandler() callback

Co-authored-by: Theo Gravity <theo@switchboard.app>

* Fix lint

Co-authored-by: Theo Gravity <theo@switchboard.app>

* Update doc

Co-authored-by: Theo Gravity <theo@switchboard.app>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Theo Gravity <theo@switchboard.app>
2023-03-16 09:47:15 +01:00
trop[bot]
b32786afc5 docs: clarify open-url not preventable (#37575)
docs: clarify open-url not preventable

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-14 18:53:33 -04:00
electron-roller[bot]
238dfbaa0f chore: bump chromium to 112.0.5615.20 (24-x-y) (#37546)
* chore: bump chromium in DEPS to 112.0.5615.20

* 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>
2023-03-13 15:39:53 +01:00
John Kleinschmidt
ddb4a16eb2 chore: bump chromium to 112.0.5615.10 (24-x-y) (#37510)
* chore: bump chromium to 112.0.5615.10

* 4240798: Get rid of ShowInvalidPrinterSettingsError() in PrintManagerHost.

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

* chore: fixup patch

* 4173660: Remove unused argument in BeforeUnloadCompleted

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4173660
(cherry picked from commit 6d3934f743)

* refactor: base value type DICTIONARY replaced with DICT

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

* 4251237: [StorageKey Cleanup] (2) Rename CreateFirstParty constructors

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4251237
(cherry picked from commit 31bdd549d0)

* refactor: rename latency metrics

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

* refactor: base::span explicit conversion checks

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4219636
(cherry picked from commit 020e8c6aae)

* chore: iwyu net/cert/cert_verify_result.h

(cherry picked from commit 24583f5583)

* 4258446: Move network::mojom::ClearDataFilter to its own mojom file

https://chromium-review.googlesource.com/c/chromium/src/+/4258446
(cherry picked from commit 5ff47109cd)

* refactor: refactoring geolocation manager

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4161603
(cherry picked from commit 1eeaafb45c)

* refactor: use modern base values in tracing

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4210912
(cherry picked from commit 192c988c1e)

* refactor: add sanitized context to clipboard write

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4178264
(cherry picked from commit 3ef020b5e5)

* 4256866: [Extensions] Replace GetHooksForAPI with a RegisterHooksDelegate

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

* refactor: s/Rect/WindowFeatures

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4167001
(cherry picked from commit 12d121265b)

* 4226656: Add response url to SimpleURLLoader::OnRedirectCallback

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4226656
(cherry picked from commit 9f66c47930)

* Better approach for ShowInvalidPrinterSettingsError() removal

* build: use xcode 14

(cherry picked from commit 06bd2c0442)

* build: update appveyor image

4072083: New toolchain for Windows 11 10.0.22621.755 SDK | https://chromium-review.googlesource.com/c/chromium/src/+/4072083
(cherry picked from commit 437c49898f)

* 4261434: Remove browser_watcher (1/3): Move ExitCodeWatcher to chrome/app

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

* 4128591: Enable large pdbs by default

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

* move dbgcore/dbghelp to extensions_to_skip

(cherry picked from commit 8eeb555145)

* 4273450: dpwas: Send announcement when live regions changed

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

* 4277708: win7dep: Remove ResolveCoreWinRTStringDelayload

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

* Roll clang+rust llvmorg-17-init-3170-g6e30dffe-1 : llvmorg-17-init-3874-g93a2fecc-1 / [skipping Rust]

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

* 4285717: Copy d3dcompiler_47.dll on ARM64 Windows builds

https://chromium-review.googlesource.com/c/angle/angle/+/4285717

* Revert "Roll clang+rust llvmorg-17-init-3170-g6e30dffe-1 : llvmorg-17-init-3874-g93a2fecc-1 / [skipping Rust]"

This reverts commit 71080f4f2d.

* Revert Roll clang+rust llvmorg-16-init-17653-g39da55e8-3

This clang roll breaks Linux arm 32-bit

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2023-03-09 14:05:20 -05:00
trop[bot]
6c8aeb4c0d docs: remove outdated ipc example (#37538)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2023-03-09 10:01:42 -05:00
trop[bot]
44f8d11fd8 fix: fallback to X11 capturer if pipewire fails on Wayland (#37527)
* fix: fallback to x11 desktop capturer on Wayland

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>

* fix: sanitize window/screen capturer inputs

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

* chore: clean up patch description

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2023-03-08 15:13:23 -08:00
trop[bot]
077a7cd2f5 docs: fixup WebUSB fiddle (#37525)
docs: fixup webusb fiddle

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-03-07 21:16:01 -05:00
trop[bot]
dea0e6e259 fix: WebUSB on ARM64 macs (#37522)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-03-07 21:15:33 -05:00
trop[bot]
51b1ef4190 docs: remove misleading info from will-finish-launching docs (#37516)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2023-03-07 10:26:50 +01:00
trop[bot]
5abfb3a6bc fix: Showing the about panel is async on all platforms (#37508)
fix: Showing the about panel is async on all platforms (#37440)

* fix: about panel is a base::Value::Dict

* nix this test for a diff PR

* what if the about dialog was not blocking

* add this test back in

* document synchronicity

* github editor is a fan of spaces

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Calvin <clavin@users.noreply.github.com>
2023-03-06 13:31:45 -08:00
trop[bot]
33a34af2fb fix: don't double-log unhandled rejections (#37500)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-06 08:21:00 -08:00
trop[bot]
2be0bd9729 refactor: leverage Skia helpers for NSColor ANSI logic (#37489)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-06 11:43:04 +01:00
trop[bot]
2e3d9a4f6d fix: draggable regions on MAS (#37474)
* fix: draggable regions on MAS

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

* lint

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>
2023-03-03 09:46:03 +01:00
electron-roller[bot]
29ced1215a chore: bump chromium to 111.0.5563.50 (24-x-y) (#37223)
* chore: bump chromium in DEPS to 111.0.5563.19

* chore: bump chromium in DEPS to 111.0.5563.33

* chore: bump chromium in DEPS to 111.0.5563.41

* chore: update patches

* refactor: remove GetFontLookupTableCacheDir

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4191820
(cherry picked from commit 52740f127f)

* chore: remove dead DecodeToken code

(cherry picked from commit e7ac425771)

* chore: add stub impls for WCO routing

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/4182690
(cherry picked from commit 911e353b07)

* refacotr: switch mojom::NetworkHintsHandler to use SchemeHostPair instead of URL

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

* chore: bump chromium in DEPS to 111.0.5563.50

* chore: update patches

* 4240360: [intl] Revert date formatting behavior change from ICU 72

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

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-03-02 20:22:57 -05:00
trop[bot]
03285c8faf chore: improve contents.takeHeapSnapshot error messages (#37461)
* chore: improve contents.takeHeapSnapshot error messages

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

* fix wstring conversion issue

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>
2023-03-02 12:48:18 +01:00
trop[bot]
f02d262d32 fix: min/max width/height enforcement when aspectRatio is set (#37456)
fix: min/max width/height with aspect ratio

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-02 12:23:04 +01:00
trop[bot]
1ff589976c feat: add types to webRequest filter (#37427)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-03-02 10:05:29 +01:00
trop[bot]
9e3a44edf7 fix: handle closing webContents in BrowserViews (#37450)
* fix: handle closing webContents in BrowserViews

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

* test: add window.close() test

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>
2023-03-02 10:04:11 +01:00
trop[bot]
71803a5dd4 fix: Notification with reply obscuring first action on macOS (#37449)
fix: Notification with reply obscuring first action

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-01 14:25:01 +01:00
trop[bot]
f72a812db6 fix: about panel crash (#37442)
* fix: about panel is a base::Value::Dict

Co-authored-by: clavin <clavin@electronjs.org>

* nix this test for a diff PR

Co-authored-by: clavin <clavin@electronjs.org>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2023-03-01 13:56:01 +01:00
trop[bot]
4c368be0a9 fix: BroadcastChannel initialization location (#37443)
* fix: BroadcastChannel initialization location

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-01 12:24:23 +01:00
trop[bot]
a6a8622257 feat: add logUsage to shell.openExternal() options (#37291)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-02-27 10:02:49 +01:00
trop[bot]
9be3acd24c feat: add httpOnly cookies.get filter (#37365)
feat: add httpOnly cookies filter

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2023-02-27 10:02:19 +01:00
trop[bot]
886a5032cf fix: allow contextmenu event in draggable regions (#37395)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2023-02-26 20:42:08 -08:00
Samuel Attard
b05d385f4a build: set base rev 24-x-y (#37409) 2023-02-26 20:18:19 -08:00
trop[bot]
8edfa03ac7 docs: document change in draggable region behavior on macOS (#37407)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2023-02-26 16:52:42 -08:00
trop[bot]
b156ffb25a ci: rename Electron build step to include type of build being built (#37397)
ci: rename Electron build step to describe what is being built

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-02-24 12:26:38 -08:00
trop[bot]
a1255ae20f fix: guard more private API usage on MAS builds (#37364)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-02-21 17:54:48 +01:00
trop[bot]
de5ee7e60e fix: html fullscreen when window not fullscreenable (#37368)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-02-21 17:54:25 +01:00
trop[bot]
85802682b5 fix: restoring X11 window should not remove previous maximize state (#37358)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2023-02-21 12:50:40 +01:00
trop[bot]
f04ad15b65 build: remove unused python code (#37357)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-02-21 12:10:38 +01:00
trop[bot]
38ca7c0860 test: fix "crash cases" tests not failing properly (#37325)
* test: fix "crash cases" tests not failing properly

Co-authored-by: Alexey Kuzmin <alex.s.kuzmin@gmail.com>

* fixup! test: fix "crash cases" tests not failing properly

Co-authored-by: Alexey Kuzmin <alex.s.kuzmin@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Alexey Kuzmin <alex.s.kuzmin@gmail.com>
2023-02-20 12:53:09 +01:00
trop[bot]
309349a020 test: use render-process-gone event in tests (#37302)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-02-19 01:29:53 -08:00
trop[bot]
f3d50c674c test: rename & split internal module tests (#37328)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-02-19 01:26:08 -08:00
trop[bot]
8e74a37505 docs: only macOS 10.13+ is supported now (#37288)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-02-16 15:56:01 -08:00
trop[bot]
426c23446c chore: remove redundant Node.js patch (#37307)
* chore: fix patch for other patch

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

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-02-16 15:49:05 -08:00
trop[bot]
52adfe2137 test: use webContents.create() in type-safe way (#37308)
test: use (webContents as typeof ElectronInternal.WebContents).create()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-02-16 15:48:38 -08:00
Keeley Hammond
4911476787 build: use node18.12 appveyor image (24-x-y) (#37283)
build: use node18.12 appveyor image
2023-02-15 14:22:45 -08:00
trop[bot]
7a62411ad1 feat: include all standard paper sizes for webContents.print() (#37265)
feat: include standard paper sizes for webContents.print()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-02-15 19:58:49 +01:00
trop[bot]
99d648faaa fix: cookies filter secure invalid (#37246)
* fix: cookies filter secure and session invalid

Co-authored-by: Black-Hole1 <158blackhole@gmail.com>

* test: add test

Co-authored-by: Black-Hole1 <158blackhole@gmail.com>

* test: fix test failed

Co-authored-by: Black-Hole1 <158blackhole@gmail.com>

* test: fix test failed again

Co-authored-by: Black-Hole1 <158blackhole@gmail.com>

* fix: session check logic incorrect

Co-authored-by: Black-Hole1 <158blackhole@gmail.com>

* refactor: reset cookies filter session logic

Co-authored-by: Black-Hole1 <158blackhole@gmail.com>

* Update shell/browser/api/electron_api_cookies.cc

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

Co-authored-by: Black-Hole <158blackhole@gmail.com>

* chore: re-enable worker spec failures (#37015)

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-02-15 12:38:01 +01:00
trop[bot]
91776c5484 docs: add win.isFocusable() return type (#37260)
docs: fix `win.isFocusable()` return type

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Andrew Ferreira <andrew.shien2@gmail.com>
2023-02-15 11:52:11 +01:00
trop[bot]
1a48e36313 fix: BrowserView crash when 'beforeunload' prevented (#37268)
fix: crash when beforeunload prevented

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-02-14 20:54:52 +01:00
trop[bot]
97c66e5985 refactor: simplify Node.js event loop with SpinEventLoop (#37258)
refactor: simplify Node.js event loop with SpinEventLoop

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-02-14 18:42:05 +01:00
trop[bot]
4ce69207b0 build: set make_latest correctly on published releases (#37242)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-02-13 14:47:26 +01:00
trop[bot]
cf4f6285c8 chore: update https://cs.chromium.org/ links to https://source.chromium.org/ (#37234)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-02-13 16:32:32 +09:00
trop[bot]
253a60f8ae ci: update appveyor build agent (#37229)
ci update appveyor image

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-02-11 19:20:22 -05:00
607 changed files with 14920 additions and 5529 deletions

View File

@@ -51,7 +51,7 @@ jobs:
steps:
- checkout
- path-filtering/set-parameters:
base-revision: main
base-revision: origin/24-x-y
mapping: |
^((?!docs/).)*$ run-build-mac true
^((?!docs/).)*$ run-build-linux true
@@ -65,6 +65,9 @@ jobs:
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | DESTDIR=$CIRCLECI_BINARY bash
node build.js
name: Pack config.yml
- run:
name: Set params
command: node .circleci/config/params.js
- continuation/continue:
configuration_path: .circleci/config-staging/built.yml
parameters: /tmp/pipeline-parameters.json

View File

@@ -35,6 +35,16 @@ parameters:
default: all
enum: ["all", "osx-x64", "osx-arm64", "mas-x64", "mas-arm64"]
medium-linux-executor:
type: enum
default: electronjs/aks-linux-medium
enum: ["electronjs/aks-linux-medium", "medium"]
large-linux-executor:
type: enum
default: electronjs/aks-linux-large
enum: ["electronjs/aks-linux-large", "2xlarge"]
# Executors
executors:
linux-docker:
@@ -42,7 +52,9 @@ executors:
size:
description: "Docker executor size"
type: enum
enum: ["medium", "xlarge", "2xlarge"]
# aks-linux-large === 32 core
# 2xlarge should not be used directly, use the pipeline param instead
enum: ["medium", "electronjs/aks-linux-medium", "xlarge", "electronjs/aks-linux-large", "2xlarge"]
docker:
- image: ghcr.io/electron/build:e6bebd08a51a0d78ec23e5b3fd7e7c0846412328
resource_class: << parameters.size >>
@@ -54,7 +66,7 @@ executors:
type: enum
enum: ["macos.x86.medium.gen2", "large"]
macos:
xcode: 13.3.0
xcode: 14.0.0
resource_class: << parameters.size >>
# Electron Runners
@@ -108,7 +120,7 @@ env-unittests: &env-unittests
TESTS_CONFIG: src/electron/spec/configs/unittests.yml
env-arm: &env-arm
GN_EXTRA_ARGS: 'target_cpu = "arm"'
GN_EXTRA_ARGS: 'target_cpu = "arm" clang_use_chrome_plugins = false'
MKSNAPSHOT_TOOLCHAIN: //build/toolchain/linux:clang_arm
BUILD_NATIVE_MKSNAPSHOT: 1
TARGET_ARCH: arm
@@ -245,14 +257,27 @@ step-depot-tools-get: &step-depot-tools-get
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Remove swift-format dep from cipd on macOS until we send a patch upstream.
cd depot_tools
patch gclient.py -R \<<'EOF'
676,677c676
< packages = dep_value.get('packages', [])
< for package in (x for x in packages if "infra/3pp/tools/swift-format" not in x.get('package')):
---
> for package in dep_value.get('packages', []):
cat > gclient.diff \<< 'EOF'
diff --git a/gclient.py b/gclient.py
index c305c248..e6e0fbdc 100755
--- a/gclient.py
+++ b/gclient.py
@@ -735,7 +735,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
if dep_type == 'cipd':
cipd_root = self.GetCipdRoot()
- for package in dep_value.get('packages', []):
+ packages = dep_value.get('packages', [])
+ for package in (x for x in packages if "infra/3pp/tools/swift-format" not in x.get('package')):
deps_to_add.append(
CipdDependency(parent=self,
name=name,
EOF
git apply --3way gclient.diff
fi
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
touch .disable_auto_update
step-depot-tools-add-to-path: &step-depot-tools-add-to-path
run:
@@ -274,7 +299,7 @@ step-gclient-sync: &step-gclient-sync
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags
if [ "$IS_RELEASE" != "true" ]; then
# Re-export all the patches to check if there were changes.
python src/electron/script/export_all_patches.py src/electron/patches/config.json
python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
cd src/electron
git update-index --refresh || true
if ! git diff-index --quiet HEAD --; then
@@ -328,13 +353,13 @@ step-setup-goma-for-build: &step-setup-goma-for-build
mkdir third_party
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
export GOMA_FALLBACK_ON_AUTH_FAILURE=true
third_party/goma/goma_ctl.py ensure_start
if [ ! -z "$RAW_GOMA_AUTH" ] && [ "`third_party/goma/goma_auth.py info`" != "Login as Fermi Planck" ]; then
python3 third_party/goma/goma_ctl.py ensure_start
if [ ! -z "$RAW_GOMA_AUTH" ] && [ "`python3 third_party/goma/goma_auth.py info`" != "Login as Fermi Planck" ]; then
echo "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token."
exit 1
fi
echo 'export GN_GOMA_FILE='`node -e "console.log(require('./src/utils/goma.js').gnFilePath)"` >> $BASH_ENV
echo 'export LOCAL_GOMA_DIR='`node -e "console.log(require('./src/utils/goma.js').dir)"` >> $BASH_ENV
echo 'export GOMA_DIR='`node -e "console.log(require('./src/utils/goma.js').dir)"` >> $BASH_ENV
echo 'export GOMA_FALLBACK_ON_AUTH_FAILURE=true' >> $BASH_ENV
cd ..
touch "${TMPDIR:=/tmp}"/.goma-ready
@@ -357,14 +382,14 @@ step-restore-brew-cache: &step-restore-brew-cache
- /usr/local/Cellar/gnu-tar
- /usr/local/bin/gtar
keys:
- v5-brew-cache-{{ arch }}
- v7-brew-cache-{{ arch }}
step-save-brew-cache: &step-save-brew-cache
save_cache:
paths:
- /usr/local/Cellar/gnu-tar
- /usr/local/bin/gtar
key: v5-brew-cache-{{ arch }}
key: v7-brew-cache-{{ arch }}
name: Persisting brew cache
step-get-more-space-on-mac: &step-get-more-space-on-mac
@@ -413,6 +438,15 @@ step-get-more-space-on-mac: &step-get-more-space-on-mac
tmpify ~/.rubies
tmpify ~/Library/Caches/Homebrew
tmpify /usr/local/Homebrew
# the contents of build/linux/strip_binary.gni aren't used, but
# https://chromium-review.googlesource.com/c/chromium/src/+/4278307
# needs the file to exist.
mv ~/project/src/build/linux/strip_binary.gni "${TMPDIR}"/
tmpify ~/project/src/build/linux/
mkdir -p ~/project/src/build/linux
mv "${TMPDIR}/strip_binary.gni" ~/project/src/build/linux/
sudo rm -rf $TMPDIR/del-target
# sudo rm -rf "/System/Library/Desktop Pictures"
@@ -434,7 +468,6 @@ step-get-more-space-on-mac: &step-get-more-space-on-mac
# sudo rm -rf /System/Library/PreferencePanes
# sudo rm -rf /System/Library/AssetsV2/*
sudo rm -rf /Applications/Safari.app
sudo rm -rf ~/project/src/build/linux
sudo rm -rf ~/project/src/third_party/catapult/tracing/test_data
sudo rm -rf ~/project/src/third_party/angle/third_party/VK-GL-CTS
@@ -516,6 +549,18 @@ step-fix-sync: &step-fix-sync
mv .git/config.backup .git/config
git fetch
step-fix-clang: &step-fix-clang
run:
name: Fix Clang on 32-bit Linux ARM
command: |
if [ "$TARGET_ARCH" == "arm" ]; then
# The following custom clang needed on 32-bit Linux ARM due to https://crbug.com/1431201.
# Once https://crbug.com/1425409 has been resolved this workaround can be remove
cd src/third_party/llvm-build/Release+Asserts
curl -O https://dev-cdn.electronjs.org/clang/clang-llvmorg-17-init-4759-g547e3456-2.tar.xz
tar xvf clang-llvmorg-17-init-4759-g547e3456-2.tar.xz
fi
step-install-signing-cert-on-mac: &step-install-signing-cert-on-mac
run:
name: Import and trust self-signed codesigning cert on MacOS
@@ -667,9 +712,9 @@ step-verify-mksnapshot: &step-verify-mksnapshot
if [ "$IS_ASAN" != "1" ]; then
cd src
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/cross-arch-snapshots
python3 electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/cross-arch-snapshots
else
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default
python3 electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default
fi
fi
@@ -679,7 +724,7 @@ step-verify-chromedriver: &step-verify-chromedriver
command: |
if [ "$IS_ASAN" != "1" ]; then
cd src
python electron/script/verify-chromedriver.py --source-root "$PWD" --build-dir out/Default
python3 electron/script/verify-chromedriver.py --source-root "$PWD" --build-dir out/Default
fi
step-setup-linux-for-headless-testing: &step-setup-linux-for-headless-testing
@@ -697,8 +742,8 @@ step-show-goma-stats: &step-show-goma-stats
command: |
set +e
set +o pipefail
$LOCAL_GOMA_DIR/goma_ctl.py stat
$LOCAL_GOMA_DIR/diagnose_goma_log.py
$GOMA_DIR/goma_ctl.py stat
$GOMA_DIR/diagnose_goma_log.py
true
when: always
background: true
@@ -805,7 +850,7 @@ step-maybe-cross-arch-snapshot: &step-maybe-cross-arch-snapshot
elif [ "`uname`" == "Darwin" ]; then
cp "out/Default/$MKSNAPSHOT_PATH/libffmpeg.dylib" out/Default
fi
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --create-snapshot-only
python3 electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --create-snapshot-only
mkdir cross-arch-snapshots
cp out/Default-mksnapshot-test/*.bin cross-arch-snapshots
# Clean up so that ninja does not get confused
@@ -850,14 +895,26 @@ step-touch-sync-done: &step-touch-sync-done
step-maybe-restore-src-cache: &step-maybe-restore-src-cache
restore_cache:
keys:
- v16-src-cache-{{ checksum "src/electron/.depshash" }}
- v17-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:
- v16-src-cache-marker-{{ checksum "src/electron/.depshash" }}
- v17-src-cache-marker-{{ checksum "src/electron/.depshash" }}
name: Restoring src cache marker
step-maybe-restore-src-cache-aks: &step-maybe-restore-src-cache-aks
restore_cache_aks:
step-name: Restoring src cache
cache_key: v17-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
cache_path: /var/portal
step-maybe-restore-src-cache-marker-aks: &step-maybe-restore-src-cache-marker-aks
restore_cache_aks:
step-name: Restoring src cache marker
cache_key: v17-src-cache-marker-$(shasum src/electron/.depshash | cut -f1 -d' ')
cache_path: "."
# Restore exact or closest git cache based on the hash of DEPS and .circle-sync-done
# If the src cache was restored above then this will match an empty cache
# If the src cache was not restored above then this will match a close git cache
@@ -870,6 +927,12 @@ step-maybe-restore-git-cache: &step-maybe-restore-git-cache
- v1-git-cache-{{ checksum "src/electron/.circle-sync-done" }}
name: Conditionally restoring git cache
step-maybe-restore-git-cache-aks: &step-maybe-restore-git-cache-aks
restore_cache_aks:
step-name: Conditionally restoring git cache (aks)
cache_key: v1-git-cache-$(shasum src/electron/.circle-sync-done | cut -f1 -d' ')-$(shasum src/electron/DEPS | cut -f1 -d' ') v1-git-cache-$(shasum src/electron/.circle-sync-done | cut -f1 -d' ')
cache_path: git-cache
step-set-git-cache-path: &step-set-git-cache-path
run:
name: Set GIT_CACHE_PATH to make gclient to use the cache
@@ -887,6 +950,12 @@ step-save-git-cache: &step-save-git-cache
key: v1-git-cache-{{ checksum "src/electron/.circle-sync-done" }}-{{ checksum "src/electron/DEPS" }}
name: Persisting git cache
step-save-git-cache-aks: &step-save-git-cache-aks
save_cache_aks:
step-name: Persisting git cache (AKS)
cache_key: v1-git-cache-$(shasum src/electron/.circle-sync-done | cut -f1 -d' ')-$(shasum src/electron/DEPS | cut -f1 -d' ')
cache_path: git-cache
step-run-electron-only-hooks: &step-run-electron-only-hooks
run:
name: Run Electron Only Hooks
@@ -924,7 +993,7 @@ step-save-src-cache: &step-save-src-cache
save_cache:
paths:
- /var/portal
key: v16-src-cache-{{ checksum "/var/portal/src/electron/.depshash" }}
key: v17-src-cache-{{ checksum "/var/portal/src/electron/.depshash" }}
name: Persisting src cache
step-make-src-cache-marker: &step-make-src-cache-marker
run:
@@ -934,7 +1003,17 @@ step-save-src-cache-marker: &step-save-src-cache-marker
save_cache:
paths:
- .src-cache-marker
key: v16-src-cache-marker-{{ checksum "/var/portal/src/electron/.depshash" }}
key: v17-src-cache-marker-{{ checksum "/var/portal/src/electron/.depshash" }}
step-save-src-cache-aks: &step-save-src-cache-aks
save_cache_aks:
step-name: Persisting src cache (aks)
cache_key: v17-src-cache-$(shasum /var/portal/src/electron/.depshash | cut -f1 -d' ')
cache_path: /var/portal
step-save-src-cache-marker-aks: &step-save-src-cache-marker-aks
save_cache_aks:
step-name: Persisting src cache marker (aks)
cache_key: v17-src-cache-marker-$(shasum /var/portal/src/electron/.depshash | cut -f1 -d' ')
cache_path: .src-cache-marker
step-maybe-early-exit-no-doc-change: &step-maybe-early-exit-no-doc-change
run:
@@ -960,29 +1039,6 @@ step-ts-compile: &step-ts-compile
done
# List of all steps.
steps-electron-gn-check: &steps-electron-gn-check
steps:
- *step-checkout-electron
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- install-python2-mac
- *step-setup-env-for-build
- *step-setup-goma-for-build
- *step-generate-deps-hash
- *step-touch-sync-done
- maybe-restore-portaled-src-cache
- run:
name: Ensure src checkout worked
command: |
if [ ! -d "src/third_party/blink" ]; then
echo src cache was not restored for an unknown reason
exit 1
fi
- run:
name: Wipe Electron
command: rm -rf src/electron
- *step-checkout-electron
steps-electron-ts-compile-for-doc-change: &steps-electron-ts-compile-for-doc-change
steps:
# Checkout - Copied from steps-checkout
@@ -994,36 +1050,92 @@ steps-electron-ts-compile-for-doc-change: &steps-electron-ts-compile-for-doc-cha
# Command Aliases
commands:
install-python2-mac:
aks-specific-step:
parameters:
circle:
type: steps
aks:
type: steps
could-be-aks:
type: boolean
description: Only set this to true on linux hosts
steps:
- when:
condition:
or:
- equal: [<< parameters.could-be-aks >>, false]
- equal: [<< pipeline.parameters.large-linux-executor >>, 2xlarge]
steps: << parameters.circle >>
- when:
condition:
and:
- equal: [<< parameters.could-be-aks >>, true]
- equal: [<< pipeline.parameters.large-linux-executor >>, electronjs/aks-linux-large]
steps: << parameters.aks >>
save_cache_aks:
parameters:
step-name:
type: string
cache_key:
type: string
cache_path:
type: string
steps:
- restore_cache:
keys:
- v2.7.18-python-cache-{{ arch }}
name: Restore python cache
- run:
name: Install python2 on macos
name: << parameters.step-name >>
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
cache_key="<< parameters.cache_key >>"
final_cache_path=/mnt/cross-instance-cache/${cache_key}.tar
echo "Using cache key: $cache_key"
echo "Checking path: $final_cache_path"
if [ ! -f "$final_cache_path" ]; then
echo "Cache key not founding, storing tarball"
tmp_container=/mnt/cross-instance-cache/tmp/$CIRCLE_WORKFLOW_JOB_ID
tmp_cache_path=$tmp_container/${cache_key}.tar
mkdir -p $tmp_container
if [ -f "<< parameters.cache_path >>" ]; then
tar -cf $tmp_cache_path -C $(dirname << parameters.cache_path >>) ./$(basename << parameters.cache_path >>)
else
echo 'Using Python install from cache'
tar -cf $tmp_cache_path -C << parameters.cache_path >>/ ./
fi
sudo installer -pkg python-downloads/python-2.7.18-macosx10.9.pkg -target /
mv -vn $tmp_cache_path $final_cache_path
rm -rf $tmp_container
else
echo "Cache key already exists, skipping.."
fi
- save_cache:
paths:
- python-downloads
key: v2.7.18-python-cache-{{ arch }}
name: Persisting python cache
restore_cache_aks:
parameters:
step-name:
type: string
cache_key:
type: string
cache_path:
type: string
steps:
- run:
name: << parameters.step-name >>
command: |
df -h
for cache_key in << parameters.cache_key >>; do
cache_path=/mnt/cross-instance-cache/${cache_key}.tar
echo "Using cache key: $cache_key"
echo "Checking path: $cache_path"
if [ ! -f "$cache_path" ]; then
echo "Cache key not found, nothing to restore..."
else
echo "Cache key found, restoring to path..."
mkdir -p << parameters.cache_path >>/
tar -xf /mnt/cross-instance-cache/${cache_key}.tar -C << parameters.cache_path >>/
exit 0
fi
done
maybe-restore-portaled-src-cache:
parameters:
halt-if-successful:
type: boolean
default: false
could-be-aks:
type: boolean
steps:
- run:
name: Prepare for cross-OS sync restore
@@ -1033,34 +1145,59 @@ commands:
- when:
condition: << parameters.halt-if-successful >>
steps:
- *step-maybe-restore-src-cache-marker
- aks-specific-step:
circle:
- *step-maybe-restore-src-cache-marker
aks:
- *step-maybe-restore-src-cache-marker-aks
could-be-aks: << parameters.could-be-aks >>
- run:
name: Halt the job early if the src cache exists
command: |
if [ -f ".src-cache-marker" ]; then
circleci-agent step halt
fi
- *step-maybe-restore-src-cache
- aks-specific-step:
circle:
- *step-maybe-restore-src-cache
aks:
- *step-maybe-restore-src-cache-aks
could-be-aks: << parameters.could-be-aks >>
- run:
name: Fix the src cache restore point on macOS
name: Fix the src cache restore point
command: |
if [ -d "/var/portal/src" ]; then
echo Relocating Cache
rm -rf src
mv /var/portal/src ./
fi
run-gn-check:
parameters:
could-be-aks:
type: boolean
steps:
- *step-setup-goma-for-build
- checkout-from-cache:
could-be-aks: << parameters.could-be-aks >>
- *step-setup-env-for-build
- *step-wait-for-goma
- *step-gn-gen-default
- *step-gn-check
build_and_save_artifacts:
parameters:
artifact-key:
type: string
build-type:
type: string
build-nonproprietary-ffmpeg:
type: boolean
default: true
steps:
- *step-gn-gen-default
- *step-fix-clang
- ninja_build_electron:
clean-prebuilt-snapshot: false
build-type: << parameters.build-type >>
- *step-maybe-electron-dist-strip
- step-electron-dist-build:
additional-targets: shell_browser_ui_unittests third_party/electron_node:headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
@@ -1160,12 +1297,16 @@ commands:
mv_if_exist cross-arch-snapshots src
checkout-from-cache:
parameters:
could-be-aks:
type: boolean
steps:
- *step-checkout-electron
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-generate-deps-hash
- maybe-restore-portaled-src-cache
- maybe-restore-portaled-src-cache:
could-be-aks: << parameters.could-be-aks >>
- run:
name: Ensure src checkout worked
command: |
@@ -1222,9 +1363,12 @@ commands:
clean-prebuilt-snapshot:
type: boolean
default: true
build-type:
type: string
steps:
- run:
name: Electron build
name: Electron << parameters.build-type >> build
no_output_timeout: 60m
command: |
cd src
@@ -1292,12 +1436,16 @@ commands:
default: true
artifact-key:
type: string
build-type:
type: string
after-build-and-save:
type: steps
default: []
after-persist:
type: steps
default: []
could-be-aks:
type: boolean
steps:
- when:
condition: << parameters.attach >>
@@ -1307,7 +1455,6 @@ commands:
- run: rm -rf src/electron
- *step-restore-brew-cache
- *step-install-gnutar-on-mac
- install-python2-mac
- *step-save-brew-cache
- when:
condition: << parameters.build >>
@@ -1316,7 +1463,8 @@ commands:
- when:
condition: << parameters.checkout-and-assume-cache >>
steps:
- checkout-from-cache
- checkout-from-cache:
could-be-aks: << parameters.could-be-aks >>
- when:
condition: << parameters.checkout >>
steps:
@@ -1332,8 +1480,15 @@ commands:
steps:
- maybe-restore-portaled-src-cache:
halt-if-successful: << parameters.checkout-to-create-src-cache >>
- *step-maybe-restore-git-cache
could-be-aks: << parameters.could-be-aks >>
- aks-specific-step:
circle:
- *step-maybe-restore-git-cache
aks:
- *step-maybe-restore-git-cache-aks
could-be-aks: << parameters.could-be-aks >>
- *step-set-git-cache-path
- *step-fix-known-hosts-linux
# This sync call only runs if .circle-sync-done is an EMPTY file
- *step-gclient-sync
- store_artifacts:
@@ -1349,7 +1504,12 @@ commands:
- when:
condition: << parameters.save-git-cache >>
steps:
- *step-save-git-cache
- aks-specific-step:
circle:
- *step-save-git-cache
aks:
- *step-save-git-cache-aks
could-be-aks: << parameters.could-be-aks >>
# Mark sync as done _after_ saving the git cache so that it is uploaded
# only when the src cache was not present
# Their are theoretically two cases for this cache key
@@ -1399,9 +1559,19 @@ commands:
sudo mkdir -p /var/portal
sudo chown -R $(id -u):$(id -g) /var/portal
mv ./src /var/portal
- *step-save-src-cache
- aks-specific-step:
circle:
- *step-save-src-cache
aks:
- *step-save-src-cache-aks
could-be-aks: << parameters.could-be-aks >>
- *step-make-src-cache-marker
- *step-save-src-cache-marker
- aks-specific-step:
circle:
- *step-save-src-cache-marker
aks:
- *step-save-src-cache-marker-aks
could-be-aks: << parameters.could-be-aks >>
- when:
condition: << parameters.build >>
@@ -1418,6 +1588,7 @@ commands:
steps:
- build_and_save_artifacts:
artifact-key: << parameters.artifact-key >>
build-type: << parameters.build-type >>
build-nonproprietary-ffmpeg: << parameters.build-nonproprietary-ffmpeg >>
- steps: << parameters.after-build-and-save >>
@@ -1452,6 +1623,18 @@ commands:
condition: << parameters.build >>
steps:
- *step-maybe-notify-slack-failure
- when:
condition: << parameters.could-be-aks >>
steps:
- run:
name: Wait for active debug sessions
command: |
while [ -f /var/.ssh-lock ]
do
sleep 60
done
no_output_timeout: 2h
when: always
electron-tests:
parameters:
@@ -1467,7 +1650,6 @@ commands:
- *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:
@@ -1563,6 +1745,8 @@ commands:
checkout:
type: boolean
default: true
build-type:
type: string
steps:
- when:
condition: << parameters.attach >>
@@ -1575,7 +1759,6 @@ commands:
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-restore-brew-cache
- install-python2-mac
- *step-get-more-space-on-mac
- when:
condition: << parameters.checkout >>
@@ -1589,12 +1772,15 @@ commands:
- *step-minimize-workspace-size-from-checkout
- *step-fix-sync
- *step-setup-env-for-build
- *step-fix-known-hosts-linux
- *step-setup-goma-for-build
- *step-wait-for-goma
- *step-gn-gen-default
- *step-fix-clang
# Electron app
- ninja_build_electron
- ninja_build_electron:
build-type: << parameters.build-type >>
- *step-show-goma-stats
- *step-maybe-generate-breakpad-symbols
- *step-maybe-electron-dist-strip
@@ -1645,7 +1831,7 @@ jobs:
linux-make-src-cache:
executor:
name: linux-docker
size: xlarge
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-linux-2xlarge
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
@@ -1657,6 +1843,8 @@ jobs:
save-git-cache: true
checkout-to-create-src-cache: true
artifact-key: 'nil'
build-type: 'nil'
could-be-aks: true
mac-checkout:
executor:
@@ -1675,6 +1863,8 @@ jobs:
persist-checkout: true
restore-src-cache: false
artifact-key: 'nil'
build-type: 'nil'
could-be-aks: false
mac-make-src-cache:
executor:
@@ -1693,12 +1883,14 @@ jobs:
save-git-cache: true
checkout-to-create-src-cache: true
artifact-key: 'nil'
build-type: 'nil'
could-be-aks: false
# Layer 2: Builds.
linux-x64-testing:
executor:
name: linux-docker
size: xlarge
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-global
<<: *env-testing-build
@@ -1710,11 +1902,13 @@ jobs:
checkout: false
checkout-and-assume-cache: true
artifact-key: 'linux-x64'
build-type: 'Linux'
could-be-aks: true
linux-x64-testing-asan:
executor:
name: linux-docker
size: 2xlarge
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-global
<<: *env-testing-build
@@ -1725,14 +1919,17 @@ jobs:
steps:
- electron-build:
persist: true
checkout: true
checkout: false
checkout-and-assume-cache: true
build-nonproprietary-ffmpeg: false
artifact-key: 'linux-x64-asan'
build-type: 'Linux'
could-be-aks: true
linux-x64-testing-no-run-as-node:
executor:
name: linux-docker
size: xlarge
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-linux-2xlarge
<<: *env-testing-build
@@ -1744,21 +1941,25 @@ jobs:
persist: false
checkout: true
artifact-key: 'linux-x64-no-run-as-node'
build-type: 'Linux'
could-be-aks: true
linux-x64-testing-gn-check:
executor:
name: linux-docker
size: medium
size: << pipeline.parameters.medium-linux-executor >>
environment:
<<: *env-linux-medium
<<: *env-testing-build
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
<<: *steps-electron-gn-check
steps:
- run-gn-check:
could-be-aks: true
linux-x64-publish:
executor:
name: linux-docker
size: 2xlarge
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-linux-2xlarge-release
<<: *env-release-build
@@ -1775,12 +1976,13 @@ jobs:
- electron-publish:
attach: false
checkout: true
build-type: 'Linux'
linux-arm-testing:
executor:
name: linux-docker
size: 2xlarge
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-global
<<: *env-arm
@@ -1795,11 +1997,13 @@ jobs:
checkout: false
checkout-and-assume-cache: true
artifact-key: 'linux-arm'
build-type: 'Linux ARM'
could-be-aks: true
linux-arm-publish:
executor:
name: linux-docker
size: 2xlarge
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-linux-2xlarge-release
<<: *env-arm
@@ -1819,11 +2023,12 @@ jobs:
- electron-publish:
attach: false
checkout: true
build-type: 'Linux ARM'
linux-arm64-testing:
executor:
name: linux-docker
size: 2xlarge
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-global
<<: *env-arm64
@@ -1838,22 +2043,26 @@ jobs:
checkout: false
checkout-and-assume-cache: true
artifact-key: 'linux-arm64'
build-type: 'Linux ARM64'
could-be-aks: true
linux-arm64-testing-gn-check:
executor:
name: linux-docker
size: medium
size: << pipeline.parameters.medium-linux-executor >>
environment:
<<: *env-linux-medium
<<: *env-arm64
<<: *env-testing-build
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
<<: *steps-electron-gn-check
steps:
- run-gn-check:
could-be-aks: true
linux-arm64-publish:
executor:
name: linux-docker
size: 2xlarge
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-linux-2xlarge-release
<<: *env-arm64
@@ -1872,6 +2081,7 @@ jobs:
- electron-publish:
attach: false
checkout: true
build-type: 'Linux ARM64'
osx-testing-x64:
executor:
@@ -1890,6 +2100,7 @@ jobs:
checkout-and-assume-cache: true
attach: true
artifact-key: 'darwin-x64'
build-type: 'Darwin'
after-build-and-save:
- run:
name: Configuring MAS build
@@ -1900,11 +2111,13 @@ jobs:
rm -rf src/out/Default/Electron*.app
- build_and_save_artifacts:
artifact-key: 'mas-x64'
build-type: 'MAS'
after-persist:
- persist_to_workspace:
root: .
paths:
- generated_artifacts_mas-x64
could-be-aks: false
osx-testing-x64-gn-check:
executor:
@@ -1914,7 +2127,9 @@ jobs:
<<: *env-machine-mac
<<: *env-testing-build
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
<<: *steps-electron-gn-check
steps:
- run-gn-check:
could-be-aks: false
osx-publish-x64:
executor:
@@ -1936,6 +2151,7 @@ jobs:
- electron-publish:
attach: true
checkout: false
build-type: 'Darwin'
osx-publish-arm64:
executor:
@@ -1958,6 +2174,7 @@ jobs:
- electron-publish:
attach: true
checkout: false
build-type: 'Darwin ARM64'
osx-testing-arm64:
executor:
@@ -1978,6 +2195,7 @@ jobs:
checkout-and-assume-cache: true
attach: true
artifact-key: 'darwin-arm64'
build-type: 'Darwin ARM64'
after-build-and-save:
- run:
name: Configuring MAS build
@@ -1988,11 +2206,13 @@ jobs:
rm -rf src/out/Default/Electron*.app
- build_and_save_artifacts:
artifact-key: 'mas-arm64'
build-type: 'MAS ARM64'
after-persist:
- persist_to_workspace:
root: .
paths:
- generated_artifacts_mas-arm64
could-be-aks: false
mas-publish-x64:
executor:
@@ -2014,6 +2234,7 @@ jobs:
- electron-publish:
attach: true
checkout: false
build-type: 'MAS'
mas-publish-arm64:
executor:
@@ -2036,6 +2257,7 @@ jobs:
- electron-publish:
attach: true
checkout: false
build-type: 'MAS ARM64'
# Layer 3: Tests.
linux-x64-testing-tests:

View File

@@ -0,0 +1,12 @@
const fs = require('fs');
const PARAMS_PATH = '/tmp/pipeline-parameters.json';
const content = JSON.parse(fs.readFileSync(PARAMS_PATH, 'utf-8'));
// Choose resource class for linux hosts
const currentBranch = process.env.CIRCLE_BRANCH || '';
content['large-linux-executor'] = /^pull\/[0-9-]+$/.test(currentBranch) ? '2xlarge' : 'electronjs/aks-linux-large';
content['medium-linux-executor'] = /^pull\/[0-9-]+$/.test(currentBranch) ? 'medium' : 'electronjs/aks-linux-medium';
fs.writeFileSync(PARAMS_PATH, JSON.stringify(content));

View File

@@ -3,5 +3,6 @@
set -e
mkdir -p ~/.ssh
echo "|1|B3r+7aO0/x90IdefihIjxIoJrrk=|OJddGDfhbuLFc1bUyy84hhIw57M= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
|1|rGlEvW55DtzNZp+pzw9gvyOyKi4=|LLWr+7qlkAlw3YGGVfLHHxB/kR0= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~/.ssh/known_hosts
echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=" >> ~/.ssh/known_hosts

View File

@@ -16,6 +16,8 @@ ln -s $buildtools_configs $buildtools/configs
# Write the gclient config if it does not already exist
if [ ! -f $gclient_root/.gclient ]; then
echo "Creating gclient config"
echo "solutions = [
{ \"name\" : \"src/electron\",
\"url\" : \"https://github.com/electron/electron\",
@@ -32,11 +34,18 @@ fi
# Write the default buildtools config file if it does
# not already exist
if [ ! -f $buildtools/configs/evm.testing.json ]; then
echo "Creating build-tools testing config"
write_config() {
echo "
{
\"root\": \"/workspaces/gclient\",
\"goma\": \"$1\",
\"root\": \"/workspaces/gclient\",
\"remotes\": {
\"electron\": {
\"origin\": \"https://github.com/electron/electron.git\"
}
}
\"gen\": {
\"args\": [
\"import(\\\"//electron/build/args/testing.gn\\\")\",
@@ -48,11 +57,7 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
\"CHROMIUM_BUILDTOOLS_PATH\": \"/workspaces/gclient/src/buildtools\",
\"GIT_CACHE_PATH\": \"/workspaces/gclient/.git-cache\"
},
\"remotes\": {
\"electron\": {
\"origin\": \"https://github.com/electron/electron.git\"
}
}
\"\$schema\": \"file:///home/builduser/.electron_build_tools/evm-config.schema.json\"
}
" >$buildtools/configs/evm.testing.json
}
@@ -66,10 +71,12 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
# if it works we can use the goma cluster
export NOTGOMA_CODESPACES_TOKEN=$GITHUB_TOKEN
if e d goma_auth login; then
echo "$GITHUB_USER has GOMA access - switching to cluster mode"
write_config cluster
fi
else
# Even if the config file existed we still need to re-auth with the goma
# cluster
echo "build-tools testing config already exists"
# Re-auth with the goma cluster regardless.
NOTGOMA_CODESPACES_TOKEN=$GITHUB_TOKEN e d goma_auth login || true
fi

View File

@@ -1,29 +1,3 @@
{
"commands-show-output": false,
"first-line-h1": false,
"header-increment": false,
"line-length": {
"code_blocks": false,
"tables": false,
"stern": true,
"line_length": -1
},
"no-bare-urls": false,
"no-blanks-blockquote": false,
"no-duplicate-header": {
"allow_different_nesting": true
},
"no-emphasis-as-header": false,
"no-hard-tabs": {
"code_blocks": false
},
"no-space-in-emphasis": false,
"no-trailing-punctuation": false,
"no-trailing-spaces": {
"br_spaces": 0
},
"single-h1": false,
"no-inline-html": false,
"emphasis-style": false,
"strong-style": false
}
{
"extends": "@electron/lint-roller/configs/markdownlint.json"
}

View File

@@ -1277,7 +1277,7 @@ if (is_mac) {
]
deps += [
"//components/browser_watcher:browser_watcher_client",
"//chrome/app:exit_code_watcher",
"//components/crash/core/app:run_as_crashpad_handler",
]

View File

@@ -28,7 +28,7 @@ _If an issue has been closed and you still feel it's relevant, feel free to ping
### Languages
We accept issues in *any* language.
We accept issues in _any_ language.
When an issue is posted in a language besides English, it is acceptable and encouraged to post an English-translated copy as a reply.
Anyone may post the translated reply.
In most cases, a quick pass through translation software is sufficient.

12
DEPS
View File

@@ -2,13 +2,17 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'111.0.5560.0',
'112.0.5615.204',
'node_version':
'v18.14.0',
'nan_version':
'16fa32231e2ccd89d2804b3f765319128b20c4ac',
'squirrel.mac_version':
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',
'reactiveobjc_version':
'74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76',
'mantle_version':
'78d3966b3c331292ea29ec38661b25df0a245948',
'pyyaml_version': '3.12',
@@ -17,6 +21,8 @@ vars = {
'nodejs_git': 'https://github.com/nodejs',
'yaml_git': 'https://github.com/yaml',
'squirrel_git': 'https://github.com/Squirrel',
'reactiveobjc_git': 'https://github.com/ReactiveCocoa',
'mantle_git': 'https://github.com/Mantle',
# KEEP IN SYNC WITH utils.js FILE
'yarn_version': '1.15.2',
@@ -87,11 +93,11 @@ deps = {
'condition': 'process_deps',
},
'src/third_party/squirrel.mac/vendor/ReactiveObjC': {
'url': 'https://github.com/ReactiveCocoa/ReactiveObjC.git@74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76',
'url': Var("reactiveobjc_git") + '/ReactiveObjC.git@' + Var("reactiveobjc_version"),
'condition': 'process_deps'
},
'src/third_party/squirrel.mac/vendor/Mantle': {
'url': 'https://github.com/Mantle/Mantle.git@78d3966b3c331292ea29ec38661b25df0a245948',
'url': Var("mantle_git") + '/Mantle.git@' + Var("mantle_version"),
'condition': 'process_deps',
}
}

View File

@@ -6,7 +6,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-110.0.5451.0
image: e-112.0.5615.29
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
@@ -16,22 +16,58 @@ environment:
GOMA_FALLBACK_ON_AUTH_FAILURE: true
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
PYTHONIOENCODING: UTF-8
# Uncomment these lines and set APPVEYOR_RDP_PASSWORD in project settings to enable RDP before bake begins
# install:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# init:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - appveyor version
# - ps: $ErrorActionPreference = 'Stop'
# - ps: 'Write-Host "OS Build: $((Get-CimInstance Win32_OperatingSystem).BuildNumber)"'
# clone_folder: '%USERPROFILE%\image-bake-scripts'
# clone_script:
# - ps: Invoke-WebRequest "https://github.com/appveyor/build-images/archive/1f90d94e74c8243c909a09b994e527584dfcb838.zip" -OutFile "$env:temp\scripts.zip"
# - ps: Expand-Archive -Path "$env:temp\scripts.zip" -DestinationPath "$env:temp\scripts" -Force
# - ps: Copy-Item -Path "$env:temp\scripts\build-images-1f90d94e74c8243c909a09b994e527584dfcb838\scripts\Windows\*" -Destination $env:APPVEYOR_BUILD_FOLDER -Recurse
build_script:
# Uncomment/change the following line if the hard drive/partition size needs to change
# - ps: Resize-Partition -DriveLetter C -Size (256GB) # ensure initial partition size
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# - ps: .\init_server.ps1
# - ps: .\extend_system_volume.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - appveyor version
# - ps: .\install_path_utils.ps1
# - ps: .\install_powershell_core.ps1
# - ps: .\install_powershell_get.ps1
# - ps: .\install_7zip.ps1
# - ps: .\install_chocolatey.ps1
# - ps: .\install_webpi.ps1
# - ps: .\install_nuget.ps1
# - ps: .\install_pstools.ps1
# - ps: .\install_git.ps1
# - ps: .\install_git_lfs.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# END LINES FOR COMPLETELY NEW IMAGE
- git config --global core.longpaths true
- cd ..
- ps: >-
if (-not (Test-Path -Path .\src)) {
New-Item -Path .\src -ItemType Directory
if (-not (Test-Path -Path C:\projects\src)) {
New-Item -Path C:\projects\src -ItemType Directory
}
- ps: git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- cd C:\projects\
- git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/electron/electron.git C:\projects\src\electron
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- update_depot_tools.bat
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
# Uncomment the following line if windows deps change
# - src\electron\script\setup-win-for-dev.bat
- >-
@@ -46,21 +82,27 @@ build_script:
- ps: Copy-Item -path .\.depshash -destination ..\.depshash
- ps: cd ..\..
- gclient sync --with_branch_heads --with_tags --nohooks
- ps: regsvr32 /s "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\DIA SDK\bin\amd64\msdia140.dll"
- ps: |
$env:appveyor_user = "appveyor"
- ps: regsvr32 /s "C:\Program Files\Microsoft Visual Studio\2022\Community\DIA SDK\bin\amd64\msdia140.dll"
- ps: set vs2022_install="C:\Program Files\Microsoft Visual Studio\2022\Community"
$env:appveyor_password = [Guid]::NewGuid().ToString('B')
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
Set-LocalUser -Name $env:appveyor_user -Password (ConvertTo-SecureString -AsPlainText $env:appveyor_password -Force) -PasswordNeverExpires:$true
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/build-images/master/scripts/Windows/enable_autologon.ps1'))
# - cd %USERPROFILE%\image-bake-scripts
# - appveyor version
# - ps: .\optimize_dotnet_runtime.ps1
# - ps: .\disable_windows_background_services.ps1
# - ps: .\enforce_windows_firewall.ps1
# - ps: .\cleanup_windows.ps1
# END LINES FOR COMPLETELY NEW IMAGE
on_image_bake:
- ps: >-
echo "Baking image: $env:APPVEYOR_BAKE_IMAGE at dir $PWD"
- ps: Remove-Item -Recurse -Force $pwd\depot_tools
- ps: Remove-Item -Recurse -Force $pwd\src\electron
- ps: Remove-Item -Recurse -Force C:\projects\depot_tools
- ps: Remove-Item -Recurse -Force C:\projects\src\electron
# Uncomment these lines and set APPVEYOR_RDP_PASSWORD in project settings to enable RDP after bake is done
#on_finish:
# - ps: >-
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# # on_finish:
# - ps: >-
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

View File

@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-111.0.5518.0
image: e-112.0.5615.29
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
@@ -49,6 +49,11 @@ environment:
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
@@ -66,11 +71,15 @@ for:
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
$global:LASTEXITCODE = 0
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
@@ -82,7 +91,9 @@ for:
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- ps: git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
@@ -105,7 +116,7 @@ for:
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
$goma_login = python3 $env:LOCAL_GOMA_DIR\goma_auth.py info
if ($goma_login -eq 'Login as Fermi Planck') {
Write-warning "Goma authentication is correct";
} else {
@@ -155,7 +166,7 @@ for:
- ninja -C out/Default electron:hunspell_dictionaries_zip
- ninja -C out/Default electron:electron_chromedriver_zip
- ninja -C out/Default third_party/electron_node:headers
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
- python3 %LOCAL_GOMA_DIR%\goma_ctl.py stat
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
@@ -176,6 +187,30 @@ for:
7z a pdb.zip out\Default\*.pdb
}
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
- ps: |
cd C:\projects\src
$missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only PR"
} else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif ($artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} else {
$artifact_file = "out\Default\$artifact_name"
}
if (-not(Test-Path $artifact_file)) {
Write-warning "$artifact_name is missing and cannot be added to artifacts"
$missing_artifacts = $true
}
}
}
if ($missing_artifacts) {
throw "Build failed due to missing artifacts"
}
deploy_script:
- cd electron
@@ -201,7 +236,7 @@ for:
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
@@ -220,11 +255,13 @@ for:
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
Write-warning "Skipping build for doc only change"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
$global:LASTEXITCODE = 0
- cd ..
- mkdir out\Default
- cd ..
@@ -232,7 +269,7 @@ for:
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','pdb.zip','electron.lib')
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build Arm on X64 Windows") {
$jobId = $job.jobId
@@ -244,10 +281,13 @@ for:
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
# Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
# 7z x -y -osrc pdb.zip
}
}
- ps: |
$out_default_zips = @('dist.zip','pdb.zip')
$out_default_zips = @('dist.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}

View File

@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-111.0.5560.0
image: e-112.0.5615.29
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
@@ -47,6 +47,11 @@ environment:
- job_name: Test
job_depends_on: Build
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
@@ -64,11 +69,15 @@ for:
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
$global:LASTEXITCODE = 0
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
@@ -80,7 +89,9 @@ for:
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- ps: git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
@@ -103,7 +114,7 @@ for:
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
$goma_login = python3 $env:LOCAL_GOMA_DIR\goma_auth.py info
if ($goma_login -eq 'Login as Fermi Planck') {
Write-warning "Goma authentication is correct";
} else {
@@ -153,7 +164,7 @@ for:
- ninja -C out/Default electron:hunspell_dictionaries_zip
- ninja -C out/Default electron:electron_chromedriver_zip
- ninja -C out/Default third_party/electron_node:headers
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
- python3 %LOCAL_GOMA_DIR%\goma_ctl.py stat
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
@@ -174,6 +185,30 @@ for:
7z a pdb.zip out\Default\*.pdb
}
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
- ps: |
cd C:\projects\src
$missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only PR"
} else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif ($artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} else {
$artifact_file = "out\Default\$artifact_name"
}
if (-not(Test-Path $artifact_file)) {
Write-warning "$artifact_name is missing and cannot be added to artifacts"
$missing_artifacts = $true
}
}
}
if ($missing_artifacts) {
throw "Build failed due to missing artifacts"
}
deploy_script:
- cd electron
@@ -199,7 +234,7 @@ for:
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
@@ -216,11 +251,13 @@ for:
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
Write-warning "Skipping build for doc only change"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
$global:LASTEXITCODE = 0
- cd ..
- mkdir out\Default
- cd ..
@@ -240,6 +277,9 @@ for:
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
# Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
# 7z x -y -osrc pdb.zip
}
}
- ps: |

View File

@@ -10,7 +10,13 @@ EXTENSIONS_TO_SKIP = [
'.mojom.js',
'.mojom-lite.js',
'.info',
'.m.js'
'.m.js',
# These are only needed for Chromium tests we don't run. Listed in
# 'extensions' because the mksnapshot zip has these under a subdirectory, and
# the PATHS_TO_SKIP is checked with |startswith|.
'dbgcore.dll',
'dbghelp.dll',
]
PATHS_TO_SKIP = [
@@ -34,7 +40,7 @@ PATHS_TO_SKIP = [
# Skip because these are outputs that we don't need.
'resources/inspector',
'gen/third_party/devtools-frontend/src',
'gen/ui/webui'
'gen/ui/webui',
]
def skip_path(dep, dist_zip, target_cpu):

View File

@@ -90,7 +90,6 @@ These individual tutorials expand on topics discussed in the guide above.
## API References
* [Synopsis](api/synopsis.md)
* [Process Object](api/process.md)
* [Supported Command Line Switches](api/command-line-switches.md)
* [Environment Variables](api/environment-variables.md)

View File

@@ -7,7 +7,7 @@ Process: [Main](../glossary.md#main-process)
The following example shows how to quit the application when the last window is
closed:
```javascript
```js
const { app } = require('electron')
app.on('window-all-closed', () => {
app.quit()
@@ -23,8 +23,7 @@ The `app` object emits the following events:
Emitted when the application has finished basic startup. On Windows and Linux,
the `will-finish-launching` event is the same as the `ready` event; on macOS,
this event represents the `applicationWillFinishLaunching` notification of
`NSApplication`. You would usually set up listeners for the `open-file` and
`open-url` events here, and start the crash reporter and auto updater.
`NSApplication`.
In most cases, you should do everything in the `ready` event handler.
@@ -64,7 +63,7 @@ Calling `event.preventDefault()` will prevent the default behavior, which is
terminating the application.
**Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
then `before-quit` is emitted *after* emitting `close` event on all windows and
then `before-quit` is emitted _after_ emitting `close` event on all windows and
closing them.
**Note:** On Windows, this event will not be emitted if the app is closed due
@@ -128,8 +127,6 @@ Emitted when the user wants to open a URL with the application. Your application
`Info.plist` file must define the URL scheme within the `CFBundleURLTypes` key, and
set `NSPrincipalClass` to `AtomApplication`.
You should call `event.preventDefault()` if you want to handle this event.
As with the `open-file` event, be sure to register a listener for the `open-url`
event early in your application startup to detect if the the application being
is being opened to handle a URL. If you register the listener in response to a
@@ -288,7 +285,7 @@ Emitted when failed to verify the `certificate` for `url`, to trust the
certificate you should prevent the default behavior with
`event.preventDefault()` and call `callback(true)`.
```javascript
```js
const { app } = require('electron')
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
@@ -320,7 +317,7 @@ and `callback` can be called with an entry filtered from the list. Using
`event.preventDefault()` prevents the application from using the first
certificate from the store.
```javascript
```js
const { app } = require('electron')
app.on('select-client-certificate', (event, webContents, url, list, callback) => {
@@ -353,7 +350,7 @@ The default behavior is to cancel all authentications. To override this you
should prevent the default behavior with `event.preventDefault()` and call
`callback(username, password)` with the credentials.
```javascript
```js
const { app } = require('electron')
app.on('login', (event, webContents, details, authInfo, callback) => {
@@ -405,18 +402,7 @@ Returns:
* `event` Event
* `webContents` [WebContents](web-contents.md)
* `details` Object
* `reason` string - The reason the render process is gone. Possible values:
* `clean-exit` - Process exited with an exit code of zero
* `abnormal-exit` - Process exited with a non-zero exit code
* `killed` - Process was sent a SIGTERM or otherwise killed externally
* `crashed` - Process crashed
* `oom` - Process ran out of memory
* `launch-failed` - Process never successfully launched
* `integrity-failure` - Windows code integrity checks failed
* `exitCode` Integer - The exit code of the process, unless `reason` is
`launch-failed`, in which case `exitCode` will be a platform-specific
launch failure error code.
* `details` [RenderProcessGoneDetails](structures/render-process-gone-details.md)
Emitted when the renderer process unexpectedly disappears. This is normally
because it was crashed or killed.
@@ -473,7 +459,7 @@ Returns:
Emitted when Electron has created a new `session`.
```javascript
```js
const { app } = require('electron')
app.on('session-created', (session) => {
@@ -558,7 +544,7 @@ started after current instance exited.
An example of restarting current instance immediately and adding a new command
line argument to the new instance:
```javascript
```js
const { app } = require('electron')
app.relaunch({ args: process.argv.slice(1).concat(['--relaunch']) })
@@ -754,14 +740,21 @@ This API can be used for purposes such as deciding what language to present the
Here are some examples of return values of the various language and locale APIs with different configurations:
* For Windows, where the application locale is German, the regional format is Finnish (Finland), and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish (Latin America):
* `app.getLocale()` returns `'de'`
* `app.getSystemLocale()` returns `'fi-FI'`
* `app.getPreferredSystemLanguages()` returns `['fr-CA', 'en-US', 'zh-Hans-CN', 'fi', 'es-419']`
* On macOS, where the application locale is German, the region is Finland, and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese, and Spanish (Latin America):
* `app.getLocale()` returns `'de'`
* `app.getSystemLocale()` returns `'fr-FI'`
* `app.getPreferredSystemLanguages()` returns `['fr-CA', 'en-US', 'zh-Hans-FI', 'es-419']`
On Windows, given application locale is German, the regional format is Finnish (Finland), and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish (Latin America):
```js
app.getLocale() // 'de'
app.getSystemLocale() // 'fi-FI'
app.getPreferredSystemLanguages() // ['fr-CA', 'en-US', 'zh-Hans-CN', 'fi', 'es-419']
```
On macOS, given the application locale is German, the region is Finland, and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese, and Spanish (Latin America):
```js
app.getLocale() // 'de'
app.getSystemLocale() // 'fr-FI'
app.getPreferredSystemLanguages() // ['fr-CA', 'en-US', 'zh-Hans-FI', 'es-419']
```
Both the available languages and regions and the possible return values differ between the two operating systems.
@@ -807,7 +800,7 @@ editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
**Note:** In a Windows Store environment (when packaged as an `appx`) this API
will return `true` for all calls but the registry key it sets won't be accessible
by other applications. In order to register your Windows Store application
as a default protocol handler you must [declare the protocol in your manifest](https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
as a default protocol handler you must [declare the protocol in your manifest](https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internally.
@@ -936,7 +929,7 @@ List, nor will it be displayed.
Here's a very simple example of creating a custom Jump List:
```javascript
```js
const { app } = require('electron')
app.setJumpList([
@@ -956,7 +949,7 @@ app.setJumpList([
title: 'Tool A',
program: process.execPath,
args: '--run-tool-a',
icon: process.execPath,
iconPath: process.execPath,
iconIndex: 0,
description: 'Runs Tool A'
},
@@ -965,7 +958,7 @@ app.setJumpList([
title: 'Tool B',
program: process.execPath,
args: '--run-tool-b',
icon: process.execPath,
iconPath: process.execPath,
iconIndex: 0,
description: 'Runs Tool B'
}
@@ -1019,8 +1012,8 @@ use this method to ensure single instance.
An example of activating the window of primary instance when a second instance
starts:
```javascript
const { app } = require('electron')
```js
const { app, BrowserWindow } = require('electron')
let myWindow = null
const additionalData = { myKey: 'myValue' }
@@ -1040,9 +1033,9 @@ if (!gotTheLock) {
}
})
// Create myWindow, load the rest of the app, etc...
app.whenReady().then(() => {
myWindow = createWindow()
myWindow = new BrowserWindow({})
myWindow.loadURL('https://electronjs.org')
})
}
```
@@ -1165,11 +1158,15 @@ case the user's DNS configuration does not include a provider that supports
DoH.
```js
app.configureHostResolver({
secureDnsMode: 'secure',
secureDnsServers: [
'https://cloudflare-dns.com/dns-query'
]
const { app } = require('electron')
app.whenReady().then(() => {
app.configureHostResolver({
secureDnsMode: 'secure',
secureDnsServers: [
'https://cloudflare-dns.com/dns-query'
]
})
})
```
@@ -1321,7 +1318,10 @@ To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel
you'll want to set the launch path to Update.exe, and pass arguments that specify your
application name. For example:
``` javascript
``` js
const { app } = require('electron')
const path = require('path')
const appFolder = path.dirname(process.execPath)
const updateExe = path.resolve(appFolder, '..', 'Update.exe')
const exeName = path.basename(process.execPath)
@@ -1331,7 +1331,7 @@ app.setLoginItemSettings({
path: updateExe,
args: [
'--processStart', `"${exeName}"`,
'--process-start-args', `"--hidden"`
'--process-start-args', '"--hidden"'
]
})
```
@@ -1357,7 +1357,7 @@ This API must be called after the `ready` event is emitted.
### `app.showAboutPanel()`
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`.
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`. This function runs asynchronously.
### `app.setAboutPanelOptions(options)`
@@ -1390,11 +1390,22 @@ Show the platform's native emoji picker.
Returns `Function` - This function **must** be called once you have finished accessing the security scoped file. If you do not remember to stop accessing the bookmark, [kernel resources will be leaked](https://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc) and your app will lose its ability to reach outside the sandbox completely, until your app is restarted.
```js
// Start accessing the file.
const stopAccessingSecurityScopedResource = app.startAccessingSecurityScopedResource(data)
// You can now access the file outside of the sandbox 🎉
const { app, dialog } = require('electron')
const fs = require('fs')
// Remember to stop accessing the file once you've finished with it.
let filepath
let bookmark
dialog.showOpenDialog(null, { securityScopedBookmarks: true }).then(({ filePaths, bookmarks }) => {
filepath = filePaths[0]
bookmark = bookmarks[0]
fs.readFileSync(filepath)
})
// ... restart app ...
const stopAccessingSecurityScopedResource = app.startAccessingSecurityScopedResource(bookmark)
fs.readFileSync(filepath)
stopAccessingSecurityScopedResource()
```
@@ -1435,6 +1446,8 @@ By default, if an app of the same name as the one being moved exists in the Appl
For example:
```js
const { app, dialog } = require('electron')
app.moveToApplicationsFolder({
conflictHandler: (conflictType) => {
if (conflictType === 'exists') {
@@ -1513,18 +1526,18 @@ dock on macOS.
A `boolean` property that returns `true` if the app is packaged, `false` otherwise. For many apps, this property can be used to distinguish development and production environments.
[tasks]:https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
[tasks]:https://learn.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
[electron-forge]: https://www.electronforge.io/
[electron-packager]: https://github.com/electron/electron-packager
[CFBundleURLTypes]: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/documentation/coreservices/1441725-lscopydefaulthandlerforurlscheme?language=objc
[handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html
[activity-type]: https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType
[unity-requirement]: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher
[mas-builds]: ../tutorial/mac-app-store-submission-guide.md
[Squirrel-Windows]: https://github.com/Squirrel/Squirrel.Windows
[JumpListBeginListMSDN]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx
[JumpListBeginListMSDN]: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-icustomdestinationlist-beginlist
[about-panel-options]: https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc
### `app.name`

View File

@@ -137,8 +137,8 @@ application starts.
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support
[squirrel-windows]: https://github.com/Squirrel/Squirrel.Windows
[installer]: https://github.com/electron/grunt-electron-installer
[installer]: https://github.com/electron-archive/grunt-electron-installer
[installer-lib]: https://github.com/electron/windows-installer
[electron-forge-lib]: https://github.com/electron/forge
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter

View File

@@ -104,6 +104,7 @@ window, you have to set both `parent` and `modal` options:
```javascript
const { BrowserWindow } = require('electron')
const top = new BrowserWindow()
const child = new BrowserWindow({ parent: top, modal: true, show: false })
child.loadURL('https://github.com')
child.once('ready-to-show', () => {
@@ -262,6 +263,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
`tooltip`, `content`, `under-window`, or `under-page`. Please note that
`appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are
deprecated and have been removed in macOS Catalina (10.15).
* `backgroundMaterial` string (optional) _Windows_ - Set the window's
system-drawn background material, including behind the non-client area.
Can be `auto`, `none`, `mica`, `acrylic` or `tabbed`. See [win.setBackgroundMaterial](#winsetbackgroundmaterialmaterial-windows) for more information.
* `zoomToPageWidth` boolean (optional) _macOS_ - Controls the behavior on
macOS when option-clicking the green stoplight button on the toolbar or by
clicking the Window > Zoom menu item. If `true`, the window will grow to
@@ -269,7 +273,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
zoom to the width of the screen. This will also affect the behavior when
calling `maximize()` directly. Default is `false`.
* `tabbingIdentifier` string (optional) _macOS_ - Tab group name, allows
opening the window as a native tab on macOS 10.12+. Windows with the same
opening the window as a native tab. Windows with the same
tabbing identifier will be grouped together. This also adds a native new
tab button to your window's tab bar and allows your `app` and window to
receive the `new-window-for-tab` event.
@@ -595,7 +599,7 @@ Emitted when the window is being moved to a new position.
Emitted once when the window is moved to a new position.
__Note__: On macOS this event is an alias of `move`.
**Note**: On macOS this event is an alias of `move`.
#### Event: 'enter-full-screen'
@@ -629,7 +633,7 @@ Returns:
* `event` Event
* `command` string
Emitted when an [App Command](https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx)
Emitted when an [App Command](https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-appcommand)
is invoked. These are typically related to keyboard media keys or browser
commands, as well as the "Back" button built into some mice on Windows.
@@ -884,7 +888,7 @@ On Linux the setter is a no-op, although the getter returns `true`.
A `boolean` property that determines whether the window is excluded from the applications Windows menu. `false` by default.
```js
```js @ts-expect-error=[11]
const win = new BrowserWindow({ height: 600, width: 600 })
const template = [
@@ -954,7 +958,7 @@ Hides the window.
#### `win.isVisible()`
Returns `boolean` - Whether the window is visible to the user.
Returns `boolean` - Whether the window is visible to the user in the foreground of the app.
#### `win.isModal()`
@@ -992,6 +996,8 @@ Returns `boolean` - Whether the window is minimized.
Sets whether the window should be in fullscreen mode.
**Note:** On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events.
#### `win.isFullScreen()`
Returns `boolean` - Whether the window is in fullscreen mode.
@@ -1104,10 +1110,14 @@ win.setBounds({ width: 100 })
console.log(win.getBounds())
```
**Note:** On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
#### `win.getBounds()`
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
**Note:** On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
#### `win.getBackgroundColor()`
Returns `string` - Gets the background color of the window in Hex (`#RRGGBB`) format.
@@ -1485,6 +1495,9 @@ Node's [`url.format`](https://nodejs.org/api/url.html#url_url_format_urlobject)
method:
```javascript
const { BrowserWindow } = require('electron')
const win = new BrowserWindow()
const url = require('url').format({
protocol: 'file',
slashes: true,
@@ -1498,6 +1511,9 @@ You can load a URL using a `POST` request with URL-encoded data by doing
the following:
```javascript
const { BrowserWindow } = require('electron')
const win = new BrowserWindow()
win.loadURL('http://localhost:8000/post', {
postData: [{
type: 'rawData',
@@ -1664,13 +1680,13 @@ in the taskbar.
#### `win.setAppDetails(options)` _Windows_
* `options` Object
* `appId` string (optional) - Window's [App User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx).
* `appId` string (optional) - Window's [App User Model ID](https://learn.microsoft.com/en-us/windows/win32/shell/appids).
It has to be set, otherwise the other options will have no effect.
* `appIconPath` string (optional) - Window's [Relaunch Icon](https://msdn.microsoft.com/en-us/library/windows/desktop/dd391573(v=vs.85).aspx).
* `appIconPath` string (optional) - Window's [Relaunch Icon](https://learn.microsoft.com/en-us/windows/win32/properties/props-system-appusermodel-relaunchiconresource).
* `appIconIndex` Integer (optional) - Index of the icon in `appIconPath`.
Ignored when `appIconPath` is not set. Default is `0`.
* `relaunchCommand` string (optional) - Window's [Relaunch Command](https://msdn.microsoft.com/en-us/library/windows/desktop/dd391571(v=vs.85).aspx).
* `relaunchDisplayName` string (optional) - Window's [Relaunch Display Name](https://msdn.microsoft.com/en-us/library/windows/desktop/dd391572(v=vs.85).aspx).
* `relaunchCommand` string (optional) - Window's [Relaunch Command](https://learn.microsoft.com/en-us/windows/win32/properties/props-system-appusermodel-relaunchcommand).
* `relaunchDisplayName` string (optional) - Window's [Relaunch Display Name](https://learn.microsoft.com/en-us/windows/win32/properties/props-system-appusermodel-relaunchdisplaynameresource).
Sets the properties for the window's taskbar button.
@@ -1776,7 +1792,7 @@ On macOS it does not remove the focus from the window.
#### `win.isFocusable()` _macOS_ _Windows_
Returns whether the window can be focused.
Returns `boolean` - Whether the window can be focused.
#### `win.setParentWindow(parent)`
@@ -1853,13 +1869,28 @@ Set a custom position for the traffic light buttons in frameless window.
Returns `Point` - The custom position for the traffic light buttons in
frameless window.
#### `win.setBackgroundMaterial(material)` _Windows_
* `material` string
* `auto` - Let the Desktop Window Manager (DWM) automatically decide the system-drawn backdrop material for this window. This is the default.
* `none` - Don't draw any system backdrop.
* `mica` - Draw the backdrop material effect corresponding to a long-lived window.
* `acrylic` - Draw the backdrop material effect corresponding to a transient window.
* `tabbed` - Draw the backdrop material effect corresponding to a window with a tabbed title bar.
This method sets the browser window's system-drawn background material, including behind the non-client area.
See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details.
**Note:** This method is only supported on Windows 11 22H2 and up.
#### `win.setTouchBar(touchBar)` _macOS_
* `touchBar` TouchBar | null
Sets the touchBar layout for the current window. Specifying `null` or
`undefined` clears the touch bar. This method only has an effect if the
machine has a touch bar and is running on macOS 10.12.1+.
machine has a touch bar.
**Note:** The TouchBar API is currently experimental and may change or be
removed in future Electron releases.
@@ -1910,7 +1941,7 @@ removed in future Electron releases.
On a Window with Window Controls Overlay already enabled, this method updates
the style of the title bar overlay.
[runtime-enabled-features]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
[page-visibility-api]: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
[quick-look]: https://en.wikipedia.org/wiki/Quick_Look
[vibrancy-docs]: https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc

View File

@@ -56,7 +56,7 @@ strictly follow the Node.js model as described in the
For instance, we could have created the same request to 'github.com' as follows:
```JavaScript
```javascript
const request = net.request({
method: 'GET',
protocol: 'https:',
@@ -95,7 +95,7 @@ The `callback` function is expected to be called back with user credentials:
* `username` string
* `password` string
```JavaScript
```javascript @ts-type={request:Electron.ClientRequest}
request.on('login', (authInfo, callback) => {
callback('username', 'password')
})
@@ -104,9 +104,9 @@ request.on('login', (authInfo, callback) => {
Providing empty credentials will cancel the request and report an authentication
error on the response object:
```JavaScript
```javascript @ts-type={request:Electron.ClientRequest}
request.on('response', (response) => {
console.log(`STATUS: ${response.statusCode}`);
console.log(`STATUS: ${response.statusCode}`)
response.on('error', (error) => {
console.log(`ERROR: ${JSON.stringify(error)}`)
})

View File

@@ -148,10 +148,7 @@ clipboard.
```js
const { clipboard } = require('electron')
clipboard.writeBookmark({
text: 'https://electronjs.org',
bookmark: 'Electron Homepage'
})
clipboard.writeBookmark('Electron Homepage', 'https://electronjs.org')
```
### `clipboard.readFindText()` _macOS_
@@ -226,7 +223,7 @@ clipboard.writeBuffer('public/utf8-plain-text', buffer)
const ret = clipboard.readBuffer('public/utf8-plain-text')
console.log(buffer.equals(out))
console.log(buffer.equals(ret))
// true
```

View File

@@ -116,14 +116,20 @@ Ignore the connections limit for `domains` list separated by `,`.
### --js-flags=`flags`
Specifies the flags passed to the Node.js engine. It has to be passed when starting
Electron if you want to enable the `flags` in the main process.
Specifies the flags passed to the [V8 engine](https://v8.dev). In order to enable the `flags` in the main process,
this switch must be passed on startup.
```sh
$ electron --js-flags="--harmony_proxies --harmony_collections" your-app
```
See the [Node.js documentation][node-cli] or run `node --help` in your terminal for a list of available flags. Additionally, run `node --v8-options` to see a list of flags that specifically refer to Node.js's V8 JavaScript engine.
Run `node --v8-options` or `electron --js-flags="--help"` in your terminal for the list of available flags. These can be used to enable early-stage JavaScript features, or log and manipulate garbage collection, among other things.
For example, to trace V8 optimization and deoptimization:
```sh
$ electron --js-flags="--trace-opt --trace-deopt" your-app
```
### --lang
@@ -241,19 +247,25 @@ Electron supports some of the [CLI flags][node-cli] supported by Node.js.
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
### --inspect-brk\[=\[host:]port]
### `--inspect-brk\[=\[host:]port]`
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
Aliased to `--debug-brk=[host:]port`.
### --inspect-port=\[host:]port
#### `--inspect-brk-node[=[host:]port]`
Activate inspector on `host:port` and break at start of the first internal
JavaScript script executed when the inspector is available.
Default `host:port` is `127.0.0.1:9229`.
### `--inspect-port=\[host:]port`
Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is `127.0.0.1`.
Aliased to `--debug-port=[host:]port`.
### --inspect\[=\[host:]port]
### `--inspect\[=\[host:]port]`
Activate inspector on `host:port`. Default is `127.0.0.1:9229`.
@@ -263,12 +275,28 @@ See the [Debugging the Main Process][debugging-main-process] guide for more deta
Aliased to `--debug[=[host:]port`.
### --inspect-publish-uid=stderr,http
### `--inspect-publish-uid=stderr,http`
Specify ways of the inspector web socket url exposure.
By default inspector websocket url is available in stderr and under /json/list endpoint on http://host:port/json/list.
### `--no-deprecation`
Silence deprecation warnings.
### `--throw-deprecation`
Throw errors for deprecations.
### `--trace-deprecation`
Print stack traces for deprecations.
### `--trace-warnings`
Print stack traces for process warnings (including deprecations).
[app]: app.md
[append-switch]: command-line.md#commandlineappendswitchswitch-value
[debugging-main-process]: ../tutorial/debugging-main-process.md

View File

@@ -18,7 +18,7 @@ contextBridge.exposeInMainWorld(
)
```
```javascript
```javascript @ts-nocheck
// Renderer (Main World)
window.electron.doThing()
@@ -104,7 +104,7 @@ contextBridge.exposeInIsolatedWorld(
)
```
```javascript
```javascript @ts-nocheck
// Renderer (In isolated world id1004)
window.electron.doThing()

View File

@@ -78,6 +78,7 @@ The following methods are available on instances of `Cookies`:
* `path` string (optional) - Retrieves cookies whose path matches `path`.
* `secure` boolean (optional) - Filters cookies by their Secure property.
* `session` boolean (optional) - Filters out session or persistent cookies.
* `httpOnly` boolean (optional) - Filters cookies by httpOnly.
Returns `Promise<Cookie[]>` - A promise which resolves an array of cookie objects.

View File

@@ -16,7 +16,7 @@ crashReporter.start({ submitURL: 'https://your-domain.com/url-to-submit' })
For setting up a server to accept and process crash reports, you can use
following projects:
* [socorro](https://github.com/mozilla/socorro)
* [socorro](https://github.com/mozilla-services/socorro)
* [mini-breakpad-server](https://github.com/electron/mini-breakpad-server)
> **Note:** Electron uses Crashpad, not Breakpad, to collect and upload

View File

@@ -10,7 +10,9 @@ title is `Electron`:
```javascript
// In the main process.
const { desktopCapturer } = require('electron')
const { BrowserWindow, desktopCapturer } = require('electron')
const mainWindow = new BrowserWindow()
desktopCapturer.getSources({ types: ['window', 'screen'] }).then(async sources => {
for (const source of sources) {
@@ -22,7 +24,7 @@ desktopCapturer.getSources({ types: ['window', 'screen'] }).then(async sources =
})
```
```javascript
```javascript @ts-nocheck
// In the preload script.
const { ipcRenderer } = require('electron')

View File

@@ -72,7 +72,7 @@ and a directory selector, so if you set `properties` to
`['openFile', 'openDirectory']` on these platforms, a directory selector will be
shown.
```js
```js @ts-type={mainWindow:Electron.BrowserWindow}
dialog.showOpenDialogSync(mainWindow, {
properties: ['openFile', 'openDirectory']
})
@@ -139,7 +139,7 @@ and a directory selector, so if you set `properties` to
`['openFile', 'openDirectory']` on these platforms, a directory selector will be
shown.
```js
```js @ts-type={mainWindow:Electron.BrowserWindow}
dialog.showOpenDialog(mainWindow, {
properties: ['openFile', 'openDirectory']
}).then(result => {
@@ -223,10 +223,10 @@ expanding and collapsing the dialog.
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `message` string - Content of the message box.
* `type` string (optional) - Can be `"none"`, `"info"`, `"error"`, `"question"` or
`"warning"`. On Windows, `"question"` displays the same icon as `"info"`, unless
you set an icon using the `"icon"` option. On macOS, both `"warning"` and
`"error"` display the same warning icon.
* `type` string (optional) - Can be `none`, `info`, `error`, `question` or
`warning`. On Windows, `question` displays the same icon as `info`, unless
you set an icon using the `icon` option. On macOS, both `warning` and
`error` display the same warning icon.
* `buttons` string[]&#32;(optional) - Array of texts for buttons. On Windows, an empty array
will result in one button labeled "OK".
* `defaultId` Integer (optional) - Index of the button in the buttons array which will
@@ -266,10 +266,10 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `message` string - Content of the message box.
* `type` string (optional) - Can be `"none"`, `"info"`, `"error"`, `"question"` or
`"warning"`. On Windows, `"question"` displays the same icon as `"info"`, unless
you set an icon using the `"icon"` option. On macOS, both `"warning"` and
`"error"` display the same warning icon.
* `type` string (optional) - Can be `none`, `info`, `error`, `question` or
`warning`. On Windows, `question` displays the same icon as `info`, unless
you set an icon using the `icon` option. On macOS, both `warning` and
`error` display the same warning icon.
* `buttons` string[]&#32;(optional) - Array of texts for buttons. On Windows, an empty array
will result in one button labeled "OK".
* `defaultId` Integer (optional) - Index of the button in the buttons array which will

View File

@@ -89,7 +89,7 @@ tuples. So, the even-numbered offsets are key values, and the odd-numbered
offsets are the associated values. Header names are not lowercased, and
duplicates are not merged.
```javascript
```javascript @ts-type={response:Electron.IncomingMessage}
// Prints something like:
//
// [ 'user-agent',
@@ -100,5 +100,5 @@ duplicates are not merged.
// '127.0.0.1:8000',
// 'ACCEPT',
// '*/*' ]
console.log(request.rawHeaders)
console.log(response.rawHeaders)
```

View File

@@ -83,14 +83,14 @@ If `listener` returns a Promise, the eventual result of the promise will be
returned as a reply to the remote caller. Otherwise, the return value of the
listener will be used as the value of the reply.
```js title='Main Process'
```js title='Main Process' @ts-type={somePromise:(...args:unknown[])=>Promise<unknown>}
ipcMain.handle('my-invokable-ipc', async (event, ...args) => {
const result = await somePromise(...args)
return result
})
```
```js title='Renderer Process'
```js title='Renderer Process' @ts-type={arg1:unknown} @ts-type={arg2:unknown}
async () => {
const result = await ipcRenderer.invoke('my-invokable-ipc', arg1, arg2)
// ...

View File

@@ -101,7 +101,7 @@ The main process should listen for `channel` with
For example:
```javascript
```javascript @ts-type={someArgument:unknown} @ts-type={doSomeWork:(arg:unknown)=>Promise<unknown>}
// Renderer process
ipcRenderer.invoke('some-name', someArgument).then((result) => {
// ...

View File

@@ -51,7 +51,7 @@ See [`Menu`](menu.md) for examples.
the placement of their containing group after the containing group of the item
with the specified label.
**Note:** `acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development. This property is only usable on macOS High Sierra 10.13 or newer.
**Note:** `acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development.
### Roles
@@ -115,7 +115,7 @@ The following additional roles are available on _macOS_:
* `moveTabToNewWindow` - Map to the `moveTabToNewWindow` action.
* `window` - The submenu is a "Window" menu.
* `help` - The submenu is a "Help" menu.
* `services` - The submenu is a ["Services"](https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc) menu. This is only intended for use in the Application Menu and is *not* the same as the "Services" submenu used in context menus in macOS apps, which is not implemented in Electron.
* `services` - The submenu is a ["Services"](https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc) menu. This is only intended for use in the Application Menu and is _not_ the same as the "Services" submenu used in context menus in macOS apps, which is not implemented in Electron.
* `recentDocuments` - The submenu is an "Open Recent" menu.
* `clearRecentDocuments` - Map to the `clearRecentDocuments` action.
* `shareMenu` - The submenu is [share menu][ShareMenu]. The `sharingItem` property must also be set to indicate the item to share.

View File

@@ -147,27 +147,29 @@ can have a submenu.
An example of creating the application menu with the simple template API:
```javascript
```javascript @ts-expect-error=[107]
const { app, Menu } = require('electron')
const isMac = process.platform === 'darwin'
const template = [
// { role: 'appMenu' }
...(isMac ? [{
label: app.name,
submenu: [
{ role: 'about' },
{ type: 'separator' },
{ role: 'services' },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideOthers' },
{ role: 'unhide' },
{ type: 'separator' },
{ role: 'quit' }
]
}] : []),
...(isMac
? [{
label: app.name,
submenu: [
{ role: 'about' },
{ type: 'separator' },
{ role: 'services' },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideOthers' },
{ role: 'unhide' },
{ type: 'separator' },
{ role: 'quit' }
]
}]
: []),
// { role: 'fileMenu' }
{
label: 'File',
@@ -185,23 +187,25 @@ const template = [
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
...(isMac ? [
{ role: 'pasteAndMatchStyle' },
{ role: 'delete' },
{ role: 'selectAll' },
{ type: 'separator' },
{
label: 'Speech',
submenu: [
{ role: 'startSpeaking' },
{ role: 'stopSpeaking' }
...(isMac
? [
{ role: 'pasteAndMatchStyle' },
{ role: 'delete' },
{ role: 'selectAll' },
{ type: 'separator' },
{
label: 'Speech',
submenu: [
{ role: 'startSpeaking' },
{ role: 'stopSpeaking' }
]
}
]
}
] : [
{ role: 'delete' },
{ type: 'separator' },
{ role: 'selectAll' }
])
: [
{ role: 'delete' },
{ type: 'separator' },
{ role: 'selectAll' }
])
]
},
// { role: 'viewMenu' }
@@ -225,14 +229,16 @@ const template = [
submenu: [
{ role: 'minimize' },
{ role: 'zoom' },
...(isMac ? [
{ type: 'separator' },
{ role: 'front' },
{ type: 'separator' },
{ role: 'window' }
] : [
{ role: 'close' }
])
...(isMac
? [
{ type: 'separator' },
{ role: 'front' },
{ type: 'separator' },
{ role: 'window' }
]
: [
{ role: 'close' }
])
]
},
{
@@ -261,7 +267,7 @@ menu on behalf of the renderer.
Below is an example of showing a menu when the user right clicks the page:
```js
```js @ts-expect-error=[21]
// renderer
window.addEventListener('contextmenu', (e) => {
e.preventDefault()
@@ -283,7 +289,7 @@ ipcMain.on('show-context-menu', (event) => {
{ label: 'Menu Item 2', type: 'checkbox', checked: true }
]
const menu = Menu.buildFromTemplate(template)
menu.popup(BrowserWindow.fromWebContents(event.sender))
menu.popup({ window: BrowserWindow.fromWebContents(event.sender) })
})
```
@@ -317,7 +323,7 @@ name, no matter what label you set. To change it, modify your app bundle's
[About Information Property List Files][AboutInformationPropertyListFiles]
for more information.
## Setting Menu for Specific Browser Window (*Linux* *Windows*)
## Setting Menu for Specific Browser Window (_Linux_ _Windows_)
The [`setMenu` method][setMenu] of browser windows can set the menu of certain
browser windows.

View File

@@ -17,7 +17,8 @@ Example:
```js
// Main process
const { MessageChannelMain } = require('electron')
const { BrowserWindow, MessageChannelMain } = require('electron')
const w = new BrowserWindow()
const { port1, port2 } = new MessageChannelMain()
w.webContents.postMessage('port', null, [port2])
port1.postMessage({ some: 'message' })
@@ -26,9 +27,9 @@ port1.postMessage({ some: 'message' })
const { ipcRenderer } = require('electron')
ipcRenderer.on('port', (e) => {
// e.ports is a list of ports sent along with this message
e.ports[0].on('message', (messageEvent) => {
e.ports[0].onmessage = (messageEvent) => {
console.log(messageEvent.data)
})
}
})
```

View File

@@ -47,9 +47,9 @@ quality, it is recommended to include at least the following sizes in the:
* 64x64 (200% DPI scale)
* 256x256
Check the *Size requirements* section in [this article][icons].
Check the _Size requirements_ section in [this article][icons].
[icons]:https://msdn.microsoft.com/en-us/library/windows/desktop/dn742485(v=vs.85).aspx
[icons]: https://learn.microsoft.com/en-us/windows/win32/uxguide/vis-icons
## High Resolution Image
@@ -119,13 +119,15 @@ Returns `NativeImage`
Creates an empty `NativeImage` instance.
### `nativeImage.createThumbnailFromPath(path, maxSize)` _macOS_ _Windows_
### `nativeImage.createThumbnailFromPath(path, size)` _macOS_ _Windows_
* `path` string - path to a file that we intend to construct a thumbnail out of.
* `maxSize` [Size](structures/size.md) - the maximum width and height (positive numbers) the thumbnail returned can be. The Windows implementation will ignore `maxSize.height` and scale the height according to `maxSize.width`.
* `size` [Size](structures/size.md) - the desired width and height (positive numbers) of the thumbnail.
Returns `Promise<NativeImage>` - fulfilled with the file's thumbnail preview image, which is a [NativeImage](native-image.md).
Note: The Windows implementation will ignore `size.height` and scale the height according to `size.width`.
### `nativeImage.createFromPath(path)`
* `path` string

View File

@@ -5,7 +5,7 @@
Process: [Main](../glossary.md#main-process)
```javascript
const { netLog } = require('electron')
const { app, netLog } = require('electron')
app.whenReady().then(async () => {
await netLog.startLogging('/path/to/net-log')

View File

@@ -73,6 +73,45 @@ won't be able to connect to remote sites. However, a return value of
whether a particular connection attempt to a particular remote site
will be successful.
#### `net.resolveHost(host, [options])`
* `host` string - Hostname to resolve.
* `options` Object (optional)
* `queryType` string (optional) - Requested DNS query type. If unspecified,
resolver will pick A or AAAA (or both) based on IPv4/IPv6 settings:
* `A` - Fetch only A records
* `AAAA` - Fetch only AAAA records.
* `source` string (optional) - The source to use for resolved addresses.
Default allows the resolver to pick an appropriate source. Only affects use
of big external sources (e.g. calling the system for resolution or using
DNS). Even if a source is specified, results can still come from cache,
resolving "localhost" or IP literals, etc. One of the following values:
* `any` (default) - Resolver will pick an appropriate source. Results could
come from DNS, MulticastDNS, HOSTS file, etc
* `system` - Results will only be retrieved from the system or OS, e.g. via
the `getaddrinfo()` system call
* `dns` - Results will only come from DNS queries
* `mdns` - Results will only come from Multicast DNS queries
* `localOnly` - No external sources will be used. Results will only come
from fast local sources that are available no matter the source setting,
e.g. cache, hosts file, IP literal resolution, etc.
* `cacheUsage` string (optional) - Indicates what DNS cache entries, if any,
can be used to provide a response. One of the following values:
* `allowed` (default) - Results may come from the host cache if non-stale
* `staleAllowed` - Results may come from the host cache even if stale (by
expiration or network changes)
* `disallowed` - Results will not come from the host cache.
* `secureDnsPolicy` string (optional) - Controls the resolver's Secure DNS
behavior for this request. One of the following values:
* `allow` (default)
* `disable`
Returns [`Promise<ResolvedHost>`](structures/resolved-host.md) - Resolves with the resolved IP addresses for the `host`.
This method will resolve hosts from the [default
session](session.md#sessiondefaultsession). To resolve a host from
another session, use [ses.resolveHost()](session.md#sesresolvehosthost-options).
## Properties
### `net.online` _Readonly_

View File

@@ -4,9 +4,12 @@
Process: [Main](../glossary.md#main-process)
## Using in the renderer process
:::info Renderer process notifications
If you want to show Notifications from a renderer process you should use the [HTML5 Notification API](../tutorial/notifications.md)
If you want to show notifications from a renderer process you should use the
[web Notifications API](../tutorial/notifications.md)
:::
## Class: Notification
@@ -29,10 +32,10 @@ Returns `boolean` - Whether or not desktop notifications are supported on the cu
### `new Notification([options])`
* `options` Object (optional)
* `title` string (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.
* `title` string (optional) - A title for the notification, which will be displayed at the top of the notification window when it is shown.
* `subtitle` string (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
* `silent` boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.
* `silent` boolean (optional) - Whether or not to suppress the OS notification noise when showing the notification.
* `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
* `hasReply` boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
* `timeoutType` string (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
@@ -47,8 +50,11 @@ Returns `boolean` - Whether or not desktop notifications are supported on the cu
Objects created with `new Notification` emit the following events:
**Note:** Some events are only available on specific operating systems and are
labeled as such.
:::info
Some events are only available on specific operating systems and are labeled as such.
:::
#### Event: 'show'
@@ -56,7 +62,7 @@ Returns:
* `event` Event
Emitted when the notification is shown to the user, note this could be fired
Emitted when the notification is shown to the user. Note that this event can be fired
multiple times as a notification can be shown multiple times through the
`show()` method.
@@ -106,14 +112,13 @@ Emitted when an error is encountered while creating and showing the native notif
### Instance Methods
Objects created with `new Notification` have the following instance methods:
Objects created with the `new Notification()` constructor have the following instance methods:
#### `notification.show()`
Immediately shows the notification to the user, please note this means unlike the
HTML5 Notification implementation, instantiating a `new Notification` does
not immediately show it to the user, you need to call this method before the OS
will display it.
Immediately shows the notification to the user. Unlike the web notification API,
instantiating a `new Notification()` does not immediately show it to the user. Instead, you need to
call this method before the OS will display it.
If the notification has been shown before, this method will dismiss the previously
shown notification and create a new one with identical properties.
@@ -160,7 +165,7 @@ A `boolean` property representing whether the notification has a reply action.
A `string` property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.
Default is 'low' - see [NotifyUrgency](https://developer.gnome.org/notification-spec/#urgency-levels) for more information.
Default is 'low' - see [NotifyUrgency](https://developer-old.gnome.org/notification-spec/#urgency-levels) for more information.
#### `notification.timeoutType` _Linux_ _Windows_

View File

@@ -24,6 +24,30 @@ Emitted when the system changes to AC power.
Emitted when system changes to battery power.
### Event: 'thermal-state-change' _macOS_
* `state` string - The system's new thermal state. Can be `unknown`, `nominal`, `fair`, `serious`, `critical`.
Emitted when the thermal state of the system changes. Notification of a change
in the thermal status of the system, such as entering a critical temperature
range. Depending on the severity, the system might take steps to reduce said
temperature, for example, throttling the CPU or switching on the fans if
available.
Apps may react to the new state by reducing expensive computing tasks (e.g.
video encoding), or notifying the user. The same state might be received
repeatedly.
See https://developer.apple.com/library/archive/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/RespondToThermalStateChanges.html
### Event: 'speed-limit-change' _macOS_ _Windows_
* `limit` number - The operating system's advertised speed limit for CPUs, in percent.
Notification of a change in the operating system's advertised speed limit for
CPUs, in percent. Values below 100 indicate that the system is impairing
processing power due to thermal management.
### Event: 'shutdown' _Linux_ _macOS_
Emitted when the system is about to reboot or shut down. If the event handler
@@ -55,7 +79,7 @@ The `powerMonitor` module has the following methods:
* `idleThreshold` Integer
Returns `string` - The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
Returns `string` - The system's current idle state. Can be `active`, `idle`, `locked` or `unknown`.
Calculate the system idle state. `idleThreshold` is the amount of time (in seconds)
before considered idle. `locked` is available on supported systems only.
@@ -66,6 +90,10 @@ Returns `Integer` - Idle time in seconds
Calculate system idle time in seconds.
### `powerMonitor.getCurrentThermalState()` _macOS_
Returns `string` - The system's current thermal state. Can be `unknown`, `nominal`, `fair`, `serious`, or `critical`.
### `powerMonitor.isOnBatteryPower()`
Returns `boolean` - Whether the system is on battery power.

View File

@@ -49,6 +49,8 @@ is used.
Stops the specified power save blocker.
Returns `boolean` - Whether the specified `powerSaveBlocker` has been stopped.
### `powerSaveBlocker.isStarted(id)`
* `id` Integer - The power save blocker id returned by `powerSaveBlocker.start`.

View File

@@ -36,7 +36,7 @@ To have your custom protocol work in combination with a custom session, you need
to register it to that session explicitly.
```javascript
const { session, app, protocol } = require('electron')
const { app, BrowserWindow, net, protocol, session } = require('electron')
const path = require('path')
app.whenReady().then(() => {
@@ -45,10 +45,10 @@ app.whenReady().then(() => {
ses.protocol.registerFileProtocol('atom', (request, callback) => {
const url = request.url.substr(7)
callback({ path: path.normalize(`${__dirname}/${url}`) })
callback({ path: path.normalize(path.join(__dirname, url)) })
})
mainWindow = new BrowserWindow({ webPreferences: { partition } })
const mainWindow = new BrowserWindow({ webPreferences: { partition } })
})
```

View File

@@ -40,7 +40,7 @@ The `pushNotification` module has the following methods:
Returns `Promise<string>`
Registers the app with Apple Push Notification service (APNS) to receive [Badge, Sound, and Alert](https://developer.apple.com/documentation/appkit/sremotenotificationtype?language=objc) notifications. If registration is successful, the promise will be resolved with the APNS device token. Otherwise, the promise will be rejected with an error message.
Registers the app with Apple Push Notification service (APNS) to receive [Badge, Sound, and Alert](https://developer.apple.com/documentation/appkit/nsremotenotificationtype?language=objc) notifications. If registration is successful, the promise will be resolved with the APNS device token. Otherwise, the promise will be rejected with an error message.
See: https://developer.apple.com/documentation/appkit/nsapplication/1428476-registerforremotenotificationtyp?language=objc
### `pushNotifications.unregisterForAPNSNotifications()` _macOS_

View File

@@ -82,7 +82,7 @@ Emitted when Electron is about to download `item` in `webContents`.
Calling `event.preventDefault()` will cancel the download and `item` will not be
available from next tick of the process.
```javascript
```javascript @ts-expect-error=[4]
const { session } = require('electron')
session.defaultSession.on('will-download', (event, item, webContents) => {
event.preventDefault()
@@ -198,7 +198,7 @@ cancel the request. Additionally, permissioning on `navigator.hid` can
be further managed by using [`ses.setPermissionCheckHandler(handler)`](#sessetpermissioncheckhandlerhandler)
and [`ses.setDevicePermissionHandler(handler)`](#sessetdevicepermissionhandlerhandler).
```javascript
```javascript @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)}
const { app, BrowserWindow } = require('electron')
let win = null
@@ -237,7 +237,7 @@ app.whenReady().then(() => {
win.webContents.session.on('select-hid-device', (event, details, callback) => {
event.preventDefault()
const selectedDevice = details.deviceList.find((device) => {
return device.vendorId === '9025' && device.productId === '67'
return device.vendorId === 9025 && device.productId === 67
})
callback(selectedDevice?.deviceId)
})
@@ -304,7 +304,7 @@ cancel the request. Additionally, permissioning on `navigator.serial` can
be managed by using [ses.setPermissionCheckHandler(handler)](#sessetpermissioncheckhandlerhandler)
with the `serial` permission.
```javascript
```javascript @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)}
const { app, BrowserWindow } = require('electron')
let win = null
@@ -447,7 +447,7 @@ cancel the request. Additionally, permissioning on `navigator.usb` can
be further managed by using [`ses.setPermissionCheckHandler(handler)`](#sessetpermissioncheckhandlerhandler)
and [`ses.setDevicePermissionHandler(handler)`](#sessetdevicepermissionhandlerhandler).
```javascript
```javascript @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)} @ts-type={updateGrantedDevices:(devices:Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)=>void}
const { app, BrowserWindow } = require('electron')
let win = null
@@ -486,7 +486,7 @@ app.whenReady().then(() => {
win.webContents.session.on('select-usb-device', (event, details, callback) => {
event.preventDefault()
const selectedDevice = details.deviceList.find((device) => {
return device.vendorId === '9025' && device.productId === '67'
return device.vendorId === 9025 && device.productId === 67
})
if (selectedDevice) {
// Optionally, add this to the persisted devices (updateGrantedDevices needs to be implemented by developer to persist permissions)
@@ -644,8 +644,8 @@ The `proxyBypassRules` is a comma separated list of rules described below:
Match all hostnames that match the pattern HOSTNAME_PATTERN.
Examples:
"foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
"https://x.*.y.com:99"
"foobar.com", "\*foobar.com", "\*.foobar.com", "\*foobar.com:99",
"https://x.\*.y.com:99"
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
@@ -674,6 +674,41 @@ The `proxyBypassRules` is a comma separated list of rules described below:
Match local addresses. The meaning of `<local>` is whether the
host matches one of: "127.0.0.1", "::1", "localhost".
#### `ses.resolveHost(host, [options])`
* `host` string - Hostname to resolve.
* `options` Object (optional)
* `queryType` string (optional) - Requested DNS query type. If unspecified,
resolver will pick A or AAAA (or both) based on IPv4/IPv6 settings:
* `A` - Fetch only A records
* `AAAA` - Fetch only AAAA records.
* `source` string (optional) - The source to use for resolved addresses.
Default allows the resolver to pick an appropriate source. Only affects use
of big external sources (e.g. calling the system for resolution or using
DNS). Even if a source is specified, results can still come from cache,
resolving "localhost" or IP literals, etc. One of the following values:
* `any` (default) - Resolver will pick an appropriate source. Results could
come from DNS, MulticastDNS, HOSTS file, etc
* `system` - Results will only be retrieved from the system or OS, e.g. via
the `getaddrinfo()` system call
* `dns` - Results will only come from DNS queries
* `mdns` - Results will only come from Multicast DNS queries
* `localOnly` - No external sources will be used. Results will only come
from fast local sources that are available no matter the source setting,
e.g. cache, hosts file, IP literal resolution, etc.
* `cacheUsage` string (optional) - Indicates what DNS cache entries, if any,
can be used to provide a response. One of the following values:
* `allowed` (default) - Results may come from the host cache if non-stale
* `staleAllowed` - Results may come from the host cache even if stale (by
expiration or network changes)
* `disallowed` - Results will not come from the host cache.
* `secureDnsPolicy` string (optional) - Controls the resolver's Secure DNS
behavior for this request. One of the following values:
* `allow` (default)
* `disable`
Returns [`Promise<ResolvedHost>`](structures/resolved-host.md) - Resolves with the resolved IP addresses for the `host`.
#### `ses.resolveProxy(url)`
* `url` URL
@@ -706,15 +741,17 @@ Sets download saving directory. By default, the download directory will be the
Emulates network with the given configuration for the `session`.
```javascript
const win = new BrowserWindow()
// To emulate a GPRS connection with 50kbps throughput and 500 ms latency.
window.webContents.session.enableNetworkEmulation({
win.webContents.session.enableNetworkEmulation({
latency: 500,
downloadThroughput: 6400,
uploadThroughput: 6400
})
// To emulate a network outage.
window.webContents.session.enableNetworkEmulation({ offline: true })
win.webContents.session.enableNetworkEmulation({ offline: true })
```
#### `ses.preconnect(options)`
@@ -785,18 +822,19 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
* `permission` string - The type of requested permission.
* `clipboard-read` - Request access to read from the clipboard.
* `clipboard-sanitized-write` - Request access to write to the clipboard.
* `display-capture` - Request access to capture the screen via the [Screen Capture API](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API).
* `fullscreen` - Request control of the app's fullscreen state via the [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API).
* `geolocation` - Request access to the user's location via the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API)
* `idle-detection` - Request access to the user's idle state via the [IdleDetector API](https://developer.mozilla.org/en-US/docs/Web/API/IdleDetector).
* `media` - Request access to media devices such as camera, microphone and speakers.
* `display-capture` - Request access to capture the screen.
* `mediaKeySystem` - Request access to DRM protected content.
* `geolocation` - Request access to user's current location.
* `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. These requests always appear to originate from the main frame.
* `fullscreen` - Request for the app to enter fullscreen mode.
* `midi` - Request MIDI access in the [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API).
* `midiSysex` - Request the use of system exclusive messages in the [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API).
* `notifications` - Request notification creation and the ability to display them in the user's system tray using the [Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/notification)
* `pointerLock` - Request to directly interpret mouse movements as an input method via the [Pointer Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API). These requests always appear to originate from the main frame.
* `openExternal` - Request to open links in external applications.
* `window-management` - Request access to enumerate screens using the [`getScreenDetails`](https://developer.chrome.com/en/articles/multi-screen-window-placement/) API.
* `unknown` - An unrecognized permission request
* `unknown` - An unrecognized permission request.
* `callback` Function
* `permissionGranted` boolean - Allow or deny the permission.
* `details` Object - Some properties are only available on certain permission types.
@@ -828,7 +866,22 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
* `handler` Function\<boolean> | null
* `webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. All cross origin sub frames making permission checks will pass a `null` webContents to this handler, while certain other permission checks such as `notifications` checks will always pass `null`. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
* `permission` string - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, `hid`, `serial`, or `usb`.
* `permission` string - Type of permission check.
* `clipboard-read` - Request access to read from the clipboard.
* `clipboard-sanitized-write` - Request access to write to the clipboard.
* `geolocation` - Access the user's geolocation data via the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API)
* `fullscreen` - Control of the app's fullscreen state via the [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API).
* `hid` - Access the HID protocol to manipulate HID devices via the [WebHID API](https://developer.mozilla.org/en-US/docs/Web/API/WebHID_API).
* `idle-detection` - Access the user's idle state via the [IdleDetector API](https://developer.mozilla.org/en-US/docs/Web/API/IdleDetector).
* `media` - Access to media devices such as camera, microphone and speakers.
* `mediaKeySystem` - Access to DRM protected content.
* `midi` - Enable MIDI access in the [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API).
* `midiSysex` - Use system exclusive messages in the [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API).
* `notifications` - Configure and display desktop notifications to the user with the [Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/notification).
* `openExternal` - Open links in external applications.
* `pointerLock` - Directly interpret mouse movements as an input method via the [Pointer Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API). These requests always appear to originate from the main frame.
* `serial` - Read from and write to serial devices with the [Web Serial API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API).
* `usb` - Expose non-standard Universal Serial Bus (USB) compatible devices services to the web with the [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API).
* `requestingOrigin` string - The origin URL of the permission check
* `details` Object - Some properties are only available on certain permission types.
* `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
@@ -879,6 +932,10 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
Specifying a loopback device will capture system audio, and is
currently only supported on Windows. If a WebFrameMain is specified,
will capture audio from that frame.
* `enableLocalEcho` Boolean (optional) - If `audio` is a [WebFrameMain](web-frame-main.md)
and this is set to `true`, then local playback of audio will not be muted (e.g. using `MediaRecorder`
to record `WebFrameMain` with this flag set to `true` will allow audio to pass through to the speakers
while recording). Default is `false`.
This handler will be called when web content requests access to display media
via the `navigator.mediaDevices.getDisplayMedia` API. Use the
@@ -916,7 +973,7 @@ Passing `null` instead of a function resets the handler to its default state.
* `details` Object
* `deviceType` string - The type of device that permission is being requested on, can be `hid`, `serial`, or `usb`.
* `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.
* `device` [HIDDevice](structures/hid-device.md) | [SerialPort](structures/serial-port.md) | [USBDevice](structures/usb-device.md) - the device that permission is being requested for.
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.
@@ -928,7 +985,7 @@ Additionally, the default behavior of Electron is to store granted device permis
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
```javascript @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)}
const { app, BrowserWindow } = require('electron')
let win = null
@@ -976,9 +1033,58 @@ app.whenReady().then(() => {
win.webContents.session.on('select-hid-device', (event, details, callback) => {
event.preventDefault()
const selectedDevice = details.deviceList.find((device) => {
return device.vendorId === '9025' && device.productId === '67'
return device.vendorId === 9025 && device.productId === 67
})
callback(selectedDevice?.deviceId)
})
})
```
#### `ses.setUSBProtectedClassesHandler(handler)`
* `handler` Function\<string[]> | null
* `details` Object
* `protectedClasses` string[] - The current list of protected USB classes. Possible class values are:
* `audio`
* `audio-video`
* `hid`
* `mass-storage`
* `smart-card`
* `video`
* `wireless`
Sets the handler which can be used to override which [USB classes are protected](https://wicg.github.io/webusb/#usbinterface-interface).
The return value for the handler is a string array of USB classes which should be considered protected (eg not available in the renderer). Valid values for the array are:
* `audio`
* `audio-video`
* `hid`
* `mass-storage`
* `smart-card`
* `video`
* `wireless`
Returning an empty string array from the handler will allow all USB classes; returning the passed in array will maintain the default list of protected USB classes (this is also the default behavior if a handler is not defined).
To clear the handler, call `setUSBProtectedClassesHandler(null)`.
```javascript
const { app, BrowserWindow } = require('electron')
let win = null
app.whenReady().then(() => {
win = new BrowserWindow()
win.webContents.session.setUSBProtectedClassesHandler((details) => {
// Allow all classes:
// return []
// Keep the current set of protected classes:
// return details.protectedClasses
// Selectively remove classes:
return details.protectedClasses.filter((usbClass) => {
// Exclude classes except for audio classes
return usbClass.indexOf('audio') === -1
})
callback(selectedPort?.deviceId)
})
})
```
@@ -1017,32 +1123,32 @@ macOS does not require a handler because macOS handles the pairing
automatically. To clear the handler, call `setBluetoothPairingHandler(null)`.
```javascript
const { app, BrowserWindow, ipcMain, session } = require('electron')
let bluetoothPinCallback = null
const { app, BrowserWindow, session } = require('electron')
const path = require('path')
function createWindow () {
let bluetoothPinCallback = null
const mainWindow = new BrowserWindow({
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
mainWindow.webContents.session.setBluetoothPairingHandler((details, callback) => {
bluetoothPinCallback = callback
// Send a IPC message to the renderer to prompt the user to confirm the pairing.
// Note that this will require logic in the renderer to handle this message and
// display a prompt to the user.
mainWindow.webContents.send('bluetooth-pairing-request', details)
})
// Listen for an IPC message from the renderer to get the response for the Bluetooth pairing.
mainWindow.webContents.ipc.on('bluetooth-pairing-response', (event, response) => {
bluetoothPinCallback(response)
})
}
// Listen for an IPC message from the renderer to get the response for the Bluetooth pairing.
ipcMain.on('bluetooth-pairing-response', (event, response) => {
bluetoothPinCallback(response)
})
mainWindow.webContents.session.setBluetoothPairingHandler((details, callback) => {
bluetoothPinCallback = callback
// Send a IPC message to the renderer to prompt the user to confirm the pairing.
// Note that this will require logic in the renderer to handle this message and
// display a prompt to the user.
mainWindow.webContents.send('bluetooth-pairing-request', details)
})
app.whenReady().then(() => {
createWindow()
})
@@ -1373,7 +1479,7 @@ app.whenReady().then(() => {
const protocol = session.fromPartition('some-partition').protocol
if (!protocol.registerFileProtocol('atom', (request, callback) => {
const url = request.url.substr(7)
callback({ path: path.normalize(`${__dirname}/${url}`) })
callback({ path: path.normalize(path.join(__dirname, url)) })
})) {
console.error('Failed to register protocol')
}

View File

@@ -40,6 +40,8 @@ Open the given file in the desktop's default manner.
* `options` Object (optional)
* `activate` boolean (optional) _macOS_ - `true` to bring the opened application to the foreground. The default is `true`.
* `workingDirectory` string (optional) _Windows_ - The working directory.
* `logUsage` boolean (optional) _Windows_ - Indicates a user initiated launch that enables tracking of frequently used programs and other behaviors.
The default is `false`.
Returns `Promise<void>`

View File

@@ -3,9 +3,9 @@
* `processId` Integer - The internal ID of the renderer process that sent this message
* `frameId` Integer - The ID of the renderer frame that sent this message
* `returnValue` any - Set this to the value to be returned in a synchronous message
* `sender` WebContents - Returns the `webContents` that sent the message
* `senderFrame` WebFrameMain _Readonly_ - The frame that sent this message
* `ports` MessagePortMain[] - A list of MessagePorts that were transferred with this message
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
* `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this message
* `ports` [MessagePortMain](../message-port-main.md)[] - A list of MessagePorts that were transferred with this message
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
* `channel` string
* `...args` any[]

View File

@@ -2,5 +2,5 @@
* `processId` Integer - The internal ID of the renderer process that sent this message
* `frameId` Integer - The ID of the renderer frame that sent this message
* `sender` WebContents - Returns the `webContents` that sent the message
* `senderFrame` WebFrameMain _Readonly_ - The frame that sent this message
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
* `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this message

View File

@@ -1,7 +1,9 @@
# IpcRendererEvent Object extends `Event`
* `sender` IpcRenderer - The `IpcRenderer` instance that emitted the event originally
* `sender` [IpcRenderer](../ipc-renderer.md) - The `IpcRenderer` instance that emitted the event originally
* `senderId` Integer - The `webContents.id` that sent the message, you can call `event.sender.sendTo(event.senderId, ...)` to reply to the message, see [ipcRenderer.sendTo][ipc-renderer-sendto] for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set `event.senderId` to `0`.
* `ports` MessagePort[] - A list of MessagePorts that were transferred with this message
* `senderIsMainFrame` boolean (optional) - Whether the message sent via [ipcRenderer.sendTo][ipc-renderer-sendto] was sent by the main frame. This is relevant when `nodeIntegrationInSubFrames` is enabled in the originating `webContents`.
* `ports` [MessagePort][][] - A list of MessagePorts that were transferred with this message
[ipc-renderer-sendto]: ../ipc-renderer.md#ipcrenderersendtowebcontentsid-channel-args
[MessagePort]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort

View File

@@ -7,7 +7,7 @@
* `isDefault` boolean - whether or not a given printer is set as the default printer on the OS.
* `options` Object - an object containing a variable number of platform-specific printer information.
The number represented by `status` means different things on different platforms: on Windows its potential values can be found [here](https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2), and on Linux and macOS they can be found [here](https://www.cups.org/doc/cupspm.html).
The number represented by `status` means different things on different platforms: on Windows its potential values can be found [here](https://learn.microsoft.com/en-us/windows/win32/printdocs/printer-info-2), and on Linux and macOS they can be found [here](https://www.cups.org/doc/cupspm.html).
## Example

View File

@@ -0,0 +1,13 @@
# RenderProcessGoneDetails Object
* `reason` string - The reason the render process is gone. Possible values:
* `clean-exit` - Process exited with an exit code of zero
* `abnormal-exit` - Process exited with a non-zero exit code
* `killed` - Process was sent a SIGTERM or otherwise killed externally
* `crashed` - Process crashed
* `oom` - Process ran out of memory
* `launch-failed` - Process never successfully launched
* `integrity-failure` - Windows code integrity checks failed
* `exitCode` Integer - The exit code of the process, unless `reason` is
`launch-failed`, in which case `exitCode` will be a platform-specific
launch failure error code.

View File

@@ -0,0 +1,7 @@
# ResolvedEndpoint Object
* `address` string
* `family` string - One of the following:
* `ipv4` - Corresponds to `AF_INET`
* `ipv6` - Corresponds to `AF_INET6`
* `unspec` - Corresponds to `AF_UNSPEC`

View File

@@ -0,0 +1,3 @@
# ResolvedHost Object
* `endpoints` [ResolvedEndpoint[]](resolved-endpoint.md) - resolved DNS entries for the hostname

View File

@@ -2,9 +2,9 @@
* `portId` string - Unique identifier for the port.
* `portName` string - Name of the port.
* `displayName` string - A string suitable for display to the user for describing this device.
* `vendorId` string - Optional USB vendor ID.
* `productId` string - Optional USB product ID.
* `serialNumber` string - The USB device serial number.
* `usbDriverName` string (optional) - Represents a single serial port on macOS can be enumerated by multiple drivers.
* `deviceInstanceId` string (optional) - A stable identifier on Windows that can be used for device permissions.
* `displayName` string (optional) - A string suitable for display to the user for describing this device.
* `vendorId` string (optional) - The USB vendor ID.
* `productId` string (optional) - The USB product ID.
* `serialNumber` string (optional) - The USB device serial number.
* `usbDriverName` string (optional) _macOS_ - Represents a single serial port on macOS can be enumerated by multiple drivers.
* `deviceInstanceId` string (optional) _Windows_ - A stable identifier on Windows that can be used for device permissions.

View File

@@ -1,3 +1,4 @@
# WebRequestFilter Object
* `urls` string[] - Array of [URL patterns](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns) that will be used to filter out the requests that do not match the URL patterns.
* `types` String[] (optional) - Array of types that will be used to filter out the requests that do not match the types. When not specified, all types will be matched. Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media` or `webSocket`.

View File

@@ -1,93 +0,0 @@
# Synopsis
> How to use Node.js and Electron APIs.
All of [Node.js's built-in modules](https://nodejs.org/api/) are available in
Electron and third-party node modules also fully supported as well (including
the [native modules](../tutorial/using-native-node-modules.md)).
Electron also provides some extra built-in modules for developing native
desktop applications. Some modules are only available in the main process, some
are only available in the renderer process (web page), and some can be used in
either process type.
The basic rule is: if a module is [GUI][gui] or low-level system related, then
it should be only available in the main process. You need to be familiar with
the concept of main process vs. renderer process
scripts to be able to use those modules.
The main process script is like a normal Node.js script:
```javascript
const { app, BrowserWindow } = require('electron')
let win = null
app.whenReady().then(() => {
win = new BrowserWindow({ width: 800, height: 600 })
win.loadURL('https://github.com')
})
```
The renderer process is no different than a normal web page, except for the
extra ability to use node modules if `nodeIntegration` is enabled:
```html
<!DOCTYPE html>
<html>
<body>
<script>
const fs = require('fs')
console.log(fs.readFileSync(__filename, 'utf8'))
</script>
</body>
</html>
```
## Destructuring assignment
As of 0.37, you can use
[destructuring assignment][destructuring-assignment] to make it easier to use
built-in modules.
```javascript
const { app, BrowserWindow } = require('electron')
let win
app.whenReady().then(() => {
win = new BrowserWindow()
win.loadURL('https://github.com')
})
```
If you need the entire `electron` module, you can require it and then using
destructuring to access the individual modules from `electron`.
```javascript
const electron = require('electron')
const { app, BrowserWindow } = electron
let win
app.whenReady().then(() => {
win = new BrowserWindow()
win.loadURL('https://github.com')
})
```
This is equivalent to the following code:
```javascript
const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow
let win
app.whenReady().then(() => {
win = new BrowserWindow()
win.loadURL('https://github.com')
})
```
[gui]: https://en.wikipedia.org/wiki/Graphical_user_interface
[destructuring-assignment]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

View File

@@ -6,7 +6,7 @@ Process: [Main](../glossary.md#main-process)
```javascript
const { systemPreferences } = require('electron')
console.log(systemPreferences.isDarkMode())
console.log(systemPreferences.isAeroGlassEnabled())
```
## Events
@@ -47,12 +47,6 @@ Returns:
## Methods
### `systemPreferences.isDarkMode()` _macOS_ _Windows_ _Deprecated_
Returns `boolean` - Whether the system is in Dark Mode.
**Deprecated:** Should use the new [`nativeTheme.shouldUseDarkColors`](native-theme.md#nativethemeshouldusedarkcolors-readonly) API.
### `systemPreferences.isSwipeTrackingFromScrollEventsEnabled()` _macOS_
Returns `boolean` - Whether the Swipe between pages setting is on.
@@ -228,14 +222,14 @@ const win = new BrowserWindow(browserOptions)
// Navigate.
if (browserOptions.transparent) {
win.loadURL(`file://${__dirname}/index.html`)
win.loadFile('index.html')
} else {
// No transparency, so we load a fallback that uses basic styles.
win.loadURL(`file://${__dirname}/fallback.html`)
win.loadFile('fallback.html')
}
```
[dwm-composition]:https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx
[dwm-composition]: https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw
### `systemPreferences.getAccentColor()` _Windows_ _macOS_
@@ -336,8 +330,8 @@ See the [Windows docs][windows-colors] and the [macOS docs][macos-colors] for mo
The following colors are only available on macOS 10.14: `find-highlight`, `selected-content-background`, `separator`, `unemphasized-selected-content-background`, `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
[windows-colors]:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx
[macos-colors]:https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors
[windows-colors]: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsyscolor
[macos-colors]: https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors
### `systemPreferences.getSystemColor(color)` _macOS_
@@ -356,18 +350,6 @@ Returns `string` - The standard system color formatted as `#RRGGBBAA`.
Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility settings like 'Increase contrast' and 'Reduce transparency'. See [Apple Documentation](https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors) for more details.
### `systemPreferences.isInvertedColorScheme()` _Windows_ _Deprecated_
Returns `boolean` - `true` if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, `false` otherwise.
**Deprecated:** Should use the new [`nativeTheme.shouldUseInvertedColorScheme`](native-theme.md#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly) API.
### `systemPreferences.isHighContrastColorScheme()` _macOS_ _Windows_ _Deprecated_
Returns `boolean` - `true` if a high contrast theme is active, `false` otherwise.
**Deprecated:** Should use the new [`nativeTheme.shouldUseHighContrastColors`](native-theme.md#nativethemeshouldusehighcontrastcolors-macos-windows-readonly) API.
### `systemPreferences.getEffectiveAppearance()` _macOS_
Returns `string` - Can be `dark`, `light` or `unknown`.
@@ -394,8 +376,6 @@ system default and override the value of `getEffectiveAppearance`.
Returns `boolean` - whether or not this device has the ability to use Touch ID.
**NOTE:** This API will return `false` on macOS systems older than Sierra 10.12.2.
### `systemPreferences.promptTouchID(reason)` _macOS_
* `reason` string - The reason you are asking for Touch ID authentication
@@ -414,8 +394,6 @@ systemPreferences.promptTouchID('To get consent for a Security-Gated Thing').the
This API itself will not protect your user data; rather, it is a mechanism to allow you to do so. Native apps will need to set [Access Control Constants](https://developer.apple.com/documentation/security/secaccesscontrolcreateflags?language=objc) like [`kSecAccessControlUserPresence`](https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroluserpresence?language=objc) on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. This could be done with [`node-keytar`](https://github.com/atom/node-keytar), such that one would store an encryption key with `node-keytar` and only fetch it if `promptTouchID()` resolves.
**NOTE:** This API will return a rejected Promise on macOS systems older than Sierra 10.12.2.
### `systemPreferences.isTrustedAccessibilityClient(prompt)` _macOS_
* `prompt` boolean - whether or not the user will be informed via prompt if the current process is untrusted.
@@ -428,7 +406,7 @@ Returns `boolean` - `true` if the current process is a trusted accessibility cli
Returns `string` - Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return `granted`.
This user consent was not required on macOS 10.13 High Sierra so this method will always return `granted`.
macOS 10.14 Mojave or higher requires consent for `microphone` and `camera` access.
macOS 10.15 Catalina or higher requires consent for `screen` access.
@@ -443,7 +421,7 @@ Returns `Promise<boolean>` - A promise that resolves with `true` if consent was
**Important:** In order to properly leverage this API, you [must set](https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc) the `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your app's `Info.plist` file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See [Electron Application Distribution](../tutorial/application-distribution.md#rebranding-with-downloaded-binaries) for more information about how to set these in the context of Electron.
This user consent was not required until macOS 10.14 Mojave, so this method will always return `true` if your system is running 10.13 High Sierra or lower.
This user consent was not required until macOS 10.14 Mojave, so this method will always return `true` if your system is running 10.13 High Sierra.
### `systemPreferences.getAnimationSettings()`

View File

@@ -87,12 +87,12 @@ const { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar
let spinning = false
// Reel labels
const reel1 = new TouchBarLabel()
const reel2 = new TouchBarLabel()
const reel3 = new TouchBarLabel()
const reel1 = new TouchBarLabel({ label: '' })
const reel2 = new TouchBarLabel({ label: '' })
const reel3 = new TouchBarLabel({ label: '' })
// Spin result label
const result = new TouchBarLabel()
const result = new TouchBarLabel({ label: '' })
// Spin button
const spin = new TouchBarButton({

View File

@@ -25,9 +25,9 @@ app.whenReady().then(() => {
})
```
__Platform Considerations__
**Platform Considerations**
__Linux__
**Linux**
* Tray icon uses [StatusNotifierItem](https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/)
by default, when it is not available in user's desktop environment the
@@ -58,14 +58,14 @@ app.whenReady().then(() => {
})
```
__MacOS__
**MacOS**
* 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__
**Windows**
* It is recommended to use `ICO` icons to get best visual effects.
@@ -235,7 +235,7 @@ Sets the hover text for this tray icon.
* `title` string
* `options` Object (optional)
* `fontType` string (optional) - The font family variant to display, can be `monospaced` or `monospacedDigit`. `monospaced` is available in macOS 10.15+ and `monospacedDigit` is available in macOS 10.11+. When left blank, the title uses the default system font.
* `fontType` string (optional) - The font family variant to display, can be `monospaced` or `monospacedDigit`. `monospaced` is available in macOS 10.15+ When left blank, the title uses the default system font.
Sets the title displayed next to the tray icon in the status bar (Support ANSI colors).
@@ -269,9 +269,9 @@ Returns `boolean` - Whether double click events will be ignored.
Displays a tray balloon.
[NIIF_NOSOUND]: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010
[NIIF_LARGE_ICON]: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020
[NIIF_RESPECT_QUIET_TIME]: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080
[NIIF_NOSOUND]: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010
[NIIF_LARGE_ICON]: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020
[NIIF_RESPECT_QUIET_TIME]: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080
#### `tray.removeBalloon()` _Windows_

View File

@@ -35,28 +35,28 @@ for all windows, webviews, opened devtools, and devtools extension background pa
### `webContents.getFocusedWebContents()`
Returns `WebContents` | null - The web contents that is focused in this application, otherwise
Returns `WebContents | null` - The web contents that is focused in this application, otherwise
returns `null`.
### `webContents.fromId(id)`
* `id` Integer
Returns `WebContents` | undefined - A WebContents instance with the given ID, or
Returns `WebContents | undefined` - A WebContents instance with the given ID, or
`undefined` if there is no WebContents associated with the given ID.
### `webContents.fromFrame(frame)`
* `frame` WebFrameMain
Returns `WebContents` | undefined - A WebContents instance with the given WebFrameMain, or
Returns `WebContents | undefined` - A WebContents instance with the given WebFrameMain, or
`undefined` if there is no WebContents associated with the given WebFrameMain.
### `webContents.fromDevToolsTargetId(targetId)`
* `targetId` string - The Chrome DevTools Protocol [TargetID](https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID) associated with the WebContents instance.
Returns `WebContents` | undefined - A WebContents instance with the given TargetID, or
Returns `WebContents | undefined` - A WebContents instance with the given TargetID, or
`undefined` if there is no WebContents associated with the given TargetID.
When communicating with the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/),
@@ -68,7 +68,7 @@ async function lookupTargetId (browserWindow) {
await wc.debugger.attach('1.3')
const { targetInfo } = await wc.debugger.sendCommand('Target.getTargetInfo')
const { targetId } = targetInfo
const targetWebContents = await webContents.fromDevToolsTargetId(targetId)
const targetWebContents = await wc.fromDevToolsTargetId(targetId)
}
```
@@ -195,7 +195,7 @@ Returns:
Only defined when the window is being created by a form that set
`target=_blank`.
* `disposition` string - Can be `default`, `foreground-tab`,
`background-tab`, `new-window`, `save-to-disk` and `other`.
`background-tab`, `new-window` or `other`.
Emitted _after_ successful creation of a window via `window.open` in the renderer.
Not emitted if the creation of the window is canceled from
@@ -373,18 +373,7 @@ checking `reason === 'killed'` when you switch to that event.
Returns:
* `event` Event
* `details` Object
* `reason` string - The reason the render process is gone. Possible values:
* `clean-exit` - Process exited with an exit code of zero
* `abnormal-exit` - Process exited with a non-zero exit code
* `killed` - Process was sent a SIGTERM or otherwise killed externally
* `crashed` - Process crashed
* `oom` - Process ran out of memory
* `launch-failed` - Process never successfully launched
* `integrity-failure` - Windows code integrity checks failed
* `exitCode` Integer - The exit code of the process, unless `reason` is
`launch-failed`, in which case `exitCode` will be a platform-specific
launch failure error code.
* `details` [RenderProcessGoneDetails](structures/render-process-gone-details.md)
Emitted when the renderer process unexpectedly disappears. This is normally
because it was crashed or killed.
@@ -496,6 +485,7 @@ window.
Returns:
* `event` Event
* `url` string - URL of the link that was clicked or selected.
Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu.
@@ -622,14 +612,16 @@ Returns:
* `size` [Size](structures/size.md) (optional) - the size of the `image`.
* `hotspot` [Point](structures/point.md) (optional) - coordinates of the custom cursor's hotspot.
Emitted when the cursor's type changes. The `type` parameter can be `default`,
`crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
`ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
`ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
`row-resize`, `m-panning`, `e-panning`, `n-panning`, `ne-panning`, `nw-panning`,
`s-panning`, `se-panning`, `sw-panning`, `w-panning`, `move`, `vertical-text`,
`cell`, `context-menu`, `alias`, `progress`, `nodrop`, `copy`, `none`,
`not-allowed`, `zoom-in`, `zoom-out`, `grab`, `grabbing` or `custom`.
Emitted when the cursor's type changes. The `type` parameter can be `pointer`,
`crosshair`, `hand`, `text`, `wait`, `help`, `e-resize`, `n-resize`, `ne-resize`,
`nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`, `ns-resize`, `ew-resize`,
`nesw-resize`, `nwse-resize`, `col-resize`, `row-resize`, `m-panning`, `m-panning-vertical`,
`m-panning-horizontal`, `e-panning`, `n-panning`, `ne-panning`, `nw-panning`, `s-panning`,
`se-panning`, `sw-panning`, `w-panning`, `move`, `vertical-text`, `cell`, `context-menu`,
`alias`, `progress`, `nodrop`, `copy`, `none`, `not-allowed`, `zoom-in`, `zoom-out`, `grab`,
`grabbing`, `custom`, `null`, `drag-drop-none`, `drag-drop-move`, `drag-drop-copy`,
`drag-drop-link`, `ns-no-resize`, `ew-no-resize`, `nesw-no-resize`, `nwse-no-resize`,
or `default`.
If the `type` parameter is `custom`, the `image` parameter will hold the custom
cursor image in a [`NativeImage`](native-image.md), and `scale`, `size` and `hotspot` will hold
@@ -721,20 +713,24 @@ Returns:
* `callback` Function
* `deviceId` string
Emitted when bluetooth device needs to be selected on call to
`navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
`webBluetooth` should be enabled. If `event.preventDefault` is not called,
first available device will be selected. `callback` should be called with
`deviceId` to be selected, passing empty string to `callback` will
cancel the request.
Emitted when a bluetooth device needs to be selected when a call to
`navigator.bluetooth.requestDevice` is made. `callback` should be called with
the `deviceId` of the device to be selected. Passing an empty string to
`callback` will cancel the request.
If no event listener is added for this event, all bluetooth requests will be cancelled.
If an event listener is not added for this event, or if `event.preventDefault`
is not called when handling this event, the first available device will be
automatically selected.
```javascript
Due to the nature of bluetooth, scanning for devices when
`navigator.bluetooth.requestDevice` is called may take time and will cause
`select-bluetooth-device` to fire multiple times until `callback` is called
with either a device id or an empty string to cancel the request.
```javascript title='main.js'
const { app, BrowserWindow } = require('electron')
let win = null
app.commandLine.appendSwitch('enable-experimental-web-platform-features')
app.whenReady().then(() => {
win = new BrowserWindow({ width: 800, height: 600 })
@@ -744,6 +740,9 @@ app.whenReady().then(() => {
return device.deviceName === 'test'
})
if (!result) {
// The device wasn't found so we need to either wait longer (eg until the
// device is turned on) or cancel the request by calling the callback
// with an empty string.
callback('')
} else {
callback(result.deviceId)
@@ -896,9 +895,9 @@ e.g. the `http://` or `file://`. If the load should bypass http cache then
use the `pragma` header to achieve it.
```javascript
const { webContents } = require('electron')
const win = new BrowserWindow()
const options = { extraHeaders: 'pragma: no-cache\n' }
webContents.loadURL('https://github.com', options)
win.webContents.loadURL('https://github.com', options)
```
#### `contents.loadFile(filePath[, options])`
@@ -928,6 +927,7 @@ an app structure like this:
Would require code like this
```js
const win = new BrowserWindow()
win.loadFile('src/index.html')
```
@@ -1064,7 +1064,9 @@ when this process is unstable or unusable, for instance in order to recover
from the `unresponsive` event.
```js
contents.on('unresponsive', async () => {
const win = new BrowserWindow()
win.webContents.on('unresponsive', async () => {
const { response } = await dialog.showMessageBox({
message: 'App X has become unresponsive',
title: 'Do you want to try forcefully reloading the app?',
@@ -1072,8 +1074,8 @@ contents.on('unresponsive', async () => {
cancelId: 1
})
if (response === 0) {
contents.forcefullyCrashRenderer()
contents.reload()
win.webContents.forcefullyCrashRenderer()
win.webContents.reload()
}
})
```
@@ -1100,8 +1102,9 @@ Injects CSS into the current web page and returns a unique key for the inserted
stylesheet.
```js
contents.on('did-finish-load', () => {
contents.insertCSS('html, body { background-color: #f00; }')
const win = new BrowserWindow()
win.webContents.on('did-finish-load', () => {
win.webContents.insertCSS('html, body { background-color: #f00; }')
})
```
@@ -1115,9 +1118,11 @@ Removes the inserted CSS from the current web page. The stylesheet is identified
by its key, which is returned from `contents.insertCSS(css)`.
```js
contents.on('did-finish-load', async () => {
const key = await contents.insertCSS('html, body { background-color: #f00; }')
contents.removeInsertedCSS(key)
const win = new BrowserWindow()
win.webContents.on('did-finish-load', async () => {
const key = await win.webContents.insertCSS('html, body { background-color: #f00; }')
win.webContents.removeInsertedCSS(key)
})
```
@@ -1138,7 +1143,9 @@ this limitation.
Code execution will be suspended until web page stop loading.
```js
contents.executeJavaScript('fetch("https://jsonplaceholder.typicode.com/users/1").then(resp => resp.json())', true)
const win = new BrowserWindow()
win.webContents.executeJavaScript('fetch("https://jsonplaceholder.typicode.com/users/1").then(resp => resp.json())', true)
.then((result) => {
console.log(result) // Will be the JSON object from the fetch call
})
@@ -1169,7 +1176,7 @@ Ignore application menu shortcuts while this web contents is focused.
* `frameName` string - Name of the window provided in `window.open()`
* `features` string - Comma separated list of window features provided to `window.open()`.
* `disposition` string - Can be `default`, `foreground-tab`, `background-tab`,
`new-window`, `save-to-disk` or `other`.
`new-window` or `other`.
* `referrer` [Referrer](structures/referrer.md) - The referrer that will be
passed to the new window. May or may not result in the `Referer` header being
sent, depending on the referrer policy.
@@ -1249,7 +1256,8 @@ Sets the maximum and minimum pinch-to-zoom level.
> **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it, call:
>
> ```js
> contents.setVisualZoomLevelLimits(1, 3)
> const win = new BrowserWindow()
> win.webContents.setVisualZoomLevelLimits(1, 3)
> ```
#### `contents.undo()`
@@ -1340,12 +1348,12 @@ can be obtained by subscribing to [`found-in-page`](web-contents.md#event-found-
Stops any `findInPage` request for the `webContents` with the provided `action`.
```javascript
const { webContents } = require('electron')
webContents.on('found-in-page', (event, result) => {
if (result.finalUpdate) webContents.stopFindInPage('clearSelection')
const win = new BrowserWindow()
win.webContents.on('found-in-page', (event, result) => {
if (result.finalUpdate) win.webContents.stopFindInPage('clearSelection')
})
const requestId = webContents.findInPage('api')
const requestId = win.webContents.findInPage('api')
console.log(requestId)
```
@@ -1409,8 +1417,8 @@ Returns `Promise<PrinterInfo[]>` - Resolves with a [`PrinterInfo[]`](structures/
* `vertical` number (optional) - The vertical dpi.
* `header` string (optional) - string to be printed as page header.
* `footer` string (optional) - string to be printed as page footer.
* `pageSize` string | Size (optional) - Specify page size of the printed document. Can be `A3`,
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and `width`.
* `pageSize` string | Size (optional) - Specify page size of the printed document. Can be `A0`, `A1`, `A2`, `A3`,
`A4`, `A5`, `A6`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and `width`.
* `callback` Function (optional)
* `success` boolean - Indicates success of the print call.
* `failureReason` string - Error description called back if the print fails.
@@ -1425,6 +1433,7 @@ Use `page-break-before: always;` CSS style to force to print to a new page.
Example usage:
```js
const win = new BrowserWindow()
const options = {
silent: true,
deviceName: 'My-Printer',
@@ -1575,7 +1584,7 @@ ipcMain.on('open-devtools', (event, targetContentsId, devtoolsContentsId) => {
An example of showing devtools in a `BrowserWindow`:
```js
```js title='main.js'
const { app, BrowserWindow } = require('electron')
let win = null
@@ -1658,40 +1667,14 @@ Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
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.
:::warning
The renderer process can handle the message by listening to `channel` with the
[`ipcRenderer`](ipc-renderer.md) module.
Sending non-standard JavaScript types such as DOM objects or
special Electron objects will throw an exception.
An example of sending messages from the main process to the renderer process:
:::
```javascript
// In the main process.
const { app, BrowserWindow } = require('electron')
let win = null
app.whenReady().then(() => {
win = new BrowserWindow({ width: 800, height: 600 })
win.loadURL(`file://${__dirname}/index.html`)
win.webContents.on('did-finish-load', () => {
win.webContents.send('ping', 'whoooooooh!')
})
})
```
```html
<!-- index.html -->
<html>
<body>
<script>
require('electron').ipcRenderer.on('ping', (event, message) => {
console.log(message) // Prints 'whoooooooh!'
})
</script>
</body>
</html>
```
For additional reading, refer to [Electron's IPC guide](../tutorial/ipc.md).
#### `contents.sendToFrame(frameId, channel, ...args)`
@@ -1747,8 +1730,9 @@ For example:
```js
// Main process
const win = new BrowserWindow()
const { port1, port2 } = new MessageChannelMain()
webContents.postMessage('port', { message: 'hello' }, [port1])
win.webContents.postMessage('port', { message: 'hello' }, [port1])
// Renderer process
ipcRenderer.on('port', (e, msg) => {
@@ -1853,36 +1837,36 @@ Shows pop-up dictionary that searches the selected word on the page.
#### `contents.isOffscreen()`
Returns `boolean` - Indicates whether *offscreen rendering* is enabled.
Returns `boolean` - Indicates whether _offscreen rendering_ is enabled.
#### `contents.startPainting()`
If *offscreen rendering* is enabled and not painting, start painting.
If _offscreen rendering_ is enabled and not painting, start painting.
#### `contents.stopPainting()`
If *offscreen rendering* is enabled and painting, stop painting.
If _offscreen rendering_ is enabled and painting, stop painting.
#### `contents.isPainting()`
Returns `boolean` - If *offscreen rendering* is enabled returns whether it is currently painting.
Returns `boolean` - If _offscreen rendering_ is enabled returns whether it is currently painting.
#### `contents.setFrameRate(fps)`
* `fps` Integer
If *offscreen rendering* is enabled sets the frame rate to the specified number.
If _offscreen rendering_ is enabled sets the frame rate to the specified number.
Only values between 1 and 240 are accepted.
#### `contents.getFrameRate()`
Returns `Integer` - If *offscreen rendering* is enabled returns the current frame rate.
Returns `Integer` - If _offscreen rendering_ is enabled returns the current frame rate.
#### `contents.invalidate()`
Schedules a full repaint of the window this web contents is in.
If *offscreen rendering* is enabled invalidates the frame and generates a new
If _offscreen rendering_ is enabled invalidates the frame and generates a new
one through the `'paint'` event.
#### `contents.getWebRTCIPHandlingPolicy()`
@@ -2023,7 +2007,7 @@ The zoom factor is the zoom percent divided by 100, so 300% = 3.0.
An `Integer` property that sets the frame rate of the web contents to the specified number.
Only values between 1 and 240 are accepted.
Only applicable if *offscreen rendering* is enabled.
Only applicable if _offscreen rendering_ is enabled.
#### `contents.id` _Readonly_

View File

@@ -128,8 +128,9 @@ For example:
```js
// Main process
const win = new BrowserWindow()
const { port1, port2 } = new MessageChannelMain()
webContents.mainFrame.postMessage('port', { message: 'hello' }, [port1])
win.webContents.mainFrame.postMessage('port', { message: 'hello' }, [port1])
// Renderer process
ipcRenderer.on('port', (e, msg) => {

View File

@@ -96,13 +96,12 @@ with an array of misspelt words when complete.
An example of using [node-spellchecker][spellchecker] as provider:
```javascript
```javascript @ts-expect-error=[2,6]
const { webFrame } = require('electron')
const spellChecker = require('spellchecker')
webFrame.setSpellCheckProvider('en-US', {
spellCheck (words, callback) {
setTimeout(() => {
const spellchecker = require('spellchecker')
const misspelled = words.filter(x => spellchecker.isMisspelled(x))
callback(misspelled)
}, 0)

View File

@@ -184,6 +184,8 @@ page is loaded, use the `setUserAgent` method to change the user agent.
A `boolean`. When this attribute is present the guest page will have web security disabled.
Web security is enabled by default.
This value can only be modified before the first navigation.
### `partition`
```html
@@ -253,7 +255,7 @@ The `webview` tag has the following methods:
**Example**
```javascript
```javascript @ts-expect-error=[3]
const webview = document.querySelector('webview')
webview.addEventListener('dom-ready', () => {
webview.openDevTools()
@@ -774,7 +776,7 @@ Fired when the guest window logs a console message.
The following example code forwards all log messages to the embedder's console
without regard for log level or other properties.
```javascript
```javascript @ts-expect-error=[3]
const webview = document.querySelector('webview')
webview.addEventListener('console-message', (e) => {
console.log('Guest page logged a message:', e.message)
@@ -795,7 +797,7 @@ Returns:
Fired when a result is available for
[`webview.findInPage`](#webviewfindinpagetext-options) request.
```javascript
```javascript @ts-expect-error=[3,6]
const webview = document.querySelector('webview')
webview.addEventListener('found-in-page', (e) => {
webview.stopFindInPage('keepSelection')
@@ -821,7 +823,7 @@ It is also not emitted during in-page navigation, such as clicking anchor links
or updating the `window.location.hash`. Use `did-navigate-in-page` event for
this purpose.
Calling `event.preventDefault()` does __NOT__ have any effect.
Calling `event.preventDefault()` does **NOT** have any effect.
### Event: 'did-start-navigation'
@@ -898,7 +900,7 @@ Fired when the guest page attempts to close itself.
The following example code navigates the `webview` to `about:blank` when the
guest attempts to close itself.
```javascript
```javascript @ts-expect-error=[3]
const webview = document.querySelector('webview')
webview.addEventListener('close', () => {
webview.src = 'about:blank'
@@ -918,7 +920,7 @@ Fired when the guest page has sent an asynchronous message to embedder page.
With `sendToHost` method and `ipc-message` event you can communicate
between guest page and embedder page:
```javascript
```javascript @ts-expect-error=[4,7]
// In embedder page.
const webview = document.querySelector('webview')
webview.addEventListener('ipc-message', (event) => {
@@ -936,9 +938,22 @@ ipcRenderer.on('ping', () => {
})
```
### Event: 'crashed'
### Event: 'crashed' _Deprecated_
Fired when the renderer process is crashed.
Fired when the renderer process crashes or is killed.
**Deprecated:** This event is superceded by the `render-process-gone` event
which contains more information about why the render process disappeared. It
isn't always because it crashed.
### Event: 'render-process-gone'
Returns:
* `details` [RenderProcessGoneDetails](structures/render-process-gone-details.md)
Fired when the renderer process unexpectedly disappears. This is normally
because it was crashed or killed.
### Event: 'plugin-crashed'
@@ -1001,7 +1016,7 @@ Emitted when DevTools is closed.
Emitted when DevTools is focused / opened.
[runtime-enabled-features]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
[chrome-webview]: https://developer.chrome.com/docs/extensions/reference/webviewTag/
### Event: 'context-menu'

View File

@@ -12,8 +12,53 @@ This document uses the following convention to categorize breaking changes:
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
## Planned Breaking API Changes (24.0)
### API Changed: `nativeImage.createThumbnailFromPath(path, size)`
The `maxSize` parameter has been changed to `size` to reflect that the size passed in will be the size the thumbnail created. Previously, Windows would not scale the image up if it were smaller than `maxSize`, and
macOS would always set the size to `maxSize`. Behavior is now the same across platforms.
Updated Behavior:
```js
// a 128x128 image.
const imagePath = path.join('path', 'to', 'capybara.png')
// Scaling up a smaller image.
const upSize = { width: 256, height: 256 }
nativeImage.createThumbnailFromPath(imagePath, upSize).then(result => {
console.log(result.getSize()) // { width: 256, height: 256 }
})
// Scaling down a larger image.
const downSize = { width: 64, height: 64 }
nativeImage.createThumbnailFromPath(imagePath, downSize).then(result => {
console.log(result.getSize()) // { width: 64, height: 64 }
})
```
Previous Behavior (on Windows):
```js
// a 128x128 image
const imagePath = path.join('path', 'to', 'capybara.png')
const size = { width: 256, height: 256 }
nativeImage.createThumbnailFromPath(imagePath, size).then(result => {
console.log(result.getSize()) // { width: 128, height: 128 }
})
```
## Planned Breaking API Changes (23.0)
### Behavior Changed: Draggable Regions on macOS
The implementation of draggable regions (using the CSS property `-webkit-app-region: drag`) has changed on macOS to bring it in line with Windows and Linux. Previously, when a region with `-webkit-app-region: no-drag` overlapped a region with `-webkit-app-region: drag`, the `no-drag` region would always take precedence on macOS, regardless of CSS layering. That is, if a `drag` region was above a `no-drag` region, it would be ignored. Beginning in Electron 23, a `drag` region on top of a `no-drag` region will correctly cause the region to be draggable.
Additionally, the `customButtonsOnHover` BrowserWindow property previously created a draggable region which ignored the `-webkit-app-region` CSS property. This has now been fixed (see [#37210](https://github.com/electron/electron/issues/37210#issuecomment-1440509592) for discussion).
As a result, if your app uses a frameless window with draggable regions on macOS, the regions which are draggable in your app may change in Electron 23.
### Removed: Windows 7 / 8 / 8.1 support
[Windows 7, Windows 8, and Windows 8.1 are no longer supported](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice). Electron follows the planned Chromium deprecation policy, which will [deprecate Windows 7 support beginning in Chromium 109](https://support.google.com/chrome/thread/185534985/sunsetting-support-for-windows-7-8-8-1-in-early-2023?hl=en).
@@ -146,6 +191,39 @@ webContents.setWindowOpenHandler((details) => {
})
```
### Removed: `<webview>` `new-window` event
The `new-window` event of `<webview>` has been removed. There is no direct replacement.
```js
// Removed in Electron 22
webview.addEventListener('new-window', (event) => {})
```
```javascript fiddle='docs/fiddles/ipc/webview-new-window'
// Replace with
// main.js
mainWindow.webContents.on('did-attach-webview', (event, wc) => {
wc.setWindowOpenHandler((details) => {
mainWindow.webContents.send('webview-new-window', wc.id, details)
return { action: 'deny' }
})
})
// preload.js
const { ipcRenderer } = require('electron')
ipcRenderer.on('webview-new-window', (e, webContentsId, details) => {
console.log('webview-new-window', webContentsId, details)
document.getElementById('webview').dispatchEvent(new Event('new-window'))
})
// renderer.js
document.getElementById('webview').addEventListener('new-window', () => {
console.log('got new-window event')
})
```
### Deprecated: BrowserWindow `scroll-touch-*` events
The `scroll-touch-begin`, `scroll-touch-end` and `scroll-touch-edge` events on
@@ -236,6 +314,13 @@ webContents.printToPDF({
## Planned Breaking API Changes (20.0)
### Removed: macOS 10.11 / 10.12 support
macOS 10.11 (El Capitan) and macOS 10.12 (Sierra) are no longer supported by [Chromium](https://chromium-review.googlesource.com/c/chromium/src/+/3646050).
Older versions of Electron will continue to run on these operating systems, but macOS 10.13 (High Sierra)
or later will be required to run Electron v20.0.0 and higher.
### Default Changed: renderers without `nodeIntegration: true` are sandboxed by default
Previously, renderers that specified a preload script defaulted to being

View File

@@ -1,62 +0,0 @@
# Updating an Appveyor Azure Image
Electron CI on Windows uses AppVeyor, which in turn uses Azure VM images to run. Occasionally, these VM images need to be updated due to changes in Chromium requirements. In order to update you will need [PowerShell](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6) and the [Azure PowerShell module](https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.8.0&viewFallbackFrom=azurermps-6.13.0).
Occasionally we need to update these images owing to changes in Chromium or other miscellaneous build requirement changes.
Example Use Case:
* We need `VS15.9` and we have `VS15.7` installed; this would require us to update an Azure image.
1. Identify the image you wish to modify.
* In [appveyor.yml](https://github.com/electron/electron/blob/main/appveyor.yml), the image is identified by the property *image*.
* The names used correspond to the *"images"* defined for a build cloud, eg the [libcc-20 cloud](https://windows-ci.electronjs.org/build-clouds/8).
* Find the image you wish to modify in the build cloud and make note of the **VHD Blob Path** for that image, which is the value for that corresponding key.
* You will need this URI path to copy into a new image.
* You will also need the storage account name which is labeled in AppVeyor as the **Disk Storage Account Name**
2. Get the Azure storage account key
* Log into Azure using credentials stored in LastPass (under Azure Enterprise) and then find the storage account corresponding to the name found in AppVeyor.
* Example, for `appveyorlibccbuilds` **Disk Storage Account Name** you'd look for `appveyorlibccbuilds` in the list of storage accounts @ Home < Storage Accounts
* Click into it and look for `Access Keys`, and then you can use any of the keys present in the list.
3. Get the full virtual machine image URI from Azure
* Navigate to Home < Storage Accounts < `$ACCT_NAME` < Blobs < Images
* In the following list, look for the VHD path name you got from Appveyor and then click on it.
* Copy the whole URL from the top of the subsequent window.
4. Copy the image using the [Copy Master Image PowerShell script](https://github.com/appveyor/ci/blob/master/scripts/enterprise/copy-master-image-azure.ps1).
* It is essential to copy the VM because if you spin up a VM against an image that image cannot at the same time be used by AppVeyor.
* Use the storage account name, key, and URI obtained from Azure to run this script.
* See Step 3 for URI & when prompted, press enter to use same storage account as destination.
* Use default destination container name `(images)`
* Also, when naming the copy, use a name that indicates what the new image will contain (if that has changed) and date stamp.
* Ex. `libcc-20core-vs2017-15.9-2019-04-15.vhd`
* Go into Azure and get the URI for the newly created image as described in a previous step
5. Spin up a new VM using the [Create Master VM from VHD PowerShell](https://github.com/appveyor/ci/blob/master/scripts/enterprise/create_master_vm_from_vhd.ps1).
* From PowerShell, execute `ps1` file with `./create_master_vm_from_vhd.ps1`
* You will need the credential information available in the AppVeyor build cloud definition.
* This includes:
* Client ID
* Client Secret
* Tenant ID
* Subscription ID
* Resource Group
* Virtual Network
* You will also need to specify
* Master VM name - just a unique name to identify the temporary VM
* Master VM size - use `Standard_F32s_v2`
* Master VHD URI - use URI obtained @ end of previous step
* Location use `East US`
6. Log back into Azure and find the VM you just created in Home < Virtual Machines < `$YOUR_NEW_VM`
* You can download a RDP (Remote Desktop) file to access the VM.
7. Using Microsoft Remote Desktop, click `Connect` to connect to the VM.
* Credentials for logging into the VM are found in LastPass under the `AppVeyor Enterprise master VM` credentials.
8. Modify the VM as required.
9. Shut down the VM and then delete it in Azure.
10. Add the new image to the Appveyor Cloud settings or modify an existing image to point to the new VHD.

View File

@@ -18,8 +18,8 @@ See also [V8 Development](v8-development.md)
### Code Resources
- [Code Search](https://cs.chromium.org/) - Indexed and searchable source code for Chromium and associated projects.
- [Source Code](https://cs.chromium.org/chromium/src/) - The source code for Chromium itself.
- [Code Search](https://source.chromium.org/chromium) - Indexed and searchable source code for Chromium and associated projects.
- [Source Code](https://source.chromium.org/chromium/chromium/src) - The source code for Chromium itself.
- [Chromium Review](https://chromium-review.googlesource.com) - The searchable code host which facilitates code reviews for Chromium and related projects.
### Informational Resources

View File

@@ -49,7 +49,7 @@ formatted correctly.
* Write [standard](https://www.npmjs.com/package/standard) JavaScript style.
* File names should be concatenated with `-` instead of `_`, e.g.
`file-name.js` rather than `file_name.js`, because in
[github/atom](https://github.com/github/atom) module names are usually in
[atom/atom](https://github.com/atom/atom) module names are usually in
the `module-name` form. This rule only applies to `.js` files.
* Use newer ES6/ES2015 syntax where appropriate
* [`const`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const)

View File

@@ -158,7 +158,7 @@ We will need to create a new TypeScript file in the path that follows:
`"lib/browser/api/{electron_browser_{api_name}}.ts"`
An example of the contents of this file can be found [here](https://github.com/electron/electron/blob/main/lib/browser/api/native-image.ts).
An example of the contents of this file can be found [here](https://github.com/electron/electron/blob/main/lib/browser/api/native-theme.ts).
### Expose your module to TypeScript

View File

@@ -89,12 +89,12 @@ For an introduction to ProcMon's basic and advanced debugging features, go check
out [this video tutorial][procmon-instructions] provided by Microsoft.
[sys-internals]: https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx
[procmon-instructions]: https://channel9.msdn.com/shows/defrag-tools/defrag-tools-4-process-monitor
[procmon-instructions]: https://learn.microsoft.com/en-us/shows/defrag-tools/4-process-monitor
## Using WinDbg
<!-- TODO(@codebytere): add images and more information here? -->
It's possible to debug crashes and issues in the Renderer process with [WinDbg](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/getting-started-with-windbg).
It's possible to debug crashes and issues in the Renderer process with [WinDbg](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/getting-started-with-windbg).
To attach to a debug a process with WinDbg:

View File

@@ -44,7 +44,7 @@ machine you can monitor compile jobs as they flow through the goma system.
For security and cost reasons, access to Electron's Goma cluster is currently restricted
to Electron Maintainers. If you want access please head to `#access-requests` in
Slack and ping `@goma-squad` to ask for access. Please be aware that being a
maintainer does not *automatically* grant access and access is determined on a
maintainer does not _automatically_ grant access and access is determined on a
case by case basis.
## Uptime / Support

View File

@@ -57,7 +57,7 @@ unfriendly.
Contributors are encouraged to solve issues collaboratively and help one
another make progress. If you encounter an issue that you feel is invalid, or
which contains incorrect information, explain *why* you feel that way with
which contains incorrect information, explain _why_ you feel that way with
additional supporting context, and be willing to be convinced that you may
be wrong. By doing so, we can often reach the correct outcome faster.

View File

@@ -219,7 +219,7 @@ of the area you modified in order to land. Whenever a maintainer reviews a pull
request they may request changes. These may be small, such as fixing a typo, or
may involve substantive changes. Such requests are intended to be helpful, but
at times may come across as abrupt or unhelpful, especially if they do not include
concrete suggestions on *how* to change them.
concrete suggestions on _how_ to change them.
Try not to be discouraged. If you feel that a review is unfair, say so or seek
the input of another project contributor. Often such comments are the result of

View File

@@ -79,7 +79,7 @@ the Node.js source tree.
#### Missing fonts
[Some Windows 10 devices](https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list) do not ship with the Meiryo font installed, which may cause a font fallback test to fail. To install Meiryo:
[Some Windows 10 devices](https://learn.microsoft.com/en-us/typography/fonts/windows_10_font_list) do not ship with the Meiryo font installed, which may cause a font fallback test to fail. To install Meiryo:
1. Push the Windows key and search for _Manage optional features_.
2. Click _Add a feature_.

View File

@@ -60,7 +60,7 @@ garbage collected.
If you encounter this problem, the following articles may prove helpful:
* [Memory Management][memory-management]
* [Variable Scope][variable-scope]
* [Closures][closures]
If you want a quick fix, you can make the variables global by changing your
code from this:
@@ -153,7 +153,7 @@ The effect is visible only on (some?) LCD screens. Even if you don't see a diffe
Notice that just setting the background in the CSS does not have the desired effect.
[memory-management]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management
[variable-scope]: https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx
[closures]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures
[storage]: https://developer.mozilla.org/en-US/docs/Web/API/Storage
[local-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
[session-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage

View File

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

View File

@@ -3,7 +3,7 @@ const { app, BrowserWindow, globalShortcut } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
height: 600
})
win.loadFile('index.html')

View File

@@ -3,7 +3,7 @@ const { app, BrowserWindow, Menu, MenuItem } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
height: 600
})
win.loadFile('index.html')

View File

@@ -1,17 +1,15 @@
// Modules to control application life and create native browser window
const {app, BrowserWindow} = require('electron')
const path = require('path')
const { app, BrowserWindow } = require('electron')
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
height: 600
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
}
// This method will be called when Electron has finished

View File

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

View File

@@ -3,7 +3,7 @@ const { app, BrowserWindow, Menu } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
height: 600
})
win.loadFile('index.html')

View File

@@ -2,5 +2,5 @@ const NOTIFICATION_TITLE = 'Title'
const NOTIFICATION_BODY = 'Notification from the Renderer process. Click to log to console.'
const CLICK_MESSAGE = 'Notification clicked!'
new Notification(NOTIFICATION_TITLE, { body: NOTIFICATION_BODY })
.onclick = () => document.getElementById("output").innerText = CLICK_MESSAGE
new window.Notification(NOTIFICATION_TITLE, { body: NOTIFICATION_BODY })
.onclick = () => { document.getElementById('output').innerText = CLICK_MESSAGE }

View File

@@ -4,16 +4,31 @@ const path = require('path')
app.disableHardwareAcceleration()
let win
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
offscreen: true
}
})
app.whenReady().then(() => {
win = new BrowserWindow({ webPreferences: { offscreen: true } })
win.loadURL('https://github.com')
win.webContents.on('paint', (event, dirty, image) => {
fs.writeFileSync('ex.png', image.toPNG())
})
win.webContents.setFrameRate(60)
console.log(`The screenshot has been successfully saved to ${path.join(process.cwd(), 'ex.png')}`)
}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
app.on('window-all-closed', () => {
@@ -21,9 +36,3 @@ app.on('window-all-closed', () => {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -1,5 +1,5 @@
const { app, BrowserWindow } = require('electron')
const os = require('os');
const os = require('os')
function createWindow () {
const win = new BrowserWindow({

View File

@@ -9,6 +9,7 @@
<h1>Web Bluetooth API</h1>
<button id="clickme">Test Bluetooth</button>
<button id="cancel">Cancel Bluetooth Request</button>
<p>Currently selected bluetooth device: <strong id="device-name""></strong></p>

View File

@@ -1,6 +1,9 @@
const {app, BrowserWindow, ipcMain} = require('electron')
const { app, BrowserWindow, ipcMain } = require('electron')
const path = require('path')
let bluetoothPinCallback
let selectBluetoothCallback
function createWindow () {
const mainWindow = new BrowserWindow({
width: 800,
@@ -12,18 +15,28 @@ function createWindow () {
mainWindow.webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
event.preventDefault()
if (deviceList && deviceList.length > 0) {
callback(deviceList[0].deviceId)
selectBluetoothCallback = callback
const result = deviceList.find((device) => {
return device.deviceName === 'test'
})
if (result) {
callback(result.deviceId)
} else {
// The device wasn't found so we need to either wait longer (eg until the
// device is turned on) or until the user cancels the request
}
})
ipcMain.on('cancel-bluetooth-request', (event) => {
selectBluetoothCallback('')
})
// Listen for a message from the renderer to get the response for the Bluetooth pairing.
ipcMain.on('bluetooth-pairing-response', (event, response) => {
bluetoothPinCallback(response)
})
mainWindow.webContents.session.setBluetoothPairingHandler((details, callback) => {
bluetoothPinCallback = callback
// Send a message to the renderer to prompt the user to confirm the pairing.
mainWindow.webContents.send('bluetooth-pairing-request', details)

View File

@@ -1,6 +1,7 @@
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('electronAPI', {
cancelBluetoothRequest: (callback) => ipcRenderer.send('cancel-bluetooth-request', callback),
bluetoothPairingRequest: (callback) => ipcRenderer.on('bluetooth-pairing-request', callback),
bluetoothPairingResponse: (response) => ipcRenderer.send('bluetooth-pairing-response', response)
})
})

View File

@@ -1,26 +1,32 @@
async function testIt() {
async function testIt () {
const device = await navigator.bluetooth.requestDevice({
acceptAllDevices: true
})
document.getElementById('device-name').innerHTML = device.name || `ID: ${device.id}`
}
document.getElementById('clickme').addEventListener('click',testIt)
document.getElementById('clickme').addEventListener('click', testIt)
function cancelRequest () {
window.electronAPI.cancelBluetoothRequest()
}
document.getElementById('cancel').addEventListener('click', cancelRequest)
window.electronAPI.bluetoothPairingRequest((event, details) => {
const response = {}
switch (details.pairingKind) {
case 'confirm': {
response.confirmed = confirm(`Do you want to connect to device ${details.deviceId}?`)
response.confirmed = window.confirm(`Do you want to connect to device ${details.deviceId}?`)
break
}
case 'confirmPin': {
response.confirmed = confirm(`Does the pin ${details.pin} match the pin displayed on device ${details.deviceId}?`)
response.confirmed = window.confirm(`Does the pin ${details.pin} match the pin displayed on device ${details.deviceId}?`)
break
}
case 'providePin': {
const pin = prompt(`Please provide a pin for ${details.deviceId}.`)
const pin = window.prompt(`Please provide a pin for ${details.deviceId}.`)
if (pin) {
response.pin = pin
response.confirmed = true
@@ -31,4 +37,4 @@ window.electronAPI.bluetoothPairingRequest((event, details) => {
}
window.electronAPI.bluetoothPairingResponse(response)
})
})

View File

@@ -1,5 +1,4 @@
const {app, BrowserWindow} = require('electron')
const path = require('path')
const { app, BrowserWindow } = require('electron')
function createWindow () {
const mainWindow = new BrowserWindow({
@@ -8,16 +7,16 @@ function createWindow () {
})
mainWindow.webContents.session.on('select-hid-device', (event, details, callback) => {
//Add events to handle devices being added or removed before the callback on
//`select-hid-device` is called.
// Add events to handle devices being added or removed before the callback on
// `select-hid-device` is called.
mainWindow.webContents.session.on('hid-device-added', (event, device) => {
console.log('hid-device-added FIRED WITH', device)
//Optionally update details.deviceList
// Optionally update details.deviceList
})
mainWindow.webContents.session.on('hid-device-removed', (event, device) => {
console.log('hid-device-removed FIRED WITH', device)
//Optionally update details.deviceList
// Optionally update details.deviceList
})
event.preventDefault()

View File

@@ -1,4 +1,4 @@
async function testIt() {
async function testIt () {
const grantedDevices = await navigator.hid.getDevices()
let grantedDeviceList = ''
grantedDevices.forEach(device => {
@@ -10,10 +10,10 @@ async function testIt() {
})
grantedDeviceList = ''
grantedDevices2.forEach(device => {
grantedDevices2.forEach(device => {
grantedDeviceList += `<hr>${device.productName}</hr>`
})
document.getElementById('granted-devices2').innerHTML = grantedDeviceList
}
document.getElementById('clickme').addEventListener('click',testIt)
document.getElementById('clickme').addEventListener('click', testIt)

View File

@@ -1,5 +1,4 @@
const {app, BrowserWindow} = require('electron')
const path = require('path')
const { app, BrowserWindow } = require('electron')
function createWindow () {
const mainWindow = new BrowserWindow({
@@ -8,24 +7,24 @@ function createWindow () {
})
mainWindow.webContents.session.on('select-serial-port', (event, portList, webContents, callback) => {
//Add listeners to handle ports being added or removed before the callback for `select-serial-port`
//is called.
// Add listeners to handle ports being added or removed before the callback for `select-serial-port`
// is called.
mainWindow.webContents.session.on('serial-port-added', (event, port) => {
console.log('serial-port-added FIRED WITH', port)
//Optionally update portList to add the new port
// Optionally update portList to add the new port
})
mainWindow.webContents.session.on('serial-port-removed', (event, port) => {
console.log('serial-port-removed FIRED WITH', port)
//Optionally update portList to remove the port
// Optionally update portList to remove the port
})
event.preventDefault()
if (portList && portList.length > 0) {
callback(portList[0].portId)
} else {
callback('') //Could not find any matching devices
// eslint-disable-next-line n/no-callback-literal
callback('') // Could not find any matching devices
}
})

View File

@@ -1,11 +1,11 @@
async function testIt() {
async function testIt () {
const filters = [
{ usbVendorId: 0x2341, usbProductId: 0x0043 },
{ usbVendorId: 0x2341, usbProductId: 0x0001 }
];
]
try {
const port = await navigator.serial.requestPort({filters});
const portInfo = port.getInfo();
const port = await navigator.serial.requestPort({ filters })
const portInfo = port.getInfo()
document.getElementById('device-name').innerHTML = `vendorId: ${portInfo.usbVendorId} | productId: ${portInfo.usbProductId} `
} catch (ex) {
if (ex.name === 'NotFoundError') {
@@ -16,4 +16,4 @@ async function testIt() {
}
}
document.getElementById('clickme').addEventListener('click',testIt)
document.getElementById('clickme').addEventListener('click', testIt)

View File

@@ -1,6 +1,4 @@
const {app, BrowserWindow} = require('electron')
const e = require('express')
const path = require('path')
const { app, BrowserWindow } = require('electron')
function createWindow () {
const mainWindow = new BrowserWindow({
@@ -11,24 +9,22 @@ function createWindow () {
let grantedDeviceThroughPermHandler
mainWindow.webContents.session.on('select-usb-device', (event, details, callback) => {
//Add events to handle devices being added or removed before the callback on
//`select-usb-device` is called.
// Add events to handle devices being added or removed before the callback on
// `select-usb-device` is called.
mainWindow.webContents.session.on('usb-device-added', (event, device) => {
console.log('usb-device-added FIRED WITH', device)
//Optionally update details.deviceList
// Optionally update details.deviceList
})
mainWindow.webContents.session.on('usb-device-removed', (event, device) => {
console.log('usb-device-removed FIRED WITH', device)
//Optionally update details.deviceList
// Optionally update details.deviceList
})
event.preventDefault()
if (details.deviceList && details.deviceList.length > 0) {
const deviceToReturn = details.deviceList.find((device) => {
if (!grantedDeviceThroughPermHandler || (device.deviceId != grantedDeviceThroughPermHandler.deviceId)) {
return true
}
const deviceToReturn = details.deviceList.find((device) => {
return !grantedDeviceThroughPermHandler || (device.deviceId !== grantedDeviceThroughPermHandler.deviceId)
})
if (deviceToReturn) {
callback(deviceToReturn.deviceId)
@@ -44,7 +40,6 @@ function createWindow () {
}
})
mainWindow.webContents.session.setDevicePermissionHandler((details) => {
if (details.deviceType === 'usb' && details.origin === 'file://') {
if (!grantedDeviceThroughPermHandler) {
@@ -56,6 +51,13 @@ function createWindow () {
}
})
mainWindow.webContents.session.setUSBProtectedClassesHandler((details) => {
return details.protectedClasses.filter((usbClass) => {
// Exclude classes except for audio classes
return usbClass.indexOf('audio') === -1
})
})
mainWindow.loadFile('index.html')
}

View File

@@ -1,8 +1,8 @@
function getDeviceDetails(device) {
return grantedDevice.productName || `Unknown device ${grantedDevice.deviceId}`
function getDeviceDetails (device) {
return device.productName || `Unknown device ${device.deviceId}`
}
async function testIt() {
async function testIt () {
const noDevicesFoundMsg = 'No devices found'
const grantedDevices = await navigator.usb.getDevices()
let grantedDeviceList = ''
@@ -20,8 +20,7 @@ async function testIt() {
const grantedDevice = await navigator.usb.requestDevice({
filters: []
})
grantedDeviceList += `<hr>${getDeviceDetails(device)}</hr>`
grantedDeviceList += `<hr>${getDeviceDetails(grantedDevice)}</hr>`
} catch (ex) {
if (ex.name === 'NotFoundError') {
grantedDeviceList = noDevicesFoundMsg
@@ -30,4 +29,4 @@ async function testIt() {
document.getElementById('granted-devices2').innerHTML = grantedDeviceList
}
document.getElementById('clickme').addEventListener('click',testIt)
document.getElementById('clickme').addEventListener('click', testIt)

View File

@@ -1,4 +1,4 @@
const {app, BrowserWindow, ipcMain} = require('electron')
const { app, BrowserWindow, ipcMain } = require('electron')
const path = require('path')
function createWindow () {

View File

@@ -1,5 +1,5 @@
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('electronAPI', {
setTitle: (title) => ipcRenderer.send('set-title', title)
setTitle: (title) => ipcRenderer.send('set-title', title)
})

View File

@@ -1,6 +1,6 @@
const setButton = document.getElementById('btn')
const titleInput = document.getElementById('title')
setButton.addEventListener('click', () => {
const title = titleInput.value
window.electronAPI.setTitle(title)
});
const title = titleInput.value
window.electronAPI.setTitle(title)
})

View File

@@ -1,11 +1,9 @@
const {app, BrowserWindow, ipcMain, dialog} = require('electron')
const { app, BrowserWindow, ipcMain, dialog } = require('electron')
const path = require('path')
async function handleFileOpen() {
async function handleFileOpen () {
const { canceled, filePaths } = await dialog.showOpenDialog()
if (canceled) {
return
} else {
if (!canceled) {
return filePaths[0]
}
}

View File

@@ -1,5 +1,5 @@
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('electronAPI',{
contextBridge.exposeInMainWorld('electronAPI', {
openFile: () => ipcRenderer.invoke('dialog:openFile')
})

View File

@@ -1,4 +1,4 @@
const {app, BrowserWindow, Menu, ipcMain} = require('electron')
const { app, BrowserWindow, Menu, ipcMain } = require('electron')
const path = require('path')
function createWindow () {
@@ -12,14 +12,14 @@ function createWindow () {
{
label: app.name,
submenu: [
{
click: () => mainWindow.webContents.send('update-counter', 1),
label: 'Increment',
},
{
click: () => mainWindow.webContents.send('update-counter', -1),
label: 'Decrement',
}
{
click: () => mainWindow.webContents.send('update-counter', 1),
label: 'Increment'
},
{
click: () => mainWindow.webContents.send('update-counter', -1),
label: 'Decrement'
}
]
}

View File

@@ -1,8 +1,8 @@
const counter = document.getElementById('counter')
window.electronAPI.handleCounter((event, value) => {
const oldValue = Number(counter.innerText)
const newValue = oldValue + value
counter.innerText = newValue
event.sender.send('counter-value', newValue)
const oldValue = Number(counter.innerText)
const newValue = oldValue + value
counter.innerText = newValue
event.sender.send('counter-value', newValue)
})

View File

@@ -0,0 +1,3 @@
<body>
<a href="child.html" target="_blank">new window</a>
</body>

View File

@@ -0,0 +1,4 @@
<body>
<webview id=webview src="child.html" allowpopups></webview>
<script src="renderer.js"></script>
</body>

View File

@@ -0,0 +1,51 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow } = require('electron')
const path = require('path')
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
webviewTag: true
}
})
mainWindow.webContents.on('did-attach-webview', (event, wc) => {
wc.setWindowOpenHandler((details) => {
mainWindow.webContents.send('webview-new-window', wc.id, details)
return { action: 'deny' }
})
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

View File

@@ -0,0 +1,6 @@
const { ipcRenderer } = require('electron')
const webview = document.getElementById('webview')
ipcRenderer.on('webview-new-window', (e, webContentsId, details) => {
console.log('webview-new-window', webContentsId, details)
webview.dispatchEvent(new Event('new-window'))
})

View File

@@ -0,0 +1,4 @@
const webview = document.getElementById('webview')
webview.addEventListener('new-window', () => {
console.log('got new-window event')
})

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