Compare commits

..

101 Commits

Author SHA1 Message Date
electron-roller[bot]
4ceb644723 chore: bump chromium to 118.0.5993.89 (27-x-y) (#40240)
chore: bump chromium in DEPS to 118.0.5993.89

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2023-10-18 10:19:01 -04:00
trop[bot]
ae212f41ab fix: Windows Toast notification dismissal from Action Center (#40244)
* fix: Windows Toast notification dismissal from Action Center

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

* docs: note Toast behavior in event

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

* chore: address 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-10-18 10:03:54 +02:00
trop[bot]
1f64b7869c refactor: partition HidDelegate observers by browser context (#40237)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-10-17 18:58:59 -04:00
electron-roller[bot]
f282bdac65 chore: bump chromium to 118.0.5993.71 (27-x-y) (#40235)
chore: bump chromium in DEPS to 118.0.5993.71

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2023-10-17 18:58:40 -04:00
trop[bot]
c0ad9e154f docs: Update docs on testing Electron apps with WebdriverIO (#40226)
* docs: Updated docs on testing Electron using WebdriverIO

Co-authored-by: Christian Bromann <github@christian-bromann.com>

* Update docs/tutorial/automated-testing.md

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

Co-authored-by: Christian Bromann <github@christian-bromann.com>

* Update docs/tutorial/automated-testing.md

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

Co-authored-by: Christian Bromann <github@christian-bromann.com>

* more updates

Co-authored-by: Christian Bromann <git@bromann.dev>

* address PR comments

Co-authored-by: Christian Bromann <git@bromann.dev>

* Update docs/tutorial/automated-testing.md

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

Co-authored-by: Christian Bromann <github@christian-bromann.com>

* Update docs/tutorial/automated-testing.md

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

Co-authored-by: Christian Bromann <github@christian-bromann.com>

* Update docs/tutorial/automated-testing.md

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

Co-authored-by: Christian Bromann <github@christian-bromann.com>

* Update docs/tutorial/automated-testing.md

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

Co-authored-by: Christian Bromann <github@christian-bromann.com>

* Update docs/tutorial/automated-testing.md

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

Co-authored-by: Christian Bromann <github@christian-bromann.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Christian Bromann <github@christian-bromann.com>
Co-authored-by: Christian Bromann <git@bromann.dev>
2023-10-17 16:54:45 +02:00
trop[bot]
6304ea53ef fix: incorrect wco bounds in macOS fullscreen (#40217)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-10-16 13:11:37 +02:00
David Sanders
4c1e53dfa6 docs: fix some string union typings (#40202) 2023-10-16 14:10:10 +09:00
trop[bot]
96f9cc5157 fix: store portal restore token under the right source ID (#40193)
XDG Desktop Portal provides restore tokens to restore a previously
selected PipeWire stream instead of prompting the user again. This
restore token is single use only and it has to be replaced when the
stream is completed/stopped.

BaseCapturerPipewire maintains two source IDs: one is initialized by
the constructor for new sources (source_id_) and another is for
capturing previously selected sources (selected_source_id_). The
restore token was always being stored under `source_id_`, even if the
capture was ongoing for `selected_source_id_`. This prevents a stream
from being restored more than once. Fix that by storing the restore
token under the selected source ID if it exists.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Athul Iddya <athul@iddya.com>
2023-10-13 22:09:05 +02:00
trop[bot]
8890ab5119 fix: webContents.capturePage() for hidden windows on Windows/Linux (#40188)
fix: capturePage for hidden windows on Windows/Linux

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-10-12 13:54:48 +02:00
electron-roller[bot]
4bb80df378 chore: bump chromium to 118.0.5993.70 (27-x-y) (#40175)
* chore: bump chromium in DEPS to 118.0.5993.70

* 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-10-11 14:34:43 -04:00
trop[bot]
3d10512399 docs: update dates for E28 (#40168)
* docs: update dates for E28

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

* docs: update node version

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

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2023-10-11 09:27:21 -07:00
trop[bot]
30305e4f2b test: make capturePage color matching timeouts consistent (#40166)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-10-10 19:26:20 -04:00
trop[bot]
40c21e02da fix: crash when calling non-reentrant function in loadURL (#40162)
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 11:49:22 -04:00
trop[bot]
6de96fb83b ci: fixup diagnose_goma_log.py call (#40149)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-10-09 18:44:51 -04:00
trop[bot]
cf0e974ce1 fix: failing build with enable_electron_extensions=false (#40087)
* fix: ENABLE_EXTENSIONS -> ENABLE_ELECTRON_EXTENSIONS

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

* fix: extension guard fixes

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

* chore: fix linker errors

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-10-09 18:43:40 -04:00
trop[bot]
7e2073226a fix: crashed events deprecation (#40111)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-10-09 15:19:53 +02:00
trop[bot]
8f370cd2e3 fix: fix vibrancy applying without transparency on MacOS (#40130)
* fix: fix vibrancy applying without transparency

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

* fix: initiate backgroundMaterial and vibrancy earlier in native window

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

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-10-09 15:19:30 +02:00
Milan Burda
82d4e9427f test: fix "crashed event does not crash main process when destroying WebContents in it" (#40144) 2023-10-09 15:18:46 +02:00
trop[bot]
f0b742f2d6 test: add back smoke test for removed API (#40139)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-10-09 15:41:39 +09:00
trop[bot]
2bc07b098b chore: cherry-pick c03569f from libuv (#40126)
* chore: cherry-pick c03569f from libuv

Refs c03569f0df

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

* chore: update .patches

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-10-09 08:45:34 +09:00
trop[bot]
d95f28c194 fix: toggling DevTools while minimized on Windows (#40116)
fix: toggling devtools while minimized on Windows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-10-06 11:46:55 -04:00
trop[bot]
22ea11175b fix: error using webcrypto.subtle.importKey() (#40100)
* fix: error using webcrypto.subtle.importKey()

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: John Kleinschmidt <jkleinsc@electronjs.org>
2023-10-06 10:42:49 -04:00
trop[bot]
5b44e82eb4 fix: all children showing when showing child window (#40105)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-10-06 09:56:23 -04:00
electron-roller[bot]
4c4a3e7594 chore: bump chromium to 118.0.5993.54 (27-x-y) (#40103)
* chore: bump chromium in DEPS to 118.0.5993.54

* 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-10-05 19:53:06 -04:00
trop[bot]
bf7474d3f4 feat: add tabbingIdentifier property to BrowserWindow (#40082)
feat: add tabbingIdentifier property to BrowserWindow

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-10-05 09:13:05 -04:00
George Xu
3f142ad039 feat: expose app accessibility transparency settings api (#40074)
feat: expose app accessibility transparency settings api (#39631)

* feat: expose app accessibility transparency settings api

* docs: fix typo

* chore: add doc

* change to property

* add as property instead of method

* chore: fix lint

* rename function name in header

---------

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2023-10-04 16:36:04 -07:00
electron-roller[bot]
10db23828e chore: bump chromium to 118.0.5993.32 (27-x-y) (#40044)
* chore: bump chromium in DEPS to 118.0.5993.32

* 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>
2023-10-02 14:37:40 -04:00
trop[bot]
43ba54e61f docs: add PipeWire integration instructions for snaps (#40068)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Athul Iddya <athul@iddya.com>
2023-10-02 11:05:52 -04:00
trop[bot]
3fdfcbb5dd chore: update extensions url handling to match upstream (#40063)
- https://chromium-review.googlesource.com/c/chromium/src/+/4772028
- https://chromium-review.googlesource.com/c/chromium/src/+/4264656
- https://chromium-review.googlesource.com/c/chromium/src/+/4712150

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-10-02 13:12:47 +02:00
trop[bot]
9e8cba981a fix: BroadcastChannel initialization location (#40067)
fix: `BroadcastChannel` initialization location (#37421)

* 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-10-02 13:10:46 +02:00
trop[bot]
a85c6cf0e5 fix: detect screen readers by testing their existences (#40065)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2023-10-02 13:07:27 +02:00
trop[bot]
7e536dfd8e fix: propagate layout call to all children of InspectableWebContentsViewViews (#40037)
Propagate layout call to all children of InspectableWebContentsViewViews.

When BrowserView bounds are set from js, those might not trigger layout
immediately, sometimes propagating InvalidateLayout call to parent.
View is marked as needing layout, expecting to receive it from parent on
next layout call. The problem is that BrowserView's view is added as child
of InspectableWebContentsViews which does not call setBounds (which
would trigger layout) on all of it's children when doing it's layout,
so it skips propagating Layout call to its children BrowserViews views,
even though those were marked as needing layout.
Call base class View::Layout which will iterate over views' children
and call Layout on those that were marked as needing them.

Fixes #39993.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Marek Haranczyk <marek@openfin.co>
2023-09-28 18:55:24 -04:00
trop[bot]
7d21d113d2 fix: failure on immutable webContents.print(options) (#40030)
fix: failure on immutable webContents.print(options)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-09-28 12:48:44 -04:00
Samuel Attard
7ed33db12e chore: cherry-pick 3fbd1dca6a4d from libvpx (#40022)
* 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:31:46 -07:00
trop[bot]
66c4f9cb6f fix: rounded corners on vibrant macOS modals (#39996)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-09-28 10:33:39 +02:00
trop[bot]
a00155dcfc fix: set window contents as opaque to decrease DWM GPU usage (#40003)
* set window contents as opaque to decrease DWM GPU usage

Co-authored-by: brhenrique <bruno.d@miro.com>

* chore: add more context to ShouldWindowContentsBeTransparent

Co-authored-by: brhenrique <bruno.d@miro.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: brhenrique <bruno.d@miro.com>
2023-09-28 10:33:29 +02:00
trop[bot]
3e4adb91c5 feat: enable dark mode on GTK UIs (#40010)
feat: port DarkModeManagerLinux

This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: https://github.com/electron/electron/issues/38961
Closes: https://github.com/electron/electron/issues/28838

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Robert Günzler <r@gnzler.io>
2023-09-27 16:44:34 -04:00
trop[bot]
f63f02fbb2 docs: document type-specific module aliases (#40005)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2023-09-27 16:35:32 -04:00
trop[bot]
a3a6e8ff26 build: fix with enable_pdf_viewer = false (#40001)
build: fix with enable_pdf_viewer = false

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-09-27 19:57:48 +02:00
trop[bot]
e70a25d5a3 fix: apply size constraints to NSWindow (#39992)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2023-09-27 16:54:19 +02:00
Keeley Hammond
8e2cf54f29 fix: revert SameParty cookie attribute removal (#39976) 2023-09-26 14:17:23 -07:00
trop[bot]
a3614983de chore: add deprecated app.runningUnderRosettaTranslation to breaking-changes.md (#39984)
chore: add deprecated app.runningUnderRosettaTranslation to breaking-changes.md

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-09-26 16:57:42 -04:00
David Sanders
686adf9d15 chore: remove deprecated systemPreferences APIs (#39804)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-26 14:45:49 +09:00
John Kleinschmidt
25dccaa1b1 test: fixup parallel/test-node-output-error test (#39973) 2023-09-25 17:03:41 -04:00
trop[bot]
175cd9111e refactor: use type enum in file stats for asar archive (#39968)
refactor: use type enum in file stats for asar archive (#39889)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-09-25 11:14:05 -04:00
trop[bot]
70236258cf docs: correct v24 Alpha date (#39966)
docs: correct v27 Alpha date

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Leon <xuminjieleon@163.com>
2023-09-25 12:43:16 +02:00
electron-roller[bot]
d0d9011fc9 chore: bump chromium to 118.0.5993.18 (27-x-y) (#39943)
* chore: bump chromium in DEPS to 118.0.5993.18

* 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-09-22 10:04:12 +02:00
trop[bot]
8423a014ed chore: cherry-pick tls shutdown crash fix from upstream (#39947)
* chore: cherry-pick tls shutdown crash fix from upstream

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

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-21 19:39:21 +02:00
trop[bot]
4ba1b219a5 fix: app.runningUnderARM64Translation() always returning true on Windows ARM64 (#39931)
fix: app.runningUnderARM64Translation() always returning true on ARM64

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-09-21 10:09:17 -04:00
trop[bot]
e721b683bf ci: fix linux builds of forks (#39940)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-21 10:07:51 -04:00
John Kleinschmidt
271be9c8e4 chore: fixup node flakes (#39917)
(cherry picked from commit 80a9b9d654)
2023-09-19 15:29:00 -04:00
trop[bot]
946df59915 build: use afs on aks instead of circle cache (#39910)
* 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: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2023-09-19 10:51:41 -04:00
trop[bot]
77a02d858b docs: add a more detailed explanation to cookies.flushStore() (#39904)
* docs: cookies.flushStore()

Co-authored-by: Spencer17x <1253478653@qq.com>

* docs: modify cookies.flushStore()

Co-authored-by: Spencer17x <1253478653@qq.com>

* Update docs/api/cookies.md

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

Co-authored-by: spencer17x <1253478653@qq.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Spencer17x <1253478653@qq.com>
2023-09-19 15:48:08 +02:00
trop[bot]
f648dbe081 build: fixup autoninja (#39902)
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:35:51 -04:00
trop[bot]
c572477606 fix: prevent gin_helper::Locker heap allocation (#39872)
fix: prevent gin_helper::Locker heap allocation

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-09-18 13:19:42 -04:00
trop[bot]
3b07ed95a4 build: run on circle hosts for forks (#39868)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2023-09-18 11:07:06 -04:00
trop[bot]
d689830214 fix: check PipeWire init before creating generic capturer (#39874)
Check if PipeWire can be initialized before creating generic capturer.
This harmonizes the conditions with the ones used in Linux
implementations of DesktopCapturer::CreateRawScreenCapturer and
DesktopCapturer::CreateRawWindowCapturer.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Athul Iddya <athul@iddya.com>
2023-09-15 20:23:58 +02:00
electron-roller[bot]
e53d5f4949 chore: bump chromium to 118.0.5993.11 (27-x-y) (#39854)
* chore: bump chromium in DEPS to 118.0.5993.11

* 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>
2023-09-14 14:43:14 -04:00
Charles Kerr
6a59b373a6 refactor: remove unused Locker fields (#39842)
refactor: remove unused fields, methods in gin_helper::Locker (#39803)

* refactor: remove unused field gin_helper::Locker::g_is_browser_process

refactor: remove unused field gin_helper::Locker::g_is_renderer_process

refactor: make field const gin_helper::Locker::locker_

* refactor: remove unused declaration gin_helper::Locker::new()

refactor: remove unused declaration gin_helper::Locker::delete()

* refactor: make field const electron::JavascriptEnvironment::locker_

* refactor: remove unused #include gin_helper/locker.h
2023-09-13 09:52:39 +02:00
trop[bot]
036a382d66 fix: NodeService order-of-destruction issue (#39829)
* refactor: make ElectronRendererClient::node_bindings_ a const ptr

refactor: make ElectronRendererClient::electron_bindings_ a const ptr

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

* fix: order-of-destruction bug in NodeService

js_env_ depends on the uv_loop from node_bindings_, but is destroyed after node_bindings_

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

* chore: revert unintentional commit

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-09-12 16:53:33 -07:00
Samuel Attard
c4a54202b9 chore: cherry-pick b2eab7500a18 from chromium (#39823)
* chore: cherry-pick b2eab7500a18 from chromium

* chore: update patch

* chore: update patches

---------

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-12 11:44:00 -07:00
trop[bot]
c128893a4c fix: keyCodes being incorrectly converted in webContents.sendInputEvent() (#39822)
fix: sendInputEvent keyCodes being incorrectly converted

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-09-12 16:03:41 +02:00
trop[bot]
b9e0f097bd fix: ensure app load is limited to real asar files when appropriate (#39807)
* fix: ensure app load is limited to real asar files when appropriate

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

* chore: update line numbers in node test

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-09-11 17:23:56 -07:00
trop[bot]
78a99d673e build: update @electron/typescript-definitions to fix titlebaroverlay (#39806)
build: update @electron/typescript-definitions to fix titlebarstyle

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-09-11 14:03:51 -07:00
trop[bot]
75f5706d6c fix: frameless mica/acrylic windows (#39802)
* fix: backgroundMaterial works with frameless

* TODO: fix frameless mica/acrylic windows

* update caption color appropriately

* set background color properly

* refactor translucency method

* actualization

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Calvin <clavin@users.noreply.github.com>
2023-09-11 22:20:45 +02:00
trop[bot]
23e53dc967 fix: fullscreen crashing with no roundedCorners and no frame (#39796)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-09-11 11:14:41 +02:00
trop[bot]
c48931a6d8 fix: raw_ptr destruction order in NodeBindings (#39782)
* refactor: make ElectronRendererClient::node_bindings_ a const ptr

refactor: make ElectronRendererClient::electron_bindings_ a const ptr

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

* refactor: make NodeBindings::in_worker_loop() private

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

* fix: raw_ptr destructor dependency in NodeBindings

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

* chore: revert unintentional commit

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

* refactor: make NodeBindings::uv_loop_ private

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

* refactor: extract event_loop init into a separate function for readability

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-09-11 11:02:01 +02:00
trop[bot]
539ebf049a fix: make titlebar opaque while fullscreen (#39781)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2023-09-11 09:35:10 +02:00
trop[bot]
2cc8b33fe2 build: update appveyor image to latest version e-118.0.5993.0 (#39777)
build: update appveyor image to latest version

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: jkleinsc <jkleinsc@users.noreply.github.com>
2023-09-09 10:44:53 -04:00
electron-roller[bot]
568c16f994 chore: bump chromium to 118.0.5993.5 (27-x-y) (#39542)
* chore: bump chromium in DEPS to 118.0.5951.0

* chore: bump chromium in DEPS to 118.0.5953.1

* chore: bump chromium in DEPS to 118.0.5955.1

* chore: bump chromium in DEPS to 118.0.5957.1

* chore: bump chromium in DEPS to 118.0.5959.1

* chore: bump chromium in DEPS to 118.0.5961.1

* chore: bump chromium in DEPS to 118.0.5963.1

* chore: bump chromium in DEPS to 118.0.5965.2

* chore: bump chromium in DEPS to 118.0.5967.1

* chore: bump chromium in DEPS to 118.0.5969.1

* chore: bump chromium in DEPS to 118.0.5971.1

* chore: bump chromium in DEPS to 118.0.5973.1

* chore: bump chromium in DEPS to 118.0.5975.1

* chore: bump chromium in DEPS to 118.0.5977.1

* chore: bump chromium in DEPS to 118.0.5979.1

* chore: bump chromium in DEPS to 118.0.5981.0

* chore: bump chromium in DEPS to 118.0.5981.1

* chore: bump chromium in DEPS to 118.0.5983.1

* chore: bump chromium in DEPS to 118.0.5985.1

* chore: bump chromium in DEPS to 118.0.5987.1

* chore: bump chromium in DEPS to 118.0.5989.1

* chore: bump chromium in DEPS to 118.0.5991.1

* chore: bump chromium in DEPS to 118.0.5993.1

* chore: bump chromium to 118.0.5975.0 (main) (#39531)

* chore: bump chromium in DEPS to 118.0.5951.0

* chore: update printing.patch

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

No logic changes, but patch needed to be manually re-applied due to upstream code shear

* chore: update port_autofill_colors_to_the_color_pipeline.patch

No manual changes; patch applied with fuzz

* chore: update patches

* chore: bump chromium in DEPS to 118.0.5953.0

* chore: update patches

* chore: bump chromium in DEPS to 118.0.5955.0

* chore: update patches

* chore: bump chromium in DEPS to 118.0.5957.0

* chore: update patches

* chore: include path of native_web_keyboard_event.h

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

* chore: remove reference to eextensions/browser/notification-types.h

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

* chore: update references to renamed upstream field NativeWebKeyboardEvent.skip_if_unhandled (formerly known as skip_in_browser

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

Need a second pair of eyes on this commit. In particular the reference in content_converter.cc, skipInBrowser, seems to not be set or documented anywhere? Is this unused/vestigal code?

* chore: sync signature of ElectronExtensionsBrowserClient::IsValidContext() to upstream change

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

* chore: add auto_pip_setting_helper.[cc,h] to chromium_src build

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

Exiting upstream code used by chromium_src now depends on this new upstream class

* chore: bump chromium in DEPS to 118.0.5959.0

* chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch

Xref: add_maximized_parameter_to_linuxui_getwindowframeprovider.patch

manually adjust patch to minor upstream chagnes

* chore: update patches

* chore: bump chromium in DEPS to 118.0.5961.0

* chore: bump chromium in DEPS to 118.0.5963.0

* chore: update patches

* 4780994: Rename various base files to "apple" since iOS uses them too
https://chromium-review.googlesource.com/c/chromium/src/+/4780994

* Many files moved from `mac` -> `apple`

This commit follows a handful of CLs that simply rename files/symbols to change `mac`
to `apple`
to signify their use across both macOS and iOS:
- 4784010: Move scoped_nsautorelease_pool to base/apple, leave a forwarding header
- 4790744: Move foundation_util to base/apple, leave a forwarding header
- 4790741: Move scoped_cftypreref to base/apple, leave a forwarding header
- 4787627: Move and rename macOS+iOS base/ files in PA to "apple"
- 4780399: Move OSStatus logging to base/apple
- 4787387: Remove forwarding headers
- 4781113: Rename message_pump_mac to "apple" because iOS uses it too

* fixup minor patch update error

A function param got dropped from this patch somewhere earlier

* chore: bump chromium in DEPS to 118.0.5965.2

* chore: update patches

* 4799213: Move ScopedTypeRef and ScopedCFTypeRef into base::apple::
https://chromium-review.googlesource.com/c/chromium/src/+/4799213

* Fix removed include to BrowserContext

In crrev.com/c/4767962 an include to BrowserContext was removed,
which was necessary for compilation. This broke only for us because
"chrome/browser/profiles/profile.h" includes that class, but we remove
all references to profiles.

* chore: bump chromium in DEPS to 118.0.5967.0

* chore: update patches

* chore: bump chromium in DEPS to 118.0.5969.0

* chore: update patches

* chore: bump chromium in DEPS to 118.0.5971.0

* chore: bump chromium in DEPS to 118.0.5973.0

* chore: update patches

* 4772121: [OOPIF PDF] Replace PDFWebContentsHelper with PDFDocumentHelper
https://chromium-review.googlesource.com/c/chromium/src/+/4772121

* 4811164: [Extensions] Do some cleanup in ChromeManagementAPIDelegate.
https://chromium-review.googlesource.com/c/chromium/src/+/4811164

* 4809488: Remove duplicate dnd functionality between Web and Renderer prefs
https://chromium-review.googlesource.com/c/chromium/src/+/4809488

Given that this is no longer an option of web preferences, we should
consider deprecating this option and then removing it.

* chore: bump chromium in DEPS to 118.0.5975.0

* chore: update patches

* fixup! chore: add auto_pip_settings_helper.{cc|h} to chromium_src build

* Reland "[windows] Remove RegKey::DeleteEmptyKey"

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

* Ensure StrCat means StrCat

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

* fixup! Remove RegKey::DeleteEmptyKey

* Consistently reject large p and large q in DH

Refs https://boringssl-review.googlesource.com/c/boringssl/+/62226

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
(cherry picked from commit 89117fdd99)

* chore: bump chromium to 118.0.5991.0 (main) (#39714)

* chore: bump chromium in DEPS to 118.0.5982.0

* chore: bump chromium in DEPS to 118.0.5983.0

* chore: bump chromium in DEPS to 118.0.5985.0

* chore: bump chromium in DEPS to 118.0.5987.0

* chore: update v8 patches

* chore: update chromium patches

* chore: update patches

* [PEPC] Add new structs to contain permission request data

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

* Add ThumbnailCapturer interface

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

* Reland "[ChromeRefresh2023] Update document pip windows for Chrome Refresh"

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

* chore: bump chromium in DEPS to 118.0.5989.0

* chore: bump chromium in DEPS to 118.0.5991.0

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
(cherry picked from commit d9ba26273a)

* fix: broken `chrome.scripting` compilation (#39725)

fix: broken chrome.scripting impl after roll
(cherry picked from commit 54d8402a6c)

* chore: bump chromium in DEPS to 118.0.5993.1

* chore: update patches

* chore: bump chromium in DEPS to 118.0.5993.5

* test: use default timeout

(cherry picked from commit cbc4980d69)

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-07 17:56:29 -04:00
trop[bot]
0fe0a90341 chore: remove deprecated webContents.getPrinters() (#39735)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-09-07 10:19:38 -04:00
trop[bot]
f3dcd3b287 fix: restore flag that allowed websockets to not be backgrounded (#39755)
* fix: restore flag that allowed websockets to not be backgrounded

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2023-09-07 09:16:41 -04:00
trop[bot]
05de1d7906 fix: prevent errors when extensions listen for chrome.tabs events (#39771)
* fix: prevent errors when extensions listen for chrome.tabs events

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

* chore: mark events unsupported in Electron

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-09-07 14:13:35 +02:00
trop[bot]
c14f5369af fix: devtools allow restoring saved dock state on Windows (#39767)
* fix: devtools allow restoring saved dock state on Windows

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

* chore: address feedback

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-09-07 11:42:02 +02:00
trop[bot]
3901b38e01 build: update appveyor image to latest version (#39750)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: jkleinsc <jkleinsc@users.noreply.github.com>
2023-09-06 14:55:19 -07:00
trop[bot]
e14b09c6c5 test: fix flaky content tracing test (#39731)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-06 19:24:04 +02:00
trop[bot]
e4ecade9cb build: fix depot_tools patch application (#39743)
build: fix depot_tools patch application

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-09-06 11:38:30 -04:00
trop[bot]
04fad161e0 docs: use node: imports for node core modules (#39694)
docs: use `node:` imports for node builtin modules

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2023-09-04 10:30:07 +02:00
trop[bot]
89f8c0efed docs: fix return typing of ses.getExtension (#39699)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-09-03 10:42:53 +02:00
trop[bot]
48c537e51e feat: support chrome.scripting extension APIs (#39675)
feat: support chrome.scripting extension APIs

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-31 10:39:34 -04:00
trop[bot]
3d3852343c feat: add more extensions manifest key options (#39672)
feat: add more manifest key options

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-31 10:38:20 -04:00
trop[bot]
d51a1e4c23 feat: enable WaylandWindowDecorations by default (#39644)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Athul Iddya <athul@iddya.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-08-31 10:37:00 -04:00
trop[bot]
43d0dcfc27 fix: promise resolved to early when browser initiated in-page navigation v2 (#39680)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Tomasz Malinowski <tomasz@openfin.co>
2023-08-30 13:09:33 -04:00
trop[bot]
056c343c04 docs: fix the minimum supported macOS version to Catalina (#39683)
docs: update the minimum supported macOS version to Catalina

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-08-29 12:18:20 -04:00
trop[bot]
5707be53af fix: webview exiting fullscreen presentation mode (#39660)
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:04:21 +09:00
trop[bot]
e1465f6723 fix: ensure windows respect fullscreenability with different resizability values (#39640)
* 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-25 19:15:42 +02:00
John Kleinschmidt
c406384e8c ci: explicitly use python3 to start goma (#39651)
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)
2023-08-24 23:18:33 -04:00
trop[bot]
c5ce6de82b fix: assert module in the renderer process (#39623)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-24 20:52:18 -04:00
trop[bot]
d89b7f0a4e feat: allow headers to be sent with webContents.downloadURL() (#39560)
feat: allow headers to be sent with webContents.downloadURL()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-24 11:04:25 -04:00
trop[bot]
dfbd4c4335 fix: ensure BrowserView bounds are always relative to window (#39627)
fix: ensure BrowserView bounds are always relative to window

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-24 10:46:08 -04:00
trop[bot]
d79189056d docs: mention alternative tooling (#39637)
* docs: mention alternative tooling

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

* Update forge-overview.md

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

* Update forge-overview.md

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-08-24 15:43:11 +02:00
trop[bot]
6fd069231f fix: instantiate tab video tracks from BrowserCaptureMediaStreamTrack (#39619)
return BrowserCaptureMediaStreamTrack instead of MediaStreamTrack

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: brhenrique <bruno.d@miro.com>
2023-08-23 22:13:08 +02:00
trop[bot]
56e749782e refactor: node::Environment self-cleanup (#39628)
* chore: savepoint

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

* chore: turn raw_ptr tests back off

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-23 12:25:20 -05:00
trop[bot]
864dd4af40 fix: chrome.tabs 'url' and 'title' are privileged information (#39608)
fix: tabs url and title are privileged information

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-22 23:02:08 +02:00
trop[bot]
3d31570f8d fix: dangling raw_ptr in ElectronBrowserMainParts dtor (#39593)
* 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 15:54:31 +02:00
trop[bot]
3411959886 fix: chrome://gpu failing to load (#39583)
fix: chrome://gpu failing to load

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-08-21 15:54:17 +02:00
trop[bot]
b0b1f2c727 fix: use tiled edges to calculate frame inset sizes in Linux (#39570)
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 11:42:54 +09:00
trop[bot]
4128e9f0e0 refactor: prefer Sorted variant of MakeFixedFlatSet() (#39564)
perf: prefer Sorted variant of MakeFixedFlatSet()

https://chromium-review.googlesource.com/c/chromium/src/+/4660000
says that the sorted version is simpler at compile time because it
can skip MakeFixedFlatSet()'s compile-time dynamic sorting.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-08-21 10:06:15 +09:00
trop[bot]
0bd5e36411 docs: note macOS bounds Tray offset (#39552)
* 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 13:57:32 +02:00
trop[bot]
c97a4ce691 fix: destruction order of js env fields (#39549)
isolate_ depends on isolate_holder_ and so must be destroyed first.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2023-08-17 11:03:03 +02:00
trop[bot]
fbb982350b docs: add missing webview render-process-gone event (#39543)
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:11 +02:00
1162 changed files with 20104 additions and 28255 deletions

View File

@@ -68,8 +68,8 @@ executors:
version: version:
description: "xcode version" description: "xcode version"
type: enum type: enum
enum: ["15.0.0", "14.0.0"] enum: ["14.3.0", "14.0.0"]
default: 15.0.0 default: 14.3.0
macos: macos:
xcode: << parameters.version >> xcode: << parameters.version >>
resource_class: << parameters.size >> resource_class: << parameters.size >>
@@ -80,14 +80,12 @@ executors:
machine: true machine: true
linux-arm: linux-arm:
resource_class: electronjs/aks-linux-arm-test resource_class: electronjs/linux-arm
docker: machine: true
- image: ghcr.io/electron/test:arm32v7-8e0f85b708fa58e28e4824954d6fd55adfda5e9e
linux-arm64: linux-arm64:
resource_class: electronjs/aks-linux-arm-test resource_class: electronjs/linux-arm64
docker: machine: true
- image: ghcr.io/electron/test:arm64v8-76d5d29e247972da3855a01c2d8cf72c5998233a
# The config expects the following environment variables to be set: # The config expects the following environment variables to be set:
# - "SLACK_WEBHOOK" Slack hook URL to send notifications. # - "SLACK_WEBHOOK" Slack hook URL to send notifications.
@@ -337,27 +335,46 @@ step-setup-env-for-build: &step-setup-env-for-build
# To find `gn` executable. # To find `gn` executable.
echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/src/buildtools"' >> $BASH_ENV echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/src/buildtools"' >> $BASH_ENV
step-setup-rbe-for-build: &step-setup-rbe-for-build step-setup-goma-for-build: &step-setup-goma-for-build
run: run:
name: Setup RBE name: Setup Goma
command: | command: |
echo 'export NUMBER_OF_NINJA_PROCESSES=300' >> $BASH_ENV echo 'export NUMBER_OF_NINJA_PROCESSES=300' >> $BASH_ENV
if [ "`uname`" == "Darwin" ]; then if [ "`uname`" == "Darwin" ]; then
echo 'export NUMBER_OF_NINJA_PROCESSES=200' >> $BASH_ENV
echo 'ulimit -n 10000' >> $BASH_ENV echo 'ulimit -n 10000' >> $BASH_ENV
echo 'sudo launchctl limit maxfiles 65536 200000' >> $BASH_ENV echo 'sudo launchctl limit maxfiles 65536 200000' >> $BASH_ENV
fi fi
if [ ! -z "$RAW_GOMA_AUTH" ]; then
echo $RAW_GOMA_AUTH > ~/.goma_oauth2_config
fi
git clone https://github.com/electron/build-tools.git git clone https://github.com/electron/build-tools.git
cd build-tools cd build-tools
npx yarn --ignore-engines npm install
mkdir third_party mkdir third_party
# Pull down credential helper and print status node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})" export GOMA_FALLBACK_ON_AUTH_FAILURE=true
HELPER=$(node -p "require('./src/utils/reclient.js').helperPath({})") third_party/goma/goma_ctl.py ensure_start
$HELPER login if [ ! -z "$RAW_GOMA_AUTH" ] && [ "`third_party/goma/goma_auth.py info`" != "Login as Fermi Planck" ]; then
echo 'export RBE_service='`node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"` >> $BASH_ENV echo "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token."
echo 'export RBE_experimental_credentials_helper='`node -e "console.log(require('./src/utils/reclient.js').helperPath({}))"` >> $BASH_ENV exit 1
echo 'export RBE_experimental_credentials_helper_args="print"' >> $BASH_ENV fi
echo 'export GN_GOMA_FILE='`node -e "console.log(require('./src/utils/goma.js').gnFilePath)"` >> $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
background: true
step-wait-for-goma: &step-wait-for-goma
run:
name: Wait for Goma
command: |
until [ -f "${TMPDIR:=/tmp}"/.goma-ready ]
do
sleep 5
done
echo "Goma ready"
no_output_timeout: 5m
step-restore-brew-cache: &step-restore-brew-cache step-restore-brew-cache: &step-restore-brew-cache
restore_cache: restore_cache:
@@ -531,13 +548,6 @@ step-fix-sync: &step-fix-sync
sed -i '' "s/Updating depot_tools... //g" gn_ensure_file sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
cipd ensure --root src/buildtools/mac -ensure-file gn_ensure_file cipd ensure --root src/buildtools/mac -ensure-file gn_ensure_file
# Fix reclient (wrong binary)
echo 'infra/rbe/client/${platform}' `gclient getdep --deps-file=src/DEPS -r 'src/buildtools/reclient:infra/rbe/client/${platform}'` > gn_ensure_file
# Remove extra output from calling gclient getdep which always calls update_depot_tools
sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
cipd ensure --root src/buildtools/reclient -ensure-file gn_ensure_file
python3 src/buildtools/reclient_cfgs/configure_reclient_cfgs.py --rbe_instance "projects/rbe-chrome-untrusted/instances/default_instance" --reproxy_cfg_template reproxy.cfg.template --rewrapper_cfg_project "" --skip_remoteexec_cfg_fetch
# Fix dsymutil (wrong binary) # Fix dsymutil (wrong binary)
if [ "$TARGET_ARCH" == "arm64" ]; then if [ "$TARGET_ARCH" == "arm64" ]; then
export DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1 export DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1
@@ -590,7 +600,7 @@ step-gn-gen-default: &step-gn-gen-default
name: Default GN gen name: Default GN gen
command: | command: |
cd src cd src
gn gen out/Default --args="import(\"$GN_CONFIG\") use_remoteexec=true $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS" gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
step-gn-check: &step-gn-check step-gn-check: &step-gn-check
run: run:
@@ -626,16 +636,16 @@ step-electron-chromedriver-build: &step-electron-chromedriver-build
command: | command: |
cd src cd src
if [ "`uname`" != "Darwin" ] && ([ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]); then if [ "`uname`" != "Darwin" ] && ([ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]); then
gn gen out/chromedriver --args="import(\"$GN_CONFIG\") use_remoteexec=true is_component_ffmpeg=false proprietary_codecs=false $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS" gn gen out/chromedriver --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") is_component_ffmpeg=false proprietary_codecs=false $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
export CHROMEDRIVER_DIR="out/chromedriver" export CHROMEDRIVER_DIR="out/chromedriver"
else else
export CHROMEDRIVER_DIR="out/Default" export CHROMEDRIVER_DIR="out/Default"
fi fi
autoninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES ninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
if [ "`uname`" == "Linux" ]; then if [ "`uname`" == "Linux" ]; then
electron/script/strip-binaries.py --target-cpu="$TARGET_ARCH" --file $PWD/$CHROMEDRIVER_DIR/chromedriver electron/script/strip-binaries.py --target-cpu="$TARGET_ARCH" --file $PWD/$CHROMEDRIVER_DIR/chromedriver
fi fi
autoninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver_zip ninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver_zip
if [ "`uname`" != "Darwin" ] && ([ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]); then if [ "`uname`" != "Darwin" ] && ([ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]); then
cp out/chromedriver/chromedriver.zip out/Default cp out/chromedriver/chromedriver.zip out/Default
fi fi
@@ -645,12 +655,11 @@ step-nodejs-headers-build: &step-nodejs-headers-build
name: Build Node.js headers name: Build Node.js headers
command: | command: |
cd src cd src
autoninja -C out/Default electron:node_headers ninja -C out/Default third_party/electron_node:headers
step-electron-publish: &step-electron-publish step-electron-publish: &step-electron-publish
run: run:
name: Publish Electron Dist name: Publish Electron Dist
no_output_timeout: 30m
command: | command: |
if [ "`uname`" == "Darwin" ]; then if [ "`uname`" == "Darwin" ]; then
rm -rf src/out/Default/obj rm -rf src/out/Default/obj
@@ -699,14 +708,14 @@ step-ffmpeg-gn-gen: &step-ffmpeg-gn-gen
name: ffmpeg GN gen name: ffmpeg GN gen
command: | command: |
cd src cd src
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS" gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS"
step-ffmpeg-build: &step-ffmpeg-build step-ffmpeg-build: &step-ffmpeg-build
run: run:
name: Non proprietary ffmpeg build name: Non proprietary ffmpeg build
command: | command: |
cd src cd src
autoninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES ninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
step-verify-mksnapshot: &step-verify-mksnapshot step-verify-mksnapshot: &step-verify-mksnapshot
run: run:
@@ -738,13 +747,26 @@ step-setup-linux-for-headless-testing: &step-setup-linux-for-headless-testing
sh -e /etc/init.d/xvfb start sh -e /etc/init.d/xvfb start
fi fi
step-show-goma-stats: &step-show-goma-stats
run:
shell: /bin/bash
name: Check goma stats after build
command: |
set +e
set +o pipefail
python3 $GOMA_DIR/goma_ctl.py stat
python3 $GOMA_DIR/diagnose_goma_log.py
true
when: always
background: true
step-mksnapshot-build: &step-mksnapshot-build step-mksnapshot-build: &step-mksnapshot-build
run: run:
name: mksnapshot build name: mksnapshot build
no_output_timeout: 30m no_output_timeout: 30m
command: | command: |
cd src cd src
autoninja -C out/Default electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES ninja -C out/Default electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
# Remove unused args from mksnapshot_args # Remove unused args from mksnapshot_args
SEDOPTION="-i" SEDOPTION="-i"
@@ -753,7 +775,6 @@ step-mksnapshot-build: &step-mksnapshot-build
fi fi
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
sed $SEDOPTION '/The gn arg use_goma=true .*/d' out/Default/mksnapshot_args
if [ "`uname`" != "Darwin" ]; then if [ "`uname`" != "Darwin" ]; then
if [ "$TARGET_ARCH" == "arm" ]; then if [ "$TARGET_ARCH" == "arm" ]; then
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/mksnapshot electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/mksnapshot
@@ -767,7 +788,7 @@ step-mksnapshot-build: &step-mksnapshot-build
fi fi
fi fi
if [ "$SKIP_DIST_ZIP" != "1" ]; then if [ "$SKIP_DIST_ZIP" != "1" ]; then
autoninja -C out/Default electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES ninja -C out/Default electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S) (cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
fi fi
@@ -777,7 +798,7 @@ step-hunspell-build: &step-hunspell-build
command: | command: |
cd src cd src
if [ "$SKIP_DIST_ZIP" != "1" ]; then if [ "$SKIP_DIST_ZIP" != "1" ]; then
autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES ninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
fi fi
step-maybe-generate-libcxx: &step-maybe-generate-libcxx step-maybe-generate-libcxx: &step-maybe-generate-libcxx
@@ -786,9 +807,9 @@ step-maybe-generate-libcxx: &step-maybe-generate-libcxx
command: | command: |
cd src cd src
if [ "`uname`" == "Linux" ]; then if [ "`uname`" == "Linux" ]; then
autoninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES ninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
autoninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES ninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
autoninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES ninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
fi fi
step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols
@@ -798,7 +819,7 @@ step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols
command: | command: |
if [ "$GENERATE_SYMBOLS" == "true" ]; then if [ "$GENERATE_SYMBOLS" == "true" ]; then
cd src cd src
autoninja -C out/Default electron:electron_symbols ninja -C out/Default electron:electron_symbols
fi fi
step-maybe-zip-symbols: &step-maybe-zip-symbols step-maybe-zip-symbols: &step-maybe-zip-symbols
@@ -807,8 +828,8 @@ step-maybe-zip-symbols: &step-maybe-zip-symbols
command: | command: |
cd src cd src
export BUILD_PATH="$PWD/out/Default" export BUILD_PATH="$PWD/out/Default"
autoninja -C out/Default electron:licenses ninja -C out/Default electron:licenses
autoninja -C out/Default electron:electron_version_file ninja -C out/Default electron:electron_version_file
electron/script/zip-symbols.py -b $BUILD_PATH electron/script/zip-symbols.py -b $BUILD_PATH
step-maybe-zip-symbols-and-clean: &step-maybe-zip-symbols-and-clean step-maybe-zip-symbols-and-clean: &step-maybe-zip-symbols-and-clean
@@ -817,8 +838,8 @@ step-maybe-zip-symbols-and-clean: &step-maybe-zip-symbols-and-clean
command: | command: |
cd src cd src
export BUILD_PATH="$PWD/out/Default" export BUILD_PATH="$PWD/out/Default"
autoninja -C out/Default electron:licenses ninja -C out/Default electron:licenses
autoninja -C out/Default electron:electron_version_file ninja -C out/Default electron:electron_version_file
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
step-maybe-cross-arch-snapshot: &step-maybe-cross-arch-snapshot step-maybe-cross-arch-snapshot: &step-maybe-cross-arch-snapshot
@@ -1165,10 +1186,11 @@ commands:
could-be-aks: could-be-aks:
type: boolean type: boolean
steps: steps:
- *step-setup-rbe-for-build - *step-setup-goma-for-build
- checkout-from-cache: - checkout-from-cache:
could-be-aks: << parameters.could-be-aks >> could-be-aks: << parameters.could-be-aks >>
- *step-setup-env-for-build - *step-setup-env-for-build
- *step-wait-for-goma
- *step-gn-gen-default - *step-gn-gen-default
- *step-gn-check - *step-gn-check
build_and_save_artifacts: build_and_save_artifacts:
@@ -1187,7 +1209,9 @@ commands:
build-type: << parameters.build-type >> build-type: << parameters.build-type >>
- *step-maybe-electron-dist-strip - *step-maybe-electron-dist-strip
- step-electron-dist-build: - step-electron-dist-build:
additional-targets: electron:node_headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip additional-targets: shell_browser_ui_unittests third_party/electron_node:headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
- *step-show-goma-stats
# mksnapshot # mksnapshot
- *step-mksnapshot-build - *step-mksnapshot-build
@@ -1317,7 +1341,7 @@ commands:
command: | command: |
cd src cd src
if [ "$SKIP_DIST_ZIP" != "1" ]; then if [ "$SKIP_DIST_ZIP" != "1" ]; then
autoninja -C out/Default electron:electron_dist_zip << parameters.additional-targets >> -j $NUMBER_OF_NINJA_PROCESSES ninja -C out/Default electron:electron_dist_zip << parameters.additional-targets >> -j $NUMBER_OF_NINJA_PROCESSES
if [ "$CHECK_DIST_MANIFEST" == "1" ]; then if [ "$CHECK_DIST_MANIFEST" == "1" ]; then
if [ "`uname`" == "Darwin" ]; then if [ "`uname`" == "Darwin" ]; then
target_os=mac target_os=mac
@@ -1418,7 +1442,7 @@ commands:
- when: - when:
condition: << parameters.build >> condition: << parameters.build >>
steps: steps:
- *step-setup-rbe-for-build - *step-setup-goma-for-build
- when: - when:
condition: << parameters.checkout-and-assume-cache >> condition: << parameters.checkout-and-assume-cache >>
steps: steps:
@@ -1537,6 +1561,7 @@ commands:
steps: steps:
- *step-depot-tools-add-to-path - *step-depot-tools-add-to-path
- *step-setup-env-for-build - *step-setup-env-for-build
- *step-wait-for-goma
- *step-get-more-space-on-mac - *step-get-more-space-on-mac
- *step-fix-sync - *step-fix-sync
- *step-delete-git-directories - *step-delete-git-directories
@@ -1630,20 +1655,20 @@ commands:
export LLVM_SYMBOLIZER_PATH=$PWD/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer export LLVM_SYMBOLIZER_PATH=$PWD/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer
export MOCHA_TIMEOUT=180000 export MOCHA_TIMEOUT=180000
echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)" echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)"
(cd electron && (circleci tests glob "spec/*-spec.ts" | xargs -I@ -P4 bash -c "echo $(pwd)/@" | circleci tests run --command="xargs node script/yarn test --runners=main --trace-uncaught --enable-logging --files" --split-by=timings 2>&1)) | $ASAN_SYMBOLIZE (cd electron && (circleci tests glob "spec/*-spec.ts" | circleci tests run --command="xargs node script/yarn test --runners=main --trace-uncaught --enable-logging --files" --split-by=timings 2>&1)) | $ASAN_SYMBOLIZE
else else
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
export ELECTRON_SKIP_NATIVE_MODULE_TESTS=true export ELECTRON_SKIP_NATIVE_MODULE_TESTS=true
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging)
else
if [ "$TARGET_ARCH" == "ia32" ]; then
npm_config_arch=x64 node electron/node_modules/dugite/script/download-git.js
fi
(cd electron && (circleci tests glob "spec/*-spec.ts" | circleci tests run --command="xargs node script/yarn test --runners=main --trace-uncaught --enable-logging --files" --split-by=timings))
fi fi
if [ "$TARGET_ARCH" == "ia32" ]; then
npm_config_arch=x64 node electron/node_modules/dugite/script/download-git.js
fi
(cd electron && (circleci tests glob "spec/*-spec.ts" | xargs -I@ -P4 bash -c "echo $(pwd)/@" | circleci tests run --command="xargs node script/yarn test --runners=main --trace-uncaught --enable-logging --files" --split-by=timings))
fi fi
- store_test_results: - store_test_results:
path: src/junit path: src/junit
- store_artifacts:
path: src/electron/spec/artifacts
- *step-verify-mksnapshot - *step-verify-mksnapshot
- *step-verify-chromedriver - *step-verify-chromedriver
@@ -1724,12 +1749,14 @@ commands:
- *step-fix-sync - *step-fix-sync
- *step-setup-env-for-build - *step-setup-env-for-build
- *step-fix-known-hosts-linux - *step-fix-known-hosts-linux
- *step-setup-rbe-for-build - *step-setup-goma-for-build
- *step-wait-for-goma
- *step-gn-gen-default - *step-gn-gen-default
# Electron app # Electron app
- ninja_build_electron: - ninja_build_electron:
build-type: << parameters.build-type >> build-type: << parameters.build-type >>
- *step-show-goma-stats
- *step-maybe-generate-breakpad-symbols - *step-maybe-generate-breakpad-symbols
- *step-maybe-electron-dist-strip - *step-maybe-electron-dist-strip
- step-electron-dist-build - step-electron-dist-build
@@ -2136,7 +2163,7 @@ jobs:
<<: *env-ninja-status <<: *env-ninja-status
<<: *env-macos-build <<: *env-macos-build
<<: *env-apple-silicon <<: *env-apple-silicon
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac --custom-var=host_cpu=arm64' GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
steps: steps:
- electron-build: - electron-build:
persist: true persist: true
@@ -2268,7 +2295,6 @@ jobs:
<<: *env-global <<: *env-global
<<: *env-headless-testing <<: *env-headless-testing
<<: *env-stack-dumping <<: *env-stack-dumping
parallelism: 3
steps: steps:
- electron-tests: - electron-tests:
artifact-key: linux-arm artifact-key: linux-arm
@@ -2280,7 +2306,6 @@ jobs:
<<: *env-global <<: *env-global
<<: *env-headless-testing <<: *env-headless-testing
<<: *env-stack-dumping <<: *env-stack-dumping
parallelism: 3
steps: steps:
- electron-tests: - electron-tests:
artifact-key: linux-arm64 artifact-key: linux-arm64

View File

@@ -2,6 +2,7 @@ name: Bug Report
description: Report an Electron bug description: Report an Electron bug
title: "[Bug]: " title: "[Bug]: "
labels: "bug :beetle:" labels: "bug :beetle:"
projects: ["electron/90"]
body: body:
- type: checkboxes - type: checkboxes
attributes: attributes:

View File

@@ -1,7 +0,0 @@
contact_links:
- name: Discord Chat
url: https://discord.gg/APGC3k5yaH
about: Have questions? Try asking on our Discord - this issue tracker is for reporting bugs or feature requests only
- name: Open Collective
url: https://opencollective.com/electron
about: Help support Electron by contributing to our Open Collective

View File

@@ -1,12 +1,6 @@
name: Branch Created name: Branch Created
on: on:
workflow_dispatch:
inputs:
branch-name:
description: Branch name (e.g. `29-x-y`)
required: true
type: string
create: create:
permissions: {} permissions: {}
@@ -14,7 +8,7 @@ permissions: {}
jobs: jobs:
release-branch-created: release-branch-created:
name: Release Branch Created name: Release Branch Created
if: ${{ github.event_name == 'workflow_dispatch' || (github.event.ref_type == 'branch' && endsWith(github.event.ref, '-x-y') && !startsWith(github.event.ref, 'roller')) }} if: ${{ github.event.ref_type == 'branch' && endsWith(github.event.ref, '-x-y') }}
permissions: permissions:
contents: read contents: read
pull-requests: write pull-requests: write
@@ -24,10 +18,10 @@ jobs:
- name: Determine Major Version - name: Determine Major Version
id: check-major-version id: check-major-version
run: | run: |
if [[ ${{ github.event.inputs.branch-name || github.event.ref }} =~ ^([0-9]+)-x-y$ ]]; then if [[ ${{ github.event.ref }} =~ ^([0-9]+)-x-y$ ]]; then
echo "MAJOR=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT" echo "MAJOR=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
else else
echo "Not a release branch: ${{ github.event.inputs.branch-name || github.event.ref }}" echo "Not a release branch: ${{ github.event.ref }}"
fi fi
- name: New Release Branch Tasks - name: New Release Branch Tasks
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
@@ -66,60 +60,107 @@ jobs:
done done
- name: Generate GitHub App token - name: Generate GitHub App token
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token id: generate-token
with: env:
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }} RELEASE_BOARD_GH_APP_CREDS: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
org: electron run: |
- name: Generate Release Project Board Metadata TOKEN=$(npx @electron/github-app-auth --creds=$RELEASE_BOARD_GH_APP_CREDS --org=electron)
if: ${{ steps.check-major-version.outputs.MAJOR }} echo "TOKEN=$TOKEN" >> "$GITHUB_OUTPUT"
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: generate-project-metadata
with:
script: |
const major = ${{ steps.check-major-version.outputs.MAJOR }}
const nextMajor = major + 1
const prevMajor = major - 1
core.setOutput("major", major)
core.setOutput("next-major", nextMajor)
core.setOutput("prev-major", prevMajor)
core.setOutput("prev-prev-major", prevMajor - 1)
core.setOutput("template-view", JSON.stringify({
major,
"next-major": nextMajor,
"prev-major": prevMajor,
}))
- name: Create Release Project Board - name: Create Release Project Board
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: dsanders11/project-actions/copy-project@82e99438bd44a14ad18d92d036dbc25cbfb9a8c4 # v1.2.0
id: create-release-board
with:
drafts: true
project-number: 64
# TODO - Set to public once GitHub fixes their GraphQL bug
# public: true
# TODO - Enable once GitHub doesn't require overly broad, read
# and write permission for repo "Contents" to link
# link-to-repository: electron/electron
template-view: ${{ steps.generate-project-metadata.outputs.template-view }}
title: ${{ steps.generate-project-metadata.outputs.major }}-x-y
token: ${{ steps.generate-token.outputs.token }}
- name: Dump Release Project Board Contents
if: ${{ steps.check-major-version.outputs.MAJOR }}
run: gh project item-list ${{ steps.create-release-board.outputs.number }} --owner electron --format json | jq
env: env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} GITHUB_TOKEN: ${{ steps.generate-token.outputs.TOKEN }}
- name: Find Previous Release Project Board MAJOR: ${{ steps.check-major-version.outputs.MAJOR }}
if: ${{ steps.check-major-version.outputs.MAJOR }} ELECTRON_ORG_ID: "O_kgDOAMybxg"
uses: dsanders11/project-actions/find-project@82e99438bd44a14ad18d92d036dbc25cbfb9a8c4 # v1.2.0 ELECTRON_REPO_ID: "R_kgDOAI8xSw"
id: find-prev-release-board TEMPLATE_PROJECT_ID: "PVT_kwDOAMybxs4AQvib"
with: run: |
title: ${{ steps.generate-project-metadata.outputs.prev-prev-major }}-x-y # Copy template to create new project board
token: ${{ steps.generate-token.outputs.token }} PROJECT_ID=$(gh api graphql -f query='mutation ($ownerId: ID!, $projectId: ID!, $title: String!) {
- name: Close Previous Release Project Board copyProjectV2(input: {
if: ${{ steps.check-major-version.outputs.MAJOR }} includeDraftIssues: true,
uses: dsanders11/project-actions/close-project@82e99438bd44a14ad18d92d036dbc25cbfb9a8c4 # v1.2.0 ownerId: $ownerId,
with: projectId: $projectId,
project-number: ${{ steps.find-prev-release-board.outputs.number }} title: $title
token: ${{ steps.generate-token.outputs.token }} }) {
projectV2 {
id
}
}
}' -f ownerId=$ELECTRON_ORG_ID -f projectId=$TEMPLATE_PROJECT_ID -f title="${MAJOR}-x-y" | jq -r '.data.copyProjectV2.projectV2.id')
# Make the new project public
gh api graphql -f query='mutation ($projectId: ID!) {
updateProjectV2(input: {
projectId: $projectId,
public: true,
}) {
projectV2 {
id
}
}
}' -f projectId=$PROJECT_ID
# Link the new project to the Electron repository
gh api graphql -f query='mutation ($projectId: ID!, $repositoryId: ID!) {
linkProjectV2ToRepository(input: {
projectId: $projectId,
repositoryId: $repositoryId
}) {
clientMutationId
}
}' -f projectId=$PROJECT_ID -f repositoryId=$ELECTRON_REPO_ID
# Get all draft issues on the new project board
gh api graphql -f query='query ($id: ID!) {
node(id: $id) {
... on ProjectV2 {
items(first: 100) {
nodes {
... on ProjectV2Item {
id
content {
... on DraftIssue { id title
body
}
}
}
}
}
}
}
}' -f id=$PROJECT_ID > issues.json
PROJECT_ITEMS=$(jq '.data.node.items.nodes[] | select(.content.id != null) | .id' issues.json)
#
# Do template replacement for draft issues
#
echo "{\"major\": $MAJOR, \"next-major\": $((MAJOR + 1))}" > variables.json
# npx mustache is annoyingly slow, so install mustache directly
yarn add -D mustache
for PROJECT_ITEM_ID in $PROJECT_ITEMS; do
# These are done with the raw output flag and sent to file to better retain formatting
jq -r ".data.node.items.nodes[] | select(.id == $PROJECT_ITEM_ID) | .content.title" issues.json > title.txt
jq -r ".data.node.items.nodes[] | select(.id == $PROJECT_ITEM_ID) | .content.body" issues.json > body.txt
./node_modules/.bin/mustache variables.json title.txt new_title.txt
./node_modules/.bin/mustache variables.json body.txt new_body.txt
# Only update draft issues which had content change when interpolated
if ! cmp --silent -- new_title.txt title.txt || ! cmp --silent -- new_body.txt body.txt; then
DRAFT_ISSUE_ID=$(jq ".data.node.items.nodes[] | select(.id == $PROJECT_ITEM_ID) | .content.id" issues.json)
gh api graphql -f query='mutation ($draftIssueId: ID!, $title: String!, $body: String!) {
updateProjectV2DraftIssue(input: {
draftIssueId: $draftIssueId,
title: $title,
body: $body
}) {
draftIssue {
id
}
}
}' -f draftIssueId=$DRAFT_ISSUE_ID -f title="$(cat new_title.txt)" -f body="$(cat new_body.txt)"
fi
done

View File

@@ -5,22 +5,20 @@ on:
types: types:
- created - created
permissions: {} permissions:
contents: read
jobs: jobs:
issue-commented: issue-commented:
name: Remove blocked/need-repro on comment name: Remove blocked/need-repro on comment
if: ${{ contains(github.event.issue.labels.*.name, 'blocked/need-repro') && !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) && github.event.comment.user.type != 'Bot' }} if: ${{ contains(github.event.issue.labels.*.name, 'blocked/need-repro') && !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) }}
permissions:
issues: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
- name: Remove label - name: Remove label
env: env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_URL: ${{ github.event.issue.html_url }} ISSUE_URL: ${{ github.event.issue.html_url }}
run: | run: |
gh issue edit $ISSUE_URL --remove-label 'blocked/need-repro' gh issue edit $ISSUE_URL --remove-label 'blocked/need-repro'

View File

@@ -14,18 +14,23 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Generate GitHub App token - name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token id: generate-token
with: env:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} RELEASE_BOARD_GH_APP_CREDS: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
org: electron run: |
set -eo pipefail
TOKEN=$(npx @electron/github-app-auth --creds=$RELEASE_BOARD_GH_APP_CREDS --org=electron)
echo "TOKEN=$TOKEN" >> "$GITHUB_OUTPUT"
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@82e99438bd44a14ad18d92d036dbc25cbfb9a8c4 # v1.2.0 if: ${{ steps.generate-token.outputs.TOKEN }}
uses: github/update-project-action@2d475e08804f11f4022df7e21f5816531e97cb64 # v2
with: with:
token: ${{ steps.generate-token.outputs.token }} github_token: ${{ steps.generate-token.outputs.TOKEN }}
project-number: 90 organization: electron
project_number: 90
content_id: ${{ github.event.issue.node_id }}
field: Status field: Status
field-value: 🛑 Blocked value: 🛑 Blocked
issue-labeled-blocked-need-repro: issue-labeled-blocked-need-repro:
name: blocked/need-repro label added name: blocked/need-repro label added
if: github.event.label.name == 'blocked/need-repro' if: github.event.label.name == 'blocked/need-repro'
@@ -40,22 +45,15 @@ jobs:
GH_REPO: electron/electron GH_REPO: electron/electron
run: | run: |
set -eo pipefail set -eo pipefail
COMMENT_COUNT=$(gh issue view ${{ github.event.issue.number }} --comments --json comments | jq '[ .comments[] | select(.author.login == "electron-issue-triage" or .authorAssociation == "OWNER" or .authorAssociation == "MEMBER") | select(.body | startswith("<!-- blocked/need-repro -->")) ] | length') COMMENT_COUNT=$(gh issue view ${{ github.event.issue.number }} --comments --json comments | jq '[ .comments[] | select(.author.login == "github-actions" or .authorAssociation == "OWNER" or .authorAssociation == "MEMBER") | select(.body | startswith("<!-- blocked/need-repro -->")) ] | length')
if [[ $COMMENT_COUNT -eq 0 ]]; then if [[ $COMMENT_COUNT -eq 0 ]]; then
echo "SHOULD_COMMENT=1" >> "$GITHUB_OUTPUT" echo "SHOULD_COMMENT=1" >> "$GITHUB_OUTPUT"
fi fi
- name: Generate GitHub App token
if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }}
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
- name: Create comment - name: Create comment
if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }} if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }}
uses: actions-cool/issues-helper@275328970dbc3bfc3bc43f5fe741bf3638300c0a # v3.3.3 uses: actions-cool/issues-helper@275328970dbc3bfc3bc43f5fe741bf3638300c0a # v3.3.3
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ steps.generate-token.outputs.token }}
body: | body: |
<!-- blocked/need-repro --> <!-- blocked/need-repro -->

View File

@@ -1,27 +0,0 @@
name: Issue Opened
on:
issues:
types:
- opened
permissions: {}
jobs:
add-to-issue-triage:
if: ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }}
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron
- name: Add to Issue Triage
uses: dsanders11/project-actions/add-item@82e99438bd44a14ad18d92d036dbc25cbfb9a8c4 # v1.2.0
with:
field: Reporter
field-value: ${{ github.event.issue.user.login }}
project-number: 90
token: ${{ steps.generate-token.outputs.token }}

View File

@@ -10,7 +10,7 @@ permissions:
jobs: jobs:
issue-unlabeled-blocked: issue-unlabeled-blocked:
name: All blocked/* labels removed name: All blocked/* labels removed
if: startsWith(github.event.label.name, 'blocked/') && github.event.issue.state == 'open' if: startsWith(github.event.label.name, 'blocked/')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check for any blocked labels - name: Check for any blocked labels
@@ -23,16 +23,20 @@ jobs:
fi fi
- name: Generate GitHub App token - name: Generate GitHub App token
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }} if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token id: generate-token
with: env:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} RELEASE_BOARD_GH_APP_CREDS: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
org: electron run: |
set -eo pipefail
TOKEN=$(npx @electron/github-app-auth --creds=$RELEASE_BOARD_GH_APP_CREDS --org=electron)
echo "TOKEN=$TOKEN" >> "$GITHUB_OUTPUT"
- name: Set status - name: Set status
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }} if: ${{ steps.generate-token.outputs.TOKEN }}
uses: dsanders11/project-actions/edit-item@82e99438bd44a14ad18d92d036dbc25cbfb9a8c4 # v1.2.0 uses: github/update-project-action@2d475e08804f11f4022df7e21f5816531e97cb64 # v2
with: with:
token: ${{ steps.generate-token.outputs.token }} github_token: ${{ steps.generate-token.outputs.TOKEN }}
project-number: 90 organization: electron
project_number: 90
content_id: ${{ github.event.issue.node_id }}
field: Status field: Status
field-value: 📥 Was Blocked value: 📥 Was Blocked

View File

@@ -1,41 +1,33 @@
name: Pull Request Labeled name: Pull Request Labeled
on: on:
pull_request_target: pull_request:
types: [labeled] types: [labeled]
permissions: {} permissions:
contents: read
jobs: jobs:
pull-request-labeled-backport-requested:
name: backport/requested label added
if: github.event.label.name == 'backport/requested 🗳'
runs-on: ubuntu-latest
steps:
- name: Trigger Slack workflow
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
with:
payload: |
{
"url": "${{ github.event.pull_request.html_url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
pull-request-labeled-deprecation-review-complete: pull-request-labeled-deprecation-review-complete:
name: deprecation-review/complete label added name: deprecation-review/complete label added
if: github.event.label.name == 'deprecation-review/complete ✅' if: github.event.label.name == 'deprecation-review/complete ✅'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Generate GitHub App token - name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token id: generate-token
with: env:
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }} RELEASE_BOARD_GH_APP_CREDS: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
org: electron run: |
set -eo pipefail
TOKEN=$(npx @electron/github-app-auth --creds=$RELEASE_BOARD_GH_APP_CREDS --org=electron)
echo "TOKEN=$TOKEN" >> "$GITHUB_OUTPUT"
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@82e99438bd44a14ad18d92d036dbc25cbfb9a8c4 # v1.2.0 if: ${{ steps.generate-token.outputs.TOKEN }}
uses: github/update-project-action@2d475e08804f11f4022df7e21f5816531e97cb64 # v2
with: with:
token: ${{ steps.generate-token.outputs.token }} github_token: ${{ steps.generate-token.outputs.TOKEN }}
project-number: 94 organization: electron
project_number: 94
content_id: ${{ github.event.pull_request.node_id }}
field: Status field: Status
field-value: ✅ Reviewed value: ✅ Reviewed

View File

@@ -22,13 +22,12 @@ jobs:
steps: steps:
- name: "Checkout code" - name: "Checkout code"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3.1.0
with: with:
persist-credentials: false persist-credentials: false
# This is a pre-submit / pre-release.
- name: "Run analysis" - name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # tag=v2.1.2
with: with:
results_file: results.sarif results_file: results.sarif
results_format: sarif results_format: sarif
@@ -42,7 +41,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab. # format to the repository Actions tab.
- name: "Upload artifact" - name: "Upload artifact"
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # tag=v3.1.2
with: with:
name: SARIF file name: SARIF file
path: results.sarif path: results.sarif
@@ -50,6 +49,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard. # Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3.24.0 uses: github/codeql-action/upload-sarif@959cbb7472c4d4ad70cdfe6f4976053fe48ab394 # tag=v2.1.27
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View File

@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: semantic-pull-request - name: semantic-pull-request
uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f # v5.4.0 uses: amannn/action-semantic-pull-request@01d5fd8a8ebb9aafe902c40c53f0f4744f7381eb # tag: v5
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:

View File

@@ -1,35 +0,0 @@
name: Check Stable Prep Items
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
permissions: {}
jobs:
check-stable-prep-items:
name: Check Stable Prep Items
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with:
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
org: electron
- name: Find Newest Release Project Board
id: find-project-number
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
set -eo pipefail
PROJECT_NUMBER=$(gh project list --owner electron --format json | jq -r '.projects | map(select(.title | test("^[0-9]+-x-y$"))) | max_by(.number) | .number')
echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> "$GITHUB_OUTPUT"
- name: Update Completed Stable Prep Items
uses: dsanders11/project-actions/completed-by@82e99438bd44a14ad18d92d036dbc25cbfb9a8c4 # v1.2.0
with:
field: Prep Status
field-value: ✅ Complete
project-number: ${{ steps.find-project-number.outputs.PROJECT_NUMBER }}
token: ${{ steps.generate-token.outputs.token }}

View File

@@ -5,20 +5,15 @@ on:
# 1:30am every day # 1:30am every day
- cron: '30 1 * * *' - cron: '30 1 * * *'
permissions: {} permissions:
issues: write
jobs: jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Generate GitHub App token - uses: actions/stale@5ebf00ea0e4c1561e9b43a292ed34424fb1d4578 # tag: v6.0.1
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with: with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # tag: v9.0.0
with:
repo-token: ${{ steps.generate-token.outputs.token }}
days-before-stale: 90 days-before-stale: 90
days-before-close: 30 days-before-close: 30
stale-issue-label: stale stale-issue-label: stale
@@ -27,21 +22,15 @@ jobs:
This issue has been automatically marked as stale. **If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the [latest version of Electron](https://www.electronjs.org/releases/stable) or in the [beta](https://www.electronjs.org/releases/beta)—please include it with your comment! This issue has been automatically marked as stale. **If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the [latest version of Electron](https://www.electronjs.org/releases/stable) or in the [beta](https://www.electronjs.org/releases/beta)—please include it with your comment!
close-issue-message: > close-issue-message: >
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a [supported version of Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline) please open a new issue and include instructions for reproducing the issue. This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a [supported version of Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline) please open a new issue and include instructions for reproducing the issue.
exempt-issue-labels: "discussion,security \U0001F512,enhancement :sparkles:,status/confirmed,stale-exempt" exempt-issue-labels: "discussion,security \U0001F512,enhancement :sparkles:"
only-pr-labels: not-a-real-label only-pr-labels: not-a-real-label
pending-repro: pending-repro:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ always() }} if: ${{ always() }}
needs: stale needs: stale
steps: steps:
- name: Generate GitHub App token - uses: actions/stale@5ebf00ea0e4c1561e9b43a292ed34424fb1d4578 # tag: v6.0.1
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with: with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # tag: v9.0.0
with:
repo-token: ${{ steps.generate-token.outputs.token }}
days-before-stale: -1 days-before-stale: -1
days-before-close: 10 days-before-close: 10
remove-stale-when-updated: false remove-stale-when-updated: false

View File

@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Yarn install - name: Yarn install
@@ -38,7 +38,7 @@ jobs:
fi fi
- name: (Optionally) Update Appveyor Image - name: (Optionally) Update Appveyor Image
if: ${{ env.APPVEYOR_IMAGE_VERSION }} if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: mikefarah/yq@bb66c9c872a7a4cf3d6846c2ff6d182c66ec3f77 # v4.40.7 uses: mikefarah/yq@1c7dc0e88aad311c89889bc5ce5d8f96931a1bd0 # v4.27.2
with: with:
cmd: | cmd: |
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml" yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml"
@@ -57,7 +57,7 @@ jobs:
rm appveyor-woa2.yml appveyor-woa.diff rm appveyor-woa2.yml appveyor-woa.diff
- name: (Optionally) Commit and Pull Request - name: (Optionally) Commit and Pull Request
if: ${{ env.APPVEYOR_IMAGE_VERSION }} if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 # v6.0.0 uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'build: update appveyor image to latest version' commit-message: 'build: update appveyor image to latest version'

235
BUILD.gn
View File

@@ -9,7 +9,6 @@ import("//pdf/features.gni")
import("//ppapi/buildflags/buildflags.gni") import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni") import("//printing/buildflags/buildflags.gni")
import("//testing/test.gni") import("//testing/test.gni")
import("//third_party/electron_node/electron_node.gni")
import("//third_party/ffmpeg/ffmpeg_options.gni") import("//third_party/ffmpeg/ffmpeg_options.gni")
import("//tools/generate_library_loader/generate_library_loader.gni") import("//tools/generate_library_loader/generate_library_loader.gni")
import("//tools/grit/grit_rule.gni") import("//tools/grit/grit_rule.gni")
@@ -29,7 +28,6 @@ import("filenames.gni")
import("filenames.hunspell.gni") import("filenames.hunspell.gni")
import("filenames.libcxx.gni") import("filenames.libcxx.gni")
import("filenames.libcxxabi.gni") import("filenames.libcxxabi.gni")
import("js2c_toolchain.gni")
if (is_mac) { if (is_mac) {
import("//build/config/mac/rules.gni") import("//build/config/mac/rules.gni")
@@ -105,26 +103,14 @@ branding = read_file("shell/app/BRANDING.json", "json")
electron_project_name = branding.project_name electron_project_name = branding.project_name
electron_product_name = branding.product_name electron_product_name = branding.product_name
electron_mac_bundle_id = branding.mac_bundle_id electron_mac_bundle_id = branding.mac_bundle_id
electron_version = exec_script("script/print-version.py",
if (override_electron_version != "") { [],
electron_version = override_electron_version "trim string",
} else { [
# When building from source code tarball there is no git tag available and ".git/packed-refs",
# builders must explicitly pass override_electron_version in gn args. ".git/HEAD",
# This read_file call will assert if there is no git information, without it "script/lib/get-version.js",
# gn will generate a malformed build configuration and ninja will get into ])
# infinite loop.
read_file(".git/packed-refs", "string")
# Set electron version from git tag.
electron_version = exec_script("script/get-git-version.py",
[],
"trim string",
[
".git/packed-refs",
".git/HEAD",
])
}
if (is_mas_build) { if (is_mas_build) {
assert(is_mac, assert(is_mac,
@@ -166,6 +152,15 @@ npm_action("build_electron_definitions") {
outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ] outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ]
} }
webpack_build("electron_asar_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.asar_bundle_deps
config_file = "//electron/build/webpack/webpack.config.asar.js"
out_file = "$target_gen_dir/js2c/asar_bundle.js"
}
webpack_build("electron_browser_bundle") { webpack_build("electron_browser_bundle") {
deps = [ ":build_electron_definitions" ] deps = [ ":build_electron_definitions" ]
@@ -211,15 +206,6 @@ webpack_build("electron_isolated_renderer_bundle") {
out_file = "$target_gen_dir/js2c/isolated_bundle.js" out_file = "$target_gen_dir/js2c/isolated_bundle.js"
} }
webpack_build("electron_node_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.node_bundle_deps
config_file = "//electron/build/webpack/webpack.config.node.js"
out_file = "$target_gen_dir/js2c/node_init.js"
}
webpack_build("electron_utility_bundle") { webpack_build("electron_utility_bundle") {
deps = [ ":build_electron_definitions" ] deps = [ ":build_electron_definitions" ]
@@ -231,37 +217,32 @@ webpack_build("electron_utility_bundle") {
action("electron_js2c") { action("electron_js2c") {
deps = [ deps = [
":electron_asar_bundle",
":electron_browser_bundle", ":electron_browser_bundle",
":electron_isolated_renderer_bundle", ":electron_isolated_renderer_bundle",
":electron_node_bundle",
":electron_renderer_bundle", ":electron_renderer_bundle",
":electron_sandboxed_renderer_bundle", ":electron_sandboxed_renderer_bundle",
":electron_utility_bundle", ":electron_utility_bundle",
":electron_worker_bundle", ":electron_worker_bundle",
"//third_party/electron_node:node_js2c($electron_js2c_toolchain)",
] ]
sources = [ sources = [
"$target_gen_dir/js2c/asar_bundle.js",
"$target_gen_dir/js2c/browser_init.js", "$target_gen_dir/js2c/browser_init.js",
"$target_gen_dir/js2c/isolated_bundle.js", "$target_gen_dir/js2c/isolated_bundle.js",
"$target_gen_dir/js2c/node_init.js",
"$target_gen_dir/js2c/renderer_init.js", "$target_gen_dir/js2c/renderer_init.js",
"$target_gen_dir/js2c/sandbox_bundle.js", "$target_gen_dir/js2c/sandbox_bundle.js",
"$target_gen_dir/js2c/utility_init.js", "$target_gen_dir/js2c/utility_init.js",
"$target_gen_dir/js2c/worker_init.js", "$target_gen_dir/js2c/worker_init.js",
] ]
inputs = sources inputs = sources + [ "//third_party/electron_node/tools/js2c.py" ]
outputs = [ "$root_gen_dir/electron_natives.cc" ] outputs = [ "$root_gen_dir/electron_natives.cc" ]
script = "build/js2c.py" script = "build/js2c.py"
out_dir = args = [ rebase_path("//third_party/electron_node") ] +
get_label_info(":anything($electron_js2c_toolchain)", "root_out_dir") rebase_path(outputs, root_build_dir) +
args = [ rebase_path(sources, root_build_dir)
rebase_path("$out_dir/node_js2c"),
rebase_path("$root_gen_dir"),
] + rebase_path(outputs, root_gen_dir) +
rebase_path(sources, root_gen_dir)
} }
action("generate_config_gypi") { action("generate_config_gypi") {
@@ -414,10 +395,8 @@ action("electron_generate_node_defines") {
} }
source_set("electron_lib") { source_set("electron_lib") {
configs += [ configs += [ "//v8:external_startup_data" ]
"//v8:external_startup_data", configs += [ "//third_party/electron_node:node_internals" ]
"//third_party/electron_node:node_internals",
]
public_configs = [ public_configs = [
":branding", ":branding",
@@ -442,7 +421,6 @@ source_set("electron_lib") {
"//chrome/app/resources:platform_locale_settings", "//chrome/app/resources:platform_locale_settings",
"//components/autofill/core/common:features", "//components/autofill/core/common:features",
"//components/certificate_transparency", "//components/certificate_transparency",
"//components/compose:buildflags",
"//components/embedder_support:browser_util", "//components/embedder_support:browser_util",
"//components/language/core/browser", "//components/language/core/browser",
"//components/net_log", "//components/net_log",
@@ -451,8 +429,6 @@ source_set("electron_lib") {
"//components/network_hints/renderer", "//components/network_hints/renderer",
"//components/network_session_configurator/common", "//components/network_session_configurator/common",
"//components/omnibox/browser:buildflags", "//components/omnibox/browser:buildflags",
"//components/os_crypt/async/browser",
"//components/os_crypt/async/browser:key_provider_interface",
"//components/os_crypt/sync", "//components/os_crypt/sync",
"//components/pref_registry", "//components/pref_registry",
"//components/prefs", "//components/prefs",
@@ -494,7 +470,6 @@ source_set("electron_lib") {
"//third_party/webrtc_overrides:webrtc_component", "//third_party/webrtc_overrides:webrtc_component",
"//third_party/widevine/cdm:headers", "//third_party/widevine/cdm:headers",
"//third_party/zlib/google:zip", "//third_party/zlib/google:zip",
"//ui/base:ozone_buildflags",
"//ui/base/idle", "//ui/base/idle",
"//ui/compositor", "//ui/compositor",
"//ui/events:dom_keycode_converter", "//ui/events:dom_keycode_converter",
@@ -567,6 +542,7 @@ source_set("electron_lib") {
if (is_mac) { if (is_mac) {
deps += [ deps += [
":electron_lib_arc",
"//components/remote_cocoa/app_shim", "//components/remote_cocoa/app_shim",
"//components/remote_cocoa/browser", "//components/remote_cocoa/browser",
"//content/browser:mac_helpers", "//content/browser:mac_helpers",
@@ -662,7 +638,6 @@ source_set("electron_lib") {
} }
if (is_win) { if (is_win) {
libs += [ "dwmapi.lib" ] libs += [ "dwmapi.lib" ]
sources += [ "shell/common/asar/archive_win.cc" ]
deps += [ deps += [
"//components/crash/core/app:crash_export_thunks", "//components/crash/core/app:crash_export_thunks",
"//ui/native_theme:native_theme_browser", "//ui/native_theme:native_theme_browser",
@@ -696,6 +671,13 @@ source_set("electron_lib") {
] ]
} }
if (enable_views_api) {
sources += [
"shell/browser/api/views/electron_api_image_view.cc",
"shell/browser/api/views/electron_api_image_view.h",
]
}
if (enable_printing) { if (enable_printing) {
sources += [ sources += [
"shell/browser/printing/print_view_manager_electron.cc", "shell/browser/printing/print_view_manager_electron.cc",
@@ -719,7 +701,6 @@ source_set("electron_lib") {
"shell/common/extensions/api", "shell/common/extensions/api",
"shell/common/extensions/api:extensions_features", "shell/common/extensions/api:extensions_features",
"//chrome/browser/resources:component_extension_resources", "//chrome/browser/resources:component_extension_resources",
"//components/guest_view/common:mojom",
"//components/update_client:update_client", "//components/update_client:update_client",
"//components/zoom", "//components/zoom",
"//extensions/browser", "//extensions/browser",
@@ -744,7 +725,7 @@ source_set("electron_lib") {
"//chrome/browser/resources/pdf:resources", "//chrome/browser/resources/pdf:resources",
"//components/pdf/browser", "//components/pdf/browser",
"//components/pdf/browser:interceptors", "//components/pdf/browser:interceptors",
"//components/pdf/common:constants", "//components/pdf/common",
"//components/pdf/renderer", "//components/pdf/renderer",
"//pdf", "//pdf",
] ]
@@ -763,6 +744,62 @@ source_set("electron_lib") {
} }
} }
if (is_mac) {
source_set("electron_lib_arc") {
public_configs = [ ":branding" ]
include_dirs = [ "." ]
sources = [
"shell/app/electron_main_delegate_mac.h",
"shell/app/electron_main_delegate_mac.mm",
"shell/browser/api/electron_api_menu_mac.h",
"shell/browser/api/electron_api_menu_mac.mm",
"shell/browser/api/electron_api_native_theme_mac.mm",
"shell/browser/api/electron_api_push_notifications_mac.mm",
"shell/browser/api/electron_api_system_preferences_mac.mm",
"shell/browser/browser_mac.mm",
"shell/browser/electron_browser_main_parts_mac.mm",
"shell/browser/mac/dict_util.h",
"shell/browser/mac/dict_util.mm",
"shell/browser/mac/electron_application.h",
"shell/browser/mac/electron_application.mm",
"shell/browser/mac/electron_application_delegate.h",
"shell/browser/mac/electron_application_delegate.mm",
"shell/browser/native_window_mac.h",
"shell/browser/native_window_mac.mm",
"shell/browser/ui/cocoa/delayed_native_view_host.h",
"shell/browser/ui/cocoa/delayed_native_view_host.mm",
"shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h",
"shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm",
"shell/browser/ui/cocoa/electron_menu_controller.mm",
"shell/browser/ui/cocoa/electron_ns_window.h",
"shell/browser/ui/cocoa/electron_ns_window.mm",
"shell/browser/ui/cocoa/electron_ns_window_delegate.h",
"shell/browser/ui/cocoa/electron_ns_window_delegate.mm",
"shell/browser/ui/cocoa/electron_touch_bar.h",
"shell/browser/ui/cocoa/electron_touch_bar.mm",
"shell/browser/ui/inspectable_web_contents_view_mac.h",
"shell/browser/ui/inspectable_web_contents_view_mac.mm",
"shell/browser/ui/tray_icon_cocoa.h",
"shell/browser/ui/tray_icon_cocoa.mm",
]
deps = [
"buildflags",
"shell/common/api:mojo",
"//base",
"//skia",
"//third_party/electron_node:node_lib",
"//third_party/webrtc_overrides:webrtc_component",
"//v8",
]
configs += [
"//electron/build/config:mas_build",
"//third_party/electron_node:node_internals",
]
}
}
electron_paks("packed_resources") { electron_paks("packed_resources") {
if (is_mac) { if (is_mac) {
output_dir = "$root_gen_dir/electron_repack" output_dir = "$root_gen_dir/electron_repack"
@@ -923,7 +960,10 @@ if (is_mac) {
assert(defined(invoker.helper_name_suffix)) assert(defined(invoker.helper_name_suffix))
output_name = electron_helper_name + invoker.helper_name_suffix output_name = electron_helper_name + invoker.helper_name_suffix
deps = [ ":electron_framework+link" ] deps = [
":electron_framework+link",
"//base/allocator:early_zone_registration_apple",
]
if (!is_mas_build) { if (!is_mas_build) {
deps += [ "//sandbox/mac:seatbelt" ] deps += [ "//sandbox/mac:seatbelt" ]
} }
@@ -1084,6 +1124,7 @@ if (is_mac) {
":electron_app_plist", ":electron_app_plist",
":electron_app_resources", ":electron_app_resources",
":electron_fuses", ":electron_fuses",
"//base/allocator:early_zone_registration_apple",
"//electron/buildflags", "//electron/buildflags",
] ]
if (is_mas_build) { if (is_mas_build) {
@@ -1335,6 +1376,25 @@ if (is_mac) {
} }
} }
test("shell_browser_ui_unittests") {
sources = [
"//electron/shell/browser/ui/accelerator_util_unittests.cc",
"//electron/shell/browser/ui/run_all_unittests.cc",
]
configs += [ ":electron_lib_config" ]
deps = [
":electron_lib",
"//base",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
"//ui/base",
"//ui/strings",
]
}
template("dist_zip") { template("dist_zip") {
_runtime_deps_target = "${target_name}__deps" _runtime_deps_target = "${target_name}__deps"
_runtime_deps_file = _runtime_deps_file =
@@ -1507,70 +1567,3 @@ action("libcxx_objects_zip") {
group("electron") { group("electron") {
public_deps = [ ":electron_app" ] public_deps = [ ":electron_app" ]
} }
##### node_headers
node_dir = "../third_party/electron_node"
node_files = read_file("$node_dir/filenames.json", "json")
node_headers_dir = "$root_gen_dir/node_headers"
header_group_index = 0
header_groups = []
foreach(header_group, node_files.headers) {
copy("node_headers_${header_group_index}") {
sources = rebase_path(header_group.files, ".", node_dir)
outputs =
[ "$node_headers_dir/${header_group.dest_dir}/{{source_file_part}}" ]
}
header_groups += [ ":node_headers_${header_group_index}" ]
header_group_index += 1
}
copy("zlib_headers") {
sources = [
"$node_dir/deps/zlib/zconf.h",
"$node_dir/deps/zlib/zlib.h",
]
outputs = [ "$node_headers_dir/include/node/{{source_file_part}}" ]
}
copy("node_gypi_headers") {
deps = [ ":generate_config_gypi" ]
sources = [
"$node_dir/common.gypi",
"$root_gen_dir/config.gypi",
]
outputs = [ "$node_headers_dir/include/node/{{source_file_part}}" ]
}
action("node_version_header") {
inputs = [ "$node_dir/src/node_version.h" ]
outputs = [ "$node_headers_dir/include/node/node_version.h" ]
script = "script/generate_node_version_header.py"
args = rebase_path(inputs) + rebase_path(outputs)
if (node_module_version != "") {
args += [ "$node_module_version" ]
}
}
action("tar_node_headers") {
deps = [ ":copy_node_headers" ]
outputs = [ "$root_gen_dir/node_headers.tar.gz" ]
script = "script/tar.py"
args = [
rebase_path("$root_gen_dir/node_headers"),
rebase_path(outputs[0]),
]
}
group("copy_node_headers") {
public_deps = header_groups + [
":node_gypi_headers",
":node_version_header",
":zlib_headers",
]
}
group("node_headers") {
public_deps = [ ":tar_node_headers" ]
}

13
DEPS
View File

@@ -2,19 +2,17 @@ gclient_gn_args_from = 'src'
vars = { vars = {
'chromium_version': 'chromium_version':
'124.0.6359.0', '118.0.5993.89',
'node_version': 'node_version':
'v20.11.1', 'v18.17.1',
'nan_version': 'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213', '16fa32231e2ccd89d2804b3f765319128b20c4ac',
'squirrel.mac_version': 'squirrel.mac_version':
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38', '0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',
'reactiveobjc_version': 'reactiveobjc_version':
'74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76', '74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76',
'mantle_version': 'mantle_version':
'78d3966b3c331292ea29ec38661b25df0a245948', '78d3966b3c331292ea29ec38661b25df0a245948',
'engflow_reclient_configs_version':
'955335c30a752e9ef7bff375baab5e0819b6c00d',
'pyyaml_version': '3.12', 'pyyaml_version': '3.12',
@@ -25,7 +23,6 @@ vars = {
'squirrel_git': 'https://github.com/Squirrel', 'squirrel_git': 'https://github.com/Squirrel',
'reactiveobjc_git': 'https://github.com/ReactiveCocoa', 'reactiveobjc_git': 'https://github.com/ReactiveCocoa',
'mantle_git': 'https://github.com/Mantle', 'mantle_git': 'https://github.com/Mantle',
'engflow_git': 'https://github.com/EngFlow',
# The path of the sysroots.json file. # The path of the sysroots.json file.
'sysroots_json_path': 'electron/script/sysroots.json', 'sysroots_json_path': 'electron/script/sysroots.json',
@@ -105,10 +102,6 @@ deps = {
'src/third_party/squirrel.mac/vendor/Mantle': { 'src/third_party/squirrel.mac/vendor/Mantle': {
'url': Var("mantle_git") + '/Mantle.git@' + Var("mantle_version"), 'url': Var("mantle_git") + '/Mantle.git@' + Var("mantle_version"),
'condition': 'process_deps', 'condition': 'process_deps',
},
'src/third_party/engflow-reclient-configs': {
'url': Var("engflow_git") + '/reclient-configs.git@' + Var("engflow_reclient_configs_version"),
'condition': 'process_deps'
} }
} }

View File

@@ -9,8 +9,8 @@ View these docs in other languages on our [Crowdin](https://crowdin.com/project/
The Electron framework lets you write cross-platform desktop applications The Electron framework lets you write cross-platform desktop applications
using JavaScript, HTML and CSS. It is based on [Node.js](https://nodejs.org/) and using JavaScript, HTML and CSS. It is based on [Node.js](https://nodejs.org/) and
[Chromium](https://www.chromium.org) and is used by the [Visual Studio [Chromium](https://www.chromium.org) and is used by the [Atom
Code](https://github.com/Microsoft/vscode/) and many other [apps](https://electronjs.org/apps). editor](https://github.com/atom/atom) and many other [apps](https://electronjs.org/apps).
Follow [@electronjs](https://twitter.com/electronjs) on Twitter for important Follow [@electronjs](https://twitter.com/electronjs) on Twitter for important
announcements. announcements.
@@ -41,9 +41,9 @@ Each Electron release provides binaries for macOS, Windows, and Linux.
* macOS (Catalina and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11. * macOS (Catalina and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
* Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice). * Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice).
* Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on: * Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on:
* Ubuntu 18.04 and newer * Ubuntu 14.04 and newer
* Fedora 32 and newer * Fedora 24 and newer
* Debian 10 and newer * Debian 8 and newer
## Quick start & Electron Fiddle ## Quick start & Electron Fiddle

View File

@@ -6,13 +6,14 @@
version: 1.0.{build} version: 1.0.{build}
build_cloud: electronhq-16-core build_cloud: electronhq-16-core
image: base-bake-image image: e-112.0.5607.0-vs2022
environment: environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1 ELECTRON_ENABLE_STACK_DUMPING: 1
MOCHA_REPORTER: mocha-multi-reporters MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
GOMA_FALLBACK_ON_AUTH_FAILURE: true
DEPOT_TOOLS_WIN_TOOLCHAIN: 0 DEPOT_TOOLS_WIN_TOOLCHAIN: 0
PYTHONIOENCODING: UTF-8 PYTHONIOENCODING: UTF-8

View File

@@ -29,7 +29,7 @@
version: 1.0.{build} version: 1.0.{build}
build_cloud: electronhq-16-core build_cloud: electronhq-16-core
image: e-123.0.6312.5 image: e-118.0.5993.0
environment: environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
@@ -37,6 +37,7 @@ environment:
ELECTRON_ALSO_LOG_TO_STDERR: 1 ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap" MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
GOMA_FALLBACK_ON_AUTH_FAILURE: true
DEPOT_TOOLS_WIN_TOOLCHAIN: 1 DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_" DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_27370823e7: 28622d16b1 GYP_MSVS_HASH_27370823e7: 28622d16b1
@@ -100,22 +101,31 @@ for:
if (Test-Path -Path "$pwd\src\electron") { if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron Remove-Item -Recurse -Force $pwd\src\electron
} }
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
}
- git clone https://github.com/electron/build-tools.git - git clone https://github.com/electron/build-tools.git
- cd build-tools - cd build-tools
- npx yarn --ignore-engines - npm install
- mkdir third_party - mkdir third_party
- ps: >- - ps: >-
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})" node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})" - ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- ps: >- - ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
& $env:RECLIENT_HELPER login
- ps: >-
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
- ps: >-
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_experimental_credentials_helper_args = "print"
- cd ..\.. - cd ..\..
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$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 {
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
$host.SetShouldExit(1)
}
}
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools" - ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >- - ps: >-
if ($env:GN_CONFIG -ne 'release') { if ($env:GN_CONFIG -ne 'release') {
@@ -137,36 +147,37 @@ for:
- cd src - cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH" - ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn - set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% " - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib - gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app - gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo - gn check out/Default //electron/shell/common/api:mojo
- if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app) - if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default ) - if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%" - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip - ninja -C out/ffmpeg electron:electron_ffmpeg_zip
- autoninja -C out/Default electron:electron_dist_zip - ninja -C out/Default electron:electron_dist_zip
- ninja -C out/Default shell_browser_ui_unittests
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args - gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args # Remove unused args from mksnapshot_args
- ps: >- - ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') -And -not $_.Contains('The gn arg use_goma=true') } | Set-Content out/Default/mksnapshot_args Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- autoninja -C out/Default electron:electron_mksnapshot_zip - ninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default - cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S - 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\.. - cd ..\..
- autoninja -C out/Default electron:hunspell_dictionaries_zip - ninja -C out/Default electron:hunspell_dictionaries_zip
- autoninja -C out/Default electron:electron_chromedriver_zip - ninja -C out/Default electron:electron_chromedriver_zip
- autoninja -C out/Default electron:node_headers - ninja -C out/Default third_party/electron_node:headers
- python3 %LOCAL_GOMA_DIR%\goma_ctl.py stat
- ps: >- - 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 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 - python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers - 7z a node_headers.zip out\Default\gen\node_headers
- 7z a nan.zip third_party\nan
- ps: >- - ps: >-
if ($env:GN_CONFIG -eq 'release') { if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows # Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin" $env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
autoninja -C out/Default electron:electron_symbols ninja -C out/Default electron:electron_symbols
} }
- ps: >- - ps: >-
if ($env:GN_CONFIG -eq 'release') { if ($env:GN_CONFIG -eq 'release') {
@@ -177,28 +188,20 @@ for:
# built on CI. # built on CI.
7z a pdb.zip out\Default\*.pdb 7z a pdb.zip out\Default\*.pdb
} }
- ps: | - python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
if ($LASTEXITCODE -ne 0) {
throw "Zip contains files not listed in the manifest $manifest_file"
}
- ps: | - ps: |
cd C:\projects\src cd C:\projects\src
$missing_artifacts = $false $missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') { if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME" Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
} else { } else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip','nan.zip' $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) { foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') { if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip" $artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif ( } elseif (
$artifact_name -eq 'node_headers.zip') { $artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name $artifact_file = $artifact_name
} elseif (
$artifact_name -eq 'nan.zip') {
$artifact_file = $artifact_name
} else { } else {
$artifact_file = "out\Default\$artifact_name" $artifact_file = "out\Default\$artifact_name"
} }
@@ -230,10 +233,10 @@ for:
- cd C:\projects\src - cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json ) - if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip) - if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip) - if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip) - if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip) - if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist nan.zip (appveyor-retry appveyor PushArtifact nan.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.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\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)
@@ -269,12 +272,12 @@ for:
# Download build artifacts # Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api' $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" $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','electron.lib', 'nan.zip') $artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib')
foreach ($job in $build_info.build.jobs) { foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build Arm on X64 Windows") { if ($job.name -eq "Build Arm on X64 Windows") {
$jobId = $job.jobId $jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) { foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'electron.lib') { if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name" $outfile = "src\out\Default\$artifact_name"
} else { } else {
$outfile = $artifact_name $outfile = $artifact_name
@@ -293,7 +296,6 @@ for:
} }
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip - ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip - ps: 7z x -y -osrc node_headers.zip
- ps: 7z x -y -osrc nan.zip
test_script: test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420 # Workaround for https://github.com/appveyor/ci/issues/2420
@@ -317,4 +319,4 @@ for:
on_finish: on_finish:
# Uncomment these lines to enable RDP # Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log ) - if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )

View File

@@ -29,7 +29,7 @@
version: 1.0.{build} version: 1.0.{build}
build_cloud: electronhq-16-core build_cloud: electronhq-16-core
image: e-123.0.6312.5 image: e-118.0.5993.0
environment: environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
@@ -37,6 +37,7 @@ environment:
ELECTRON_ALSO_LOG_TO_STDERR: 1 ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap" MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
GOMA_FALLBACK_ON_AUTH_FAILURE: true
DEPOT_TOOLS_WIN_TOOLCHAIN: 1 DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_" DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_27370823e7: 28622d16b1 GYP_MSVS_HASH_27370823e7: 28622d16b1
@@ -98,22 +99,31 @@ for:
if (Test-Path -Path "$pwd\src\electron") { if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron Remove-Item -Recurse -Force $pwd\src\electron
} }
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
}
- git clone https://github.com/electron/build-tools.git - git clone https://github.com/electron/build-tools.git
- cd build-tools - cd build-tools
- npx yarn --ignore-engines - npm install
- mkdir third_party - mkdir third_party
- ps: >- - ps: >-
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})" node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})" - ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- ps: >- - ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
& $env:RECLIENT_HELPER login
- ps: >-
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
- ps: >-
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_experimental_credentials_helper_args = "print"
- cd ..\.. - cd ..\..
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$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 {
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
$host.SetShouldExit(1)
}
}
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools" - ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >- - ps: >-
if ($env:GN_CONFIG -ne 'release') { if ($env:GN_CONFIG -ne 'release') {
@@ -135,26 +145,28 @@ for:
- cd src - cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH" - ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn - set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% " - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib - gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app - gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo - gn check out/Default //electron/shell/common/api:mojo
- if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app) - if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default ) - if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%" - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip - ninja -C out/ffmpeg electron:electron_ffmpeg_zip
- autoninja -C out/Default electron:electron_dist_zip - ninja -C out/Default electron:electron_dist_zip
- ninja -C out/Default shell_browser_ui_unittests
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args - gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args # Remove unused args from mksnapshot_args
- ps: >- - ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') -And -not $_.Contains('The gn arg use_goma=true') } | Set-Content out/Default/mksnapshot_args Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- autoninja -C out/Default electron:electron_mksnapshot_zip - ninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default - cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S - 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\.. - cd ..\..
- autoninja -C out/Default electron:hunspell_dictionaries_zip - ninja -C out/Default electron:hunspell_dictionaries_zip
- autoninja -C out/Default electron:electron_chromedriver_zip - ninja -C out/Default electron:electron_chromedriver_zip
- autoninja -C out/Default electron:node_headers - ninja -C out/Default third_party/electron_node:headers
- python3 %LOCAL_GOMA_DIR%\goma_ctl.py stat
- ps: >- - 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 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 - python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
@@ -163,7 +175,7 @@ for:
if ($env:GN_CONFIG -eq 'release') { if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows # Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin" $env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
autoninja -C out/Default electron:electron_symbols ninja -C out/Default electron:electron_symbols
} }
- ps: >- - ps: >-
if ($env:GN_CONFIG -eq 'release') { if ($env:GN_CONFIG -eq 'release') {
@@ -174,19 +186,14 @@ for:
# built on CI. # built on CI.
7z a pdb.zip out\Default\*.pdb 7z a pdb.zip out\Default\*.pdb
} }
- ps: | - python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
if ($LASTEXITCODE -ne 0) {
throw "Zip contains files not listed in the manifest $manifest_file"
}
- ps: | - ps: |
cd C:\projects\src cd C:\projects\src
$missing_artifacts = $false $missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') { if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME" Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
} else { } else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip' $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) { foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') { if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip" $artifact_file = "out\ffmpeg\ffmpeg.zip"
@@ -224,6 +231,7 @@ for:
- cd C:\projects\src - cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json ) - if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip) - if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip) - if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip) - if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip) - if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
@@ -260,12 +268,12 @@ for:
# Download build artifacts # Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api' $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" $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','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib') $artifacts_to_download = @('dist.zip','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
foreach ($job in $build_info.build.jobs) { foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build") { if ($job.name -eq "Build") {
$jobId = $job.jobId $jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) { foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'electron.lib') { if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name" $outfile = "src\out\Default\$artifact_name"
} else { } else {
$outfile = $artifact_name $outfile = $artifact_name
@@ -299,6 +307,7 @@ for:
$env:npm_config_arch = "ia32" $env:npm_config_arch = "ia32"
} }
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log - echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log
- echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log
- cd .. - cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg - echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
- echo "About to verify mksnapshot" - echo "About to verify mksnapshot"
@@ -310,4 +319,4 @@ for:
on_finish: on_finish:
# Uncomment these lines to enable RDP # Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log ) - if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )

View File

@@ -2,7 +2,7 @@ is_electron_build = true
root_extra_deps = [ "//electron" ] root_extra_deps = [ "//electron" ]
# Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json # Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
node_module_version = 123 node_module_version = 118
v8_promise_internal_field_count = 1 v8_promise_internal_field_count = 1
v8_embedder_string = "-electron.0" v8_embedder_string = "-electron.0"
@@ -24,10 +24,6 @@ enable_printing = true
angle_enable_vulkan_validation_layers = false angle_enable_vulkan_validation_layers = false
dawn_enable_vulkan_validation_layers = false dawn_enable_vulkan_validation_layers = false
# Removes dxc dll's that are only used experimentally.
# See https://bugs.chromium.org/p/chromium/issues/detail?id=1474897
dawn_use_built_dxc = false
# These are disabled because they cause the zip manifest to differ between # These are disabled because they cause the zip manifest to differ between
# testing and release builds. # testing and release builds.
# See https://chromium-review.googlesource.com/c/chromium/src/+/2774898. # See https://chromium-review.googlesource.com/c/chromium/src/+/2774898.
@@ -60,10 +56,3 @@ v8_builtins_profiling_log_file = ""
# https://chromium.googlesource.com/chromium/src/+/main/docs/dangling_ptr.md # https://chromium.googlesource.com/chromium/src/+/main/docs/dangling_ptr.md
# TODO(vertedinde): hunt down dangling pointers on Linux # TODO(vertedinde): hunt down dangling pointers on Linux
enable_dangling_raw_ptr_checks = false enable_dangling_raw_ptr_checks = false
# This flag speeds up the performance of fork/execve on linux systems.
# Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4602858
v8_enable_private_mapping_fork_optimization = true
# Expose public V8 symbols for native modules.
v8_expose_public_symbols = true

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3 from __future__ import print_function
import collections import collections
import os import os

View File

@@ -32,13 +32,6 @@ extern const volatile char kFuseWire[];
TEMPLATE_CC = """ TEMPLATE_CC = """
#include "electron/fuses.h" #include "electron/fuses.h"
#include "base/dcheck_is_on.h"
#if DCHECK_IS_ON()
#include "base/command_line.h"
#include "base/strings/string_util.h"
#include <string>
#endif
namespace electron::fuses { namespace electron::fuses {
@@ -73,20 +66,9 @@ for fuse in fuses:
getters_h += "FUSE_EXPORT bool Is{name}Enabled();\n".replace("{name}", name) getters_h += "FUSE_EXPORT bool Is{name}Enabled();\n".replace("{name}", name)
getters_cc += """ getters_cc += """
bool Is{name}Enabled() { bool Is{name}Enabled() {
#if DCHECK_IS_ON()
// RunAsNode is checked so early that base::CommandLine isn't yet
// initialized, so guard here to avoid a CHECK.
if (base::CommandLine::InitializedForCurrentProcess()) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch("{switch_name}")) {
std::string switch_value = command_line->GetSwitchValueASCII("{switch_name}");
return switch_value == "1";
}
}
#endif
return kFuseWire[{index}] == '1'; return kFuseWire[{index}] == '1';
} }
""".replace("{name}", name).replace("{switch_name}", f"set-fuse-{fuse.lower()}").replace("{index}", str(index)) """.replace("{name}", name).replace("{index}", str(index))
def c_hex(n): def c_hex(n):
s = hex(n)[2:] s = hex(n)[2:]

View File

@@ -8,6 +8,5 @@
"node_cli_inspect": "1", "node_cli_inspect": "1",
"embedded_asar_integrity_validation": "0", "embedded_asar_integrity_validation": "0",
"only_load_app_from_asar": "0", "only_load_app_from_asar": "0",
"load_browser_process_specific_v8_snapshot": "0", "load_browser_process_specific_v8_snapshot": "0"
"grant_file_protocol_extra_privileges": "1"
} }

32
build/js2c.py Normal file → Executable file
View File

@@ -4,14 +4,32 @@ import os
import subprocess import subprocess
import sys import sys
def main(): TEMPLATE = """
js2c = sys.argv[1] #include "node_native_module.h"
root = sys.argv[2] #include "node_internals.h"
natives = sys.argv[3]
js_source_files = sys.argv[4:]
namespace node::native_module {{
{definitions}
void NativeModuleLoader::LoadEmbedderJavaScriptSource() {{
{initializers}
}}
}} // namespace node::native_module
"""
def main():
node_path = os.path.abspath(sys.argv[1])
natives = os.path.abspath(sys.argv[2])
js_source_files = sys.argv[3:]
js2c = os.path.join(node_path, 'tools', 'js2c.py')
subprocess.check_call( subprocess.check_call(
[js2c, natives] + js_source_files + ['--only-js', "--root", root]) [sys.executable, js2c] +
js_source_files +
['--only-js', '--target', natives])
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from __future__ import print_function
import os import os
import subprocess import subprocess
import sys import sys

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3 from __future__ import unicode_literals
import contextlib import contextlib
import sys import sys

View File

@@ -1,11 +1,10 @@
import sys import sys
import os import os
import subprocess
def main(argv): def main(argv):
os.chdir(argv[1]) cwd = argv[1]
p = subprocess.Popen(argv[2:]) os.chdir(cwd)
return p.wait() os.execv(sys.executable, [sys.executable] + argv[2:])
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main(sys.argv)) main(sys.argv)

View File

@@ -0,0 +1,5 @@
module.exports = require('./webpack.config.base')({
target: 'asar',
alwaysHasNode: true,
targetDeletesNodeGlobals: true
});

View File

@@ -53,6 +53,12 @@ module.exports = ({
const ignoredModules = []; const ignoredModules = [];
if (defines.ENABLE_VIEWS_API === 'false') {
ignoredModules.push(
'@electron/internal/browser/api/views/image-view.js'
);
}
const plugins = []; const plugins = [];
if (onlyPrintingGraph) { if (onlyPrintingGraph) {

View File

@@ -1,4 +0,0 @@
module.exports = require('./webpack.config.base')({
target: 'node',
alwaysHasNode: true
});

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from __future__ import print_function
import os import os
import subprocess import subprocess
import sys import sys

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from __future__ import print_function
import os import os
import subprocess import subprocess
import sys import sys

View File

@@ -9,20 +9,10 @@ buildflag_header("buildflags") {
header = "buildflags.h" header = "buildflags.h"
flags = [ flags = [
"ENABLE_VIEWS_API=$enable_views_api",
"ENABLE_PDF_VIEWER=$enable_pdf_viewer", "ENABLE_PDF_VIEWER=$enable_pdf_viewer",
"ENABLE_ELECTRON_EXTENSIONS=$enable_electron_extensions", "ENABLE_ELECTRON_EXTENSIONS=$enable_electron_extensions",
"ENABLE_BUILTIN_SPELLCHECKER=$enable_builtin_spellchecker", "ENABLE_BUILTIN_SPELLCHECKER=$enable_builtin_spellchecker",
"OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider", "OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
] ]
if (electron_vendor_version != "") {
result = string_split(electron_vendor_version, ":")
flags += [
"HAS_VENDOR_VERSION=true",
"VENDOR_VERSION_NAME=\"${result[0]}\"",
"VENDOR_VERSION_VALUE=\"${result[1]}\"",
]
} else {
flags += [ "HAS_VENDOR_VERSION=false" ]
}
} }

View File

@@ -3,6 +3,8 @@
# found in the LICENSE file. # found in the LICENSE file.
declare_args() { declare_args() {
enable_views_api = true
enable_pdf_viewer = true enable_pdf_viewer = true
# Provide a fake location provider for mocking # Provide a fake location provider for mocking
@@ -16,15 +18,4 @@ declare_args() {
# Enable Spellchecker support # Enable Spellchecker support
enable_builtin_spellchecker = true enable_builtin_spellchecker = true
# The version of Electron.
# Packagers and vendor builders should set this in gn args to avoid running
# the script that reads git tag.
override_electron_version = ""
# Define an extra item that will show in process.versions, the value must
# be in the format of "key:value".
# Packagers and vendor builders can set this in gn args to attach extra info
# about the build in the binary.
electron_vendor_version = ""
} }

View File

@@ -14,6 +14,8 @@ import("//third_party/widevine/cdm/widevine.gni")
static_library("chrome") { static_library("chrome") {
visibility = [ "//electron:electron_lib" ] visibility = [ "//electron:electron_lib" ]
sources = [ sources = [
"//chrome/browser/accessibility/accessibility_ui.cc",
"//chrome/browser/accessibility/accessibility_ui.h",
"//chrome/browser/app_mode/app_mode_utils.cc", "//chrome/browser/app_mode/app_mode_utils.cc",
"//chrome/browser/app_mode/app_mode_utils.h", "//chrome/browser/app_mode/app_mode_utils.h",
"//chrome/browser/browser_features.cc", "//chrome/browser/browser_features.cc",
@@ -29,8 +31,6 @@ static_library("chrome") {
"//chrome/browser/devtools/devtools_file_system_indexer.cc", "//chrome/browser/devtools/devtools_file_system_indexer.cc",
"//chrome/browser/devtools/devtools_file_system_indexer.h", "//chrome/browser/devtools/devtools_file_system_indexer.h",
"//chrome/browser/devtools/devtools_settings.h", "//chrome/browser/devtools/devtools_settings.h",
"//chrome/browser/devtools/visual_logging.cc",
"//chrome/browser/devtools/visual_logging.h",
"//chrome/browser/extensions/global_shortcut_listener.cc", "//chrome/browser/extensions/global_shortcut_listener.cc",
"//chrome/browser/extensions/global_shortcut_listener.h", "//chrome/browser/extensions/global_shortcut_listener.h",
"//chrome/browser/icon_loader.cc", "//chrome/browser/icon_loader.cc",
@@ -55,16 +55,8 @@ static_library("chrome") {
"//chrome/browser/net/proxy_config_monitor.h", "//chrome/browser/net/proxy_config_monitor.h",
"//chrome/browser/net/proxy_service_factory.cc", "//chrome/browser/net/proxy_service_factory.cc",
"//chrome/browser/net/proxy_service_factory.h", "//chrome/browser/net/proxy_service_factory.h",
"//chrome/browser/picture_in_picture/picture_in_picture_bounds_cache.cc",
"//chrome/browser/picture_in_picture/picture_in_picture_bounds_cache.h",
"//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.cc",
"//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h",
"//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker_observer.cc",
"//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker_observer.h",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc", "//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h", "//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
"//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.cc",
"//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.h",
"//chrome/browser/platform_util.cc", "//chrome/browser/platform_util.cc",
"//chrome/browser/platform_util.h", "//chrome/browser/platform_util.h",
"//chrome/browser/predictors/preconnect_manager.cc", "//chrome/browser/predictors/preconnect_manager.cc",
@@ -98,14 +90,16 @@ static_library("chrome") {
"//chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.h", "//chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.h",
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.cc", "//chrome/browser/ui/exclusive_access/keyboard_lock_controller.cc",
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.h", "//chrome/browser/ui/exclusive_access/keyboard_lock_controller.h",
"//chrome/browser/ui/exclusive_access/pointer_lock_controller.cc", "//chrome/browser/ui/exclusive_access/mouse_lock_controller.cc",
"//chrome/browser/ui/exclusive_access/pointer_lock_controller.h", "//chrome/browser/ui/exclusive_access/mouse_lock_controller.h",
"//chrome/browser/ui/frame/window_frame_util.cc", "//chrome/browser/ui/frame/window_frame_util.cc",
"//chrome/browser/ui/frame/window_frame_util.h", "//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/ui/ui_features.cc", "//chrome/browser/ui/ui_features.cc",
"//chrome/browser/ui/ui_features.h", "//chrome/browser/ui/ui_features.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc", "//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h", "//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.h",
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc", "//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
"//chrome/browser/ui/views/overlay/close_image_button.cc", "//chrome/browser/ui/views/overlay/close_image_button.cc",
"//chrome/browser/ui/views/overlay/close_image_button.h", "//chrome/browser/ui/views/overlay/close_image_button.h",
@@ -128,8 +122,6 @@ static_library("chrome") {
"//chrome/browser/ui/views/overlay/toggle_microphone_button.h", "//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
"//chrome/browser/ui/views/overlay/video_overlay_window_views.cc", "//chrome/browser/ui/views/overlay/video_overlay_window_views.cc",
"//chrome/browser/ui/views/overlay/video_overlay_window_views.h", "//chrome/browser/ui/views/overlay/video_overlay_window_views.h",
"//chrome/browser/ui/webui/accessibility/accessibility_ui.cc",
"//chrome/browser/ui/webui/accessibility/accessibility_ui.h",
"//extensions/browser/app_window/size_constraints.cc", "//extensions/browser/app_window/size_constraints.cc",
"//extensions/browser/app_window/size_constraints.h", "//extensions/browser/app_window/size_constraints.h",
"//ui/views/native_window_tracker.h", "//ui/views/native_window_tracker.h",
@@ -162,6 +154,15 @@ static_library("chrome") {
sources += [ "//chrome/browser/media/webrtc/window_icon_util_ozone.cc" ] sources += [ "//chrome/browser/media/webrtc/window_icon_util_ozone.cc" ]
} }
if (use_aura) {
sources += [
"//chrome/browser/platform_util_aura.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_aura.cc",
"//ui/views/native_window_tracker_aura.cc",
"//ui/views/native_window_tracker_aura.h",
]
}
public_deps = [ public_deps = [
"//chrome/browser:dev_ui_browser_resources", "//chrome/browser:dev_ui_browser_resources",
"//chrome/browser/resources/accessibility:resources", "//chrome/browser/resources/accessibility:resources",
@@ -186,16 +187,6 @@ static_library("chrome") {
"//ui/views/controls/webview", "//ui/views/controls/webview",
] ]
if (use_aura) {
sources += [
"//chrome/browser/platform_util_aura.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_aura.cc",
"//ui/views/native_window_tracker_aura.cc",
"//ui/views/native_window_tracker_aura.h",
]
deps += [ "//components/eye_dropper" ]
}
if (is_linux) { if (is_linux) {
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ] sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
if (use_ozone) { if (use_ozone) {
@@ -226,30 +217,11 @@ static_library("chrome") {
"//chrome/browser/win/icon_reader_service.cc", "//chrome/browser/win/icon_reader_service.cc",
"//chrome/browser/win/icon_reader_service.h", "//chrome/browser/win/icon_reader_service.h",
] ]
public_deps += [ public_deps += [ "//chrome/services/util_win:lib" ]
"//chrome/browser/web_applications/proto",
"//chrome/services/util_win:lib",
"//components/webapps/common:mojo_bindings",
]
} }
if (is_mac) { if (is_mac) {
sources += [ public_deps += [ ":chrome_lib_arc" ]
"//chrome/browser/extensions/global_shortcut_listener_mac.h",
"//chrome/browser/extensions/global_shortcut_listener_mac.mm",
"//chrome/browser/icon_loader_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm",
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.h",
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.mm",
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
"//chrome/browser/platform_util_mac.mm",
"//chrome/browser/process_singleton_mac.mm",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
]
} }
if (enable_widevine) { if (enable_widevine) {
@@ -266,8 +238,6 @@ static_library("chrome") {
sources += [ sources += [
"//chrome/browser/bad_message.cc", "//chrome/browser/bad_message.cc",
"//chrome/browser/bad_message.h", "//chrome/browser/bad_message.h",
"//chrome/browser/printing/prefs_util.cc",
"//chrome/browser/printing/prefs_util.h",
"//chrome/browser/printing/print_job.cc", "//chrome/browser/printing/print_job.cc",
"//chrome/browser/printing/print_job.h", "//chrome/browser/printing/print_job.h",
"//chrome/browser/printing/print_job_manager.cc", "//chrome/browser/printing/print_job_manager.cc",
@@ -345,8 +315,6 @@ static_library("chrome") {
"//chrome/browser/pdf/pdf_extension_util.h", "//chrome/browser/pdf/pdf_extension_util.h",
"//chrome/browser/pdf/pdf_frame_util.cc", "//chrome/browser/pdf/pdf_frame_util.cc",
"//chrome/browser/pdf/pdf_frame_util.h", "//chrome/browser/pdf/pdf_frame_util.h",
"//chrome/browser/pdf/pdf_viewer_stream_manager.cc",
"//chrome/browser/pdf/pdf_viewer_stream_manager.h",
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc", "//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc",
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.h", "//chrome/browser/plugins/pdf_iframe_navigation_throttle.h",
] ]
@@ -397,6 +365,34 @@ static_library("chrome") {
} }
} }
if (is_mac) {
source_set("chrome_lib_arc") {
include_dirs = [ "." ]
sources = [
"//chrome/browser/extensions/global_shortcut_listener_mac.h",
"//chrome/browser/extensions/global_shortcut_listener_mac.mm",
"//chrome/browser/icon_loader_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm",
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
"//chrome/browser/platform_util_mac.mm",
"//chrome/browser/process_singleton_mac.mm",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
]
deps = [
"//base",
"//skia",
"//third_party/electron_node:node_lib",
"//third_party/webrtc_overrides:webrtc_component",
"//v8",
]
}
}
source_set("plugins") { source_set("plugins") {
sources = [] sources = []
deps = [] deps = []
@@ -454,8 +450,6 @@ source_set("chrome_spellchecker") {
"//chrome/browser/profiles/profile_selections.h", "//chrome/browser/profiles/profile_selections.h",
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.cc", "//chrome/browser/spellchecker/spell_check_host_chrome_impl.cc",
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.h", "//chrome/browser/spellchecker/spell_check_host_chrome_impl.h",
"//chrome/browser/spellchecker/spell_check_initialization_host_impl.cc",
"//chrome/browser/spellchecker/spell_check_initialization_host_impl.h",
"//chrome/browser/spellchecker/spellcheck_custom_dictionary.cc", "//chrome/browser/spellchecker/spellcheck_custom_dictionary.cc",
"//chrome/browser/spellchecker/spellcheck_custom_dictionary.h", "//chrome/browser/spellchecker/spellcheck_custom_dictionary.h",
"//chrome/browser/spellchecker/spellcheck_factory.cc", "//chrome/browser/spellchecker/spellcheck_factory.cc",

View File

@@ -51,17 +51,16 @@ async function createWindow (backgroundColor?: string) {
autoHideMenuBar: true, autoHideMenuBar: true,
backgroundColor, backgroundColor,
webPreferences: { webPreferences: {
preload: url.fileURLToPath(new URL('preload.js', import.meta.url)), preload: path.resolve(__dirname, 'preload.js'),
contextIsolation: true, contextIsolation: true,
sandbox: true, sandbox: true
nodeIntegration: false
}, },
useContentSize: true, useContentSize: true,
show: false show: false
}; };
if (process.platform === 'linux') { if (process.platform === 'linux') {
options.icon = url.fileURLToPath(new URL('icon.png', import.meta.url)); options.icon = path.join(__dirname, 'icon.png');
} }
mainWindow = new BrowserWindow(options); mainWindow = new BrowserWindow(options);

View File

@@ -1,7 +1,6 @@
import * as electron from 'electron/main'; import * as electron from 'electron/main';
import * as fs from 'node:fs'; import * as fs from 'node:fs';
import { Module } from 'node:module';
import * as path from 'node:path'; import * as path from 'node:path';
import * as url from 'node:url'; import * as url from 'node:url';
const { app, dialog } = electron; const { app, dialog } = electron;
@@ -16,6 +15,8 @@ type DefaultAppOptions = {
modules: string[]; modules: string[];
} }
const Module = require('node:module');
// Parse command line options. // Parse command line options.
const argv = process.argv.slice(1); const argv = process.argv.slice(1);
@@ -70,10 +71,10 @@ if (nextArgIsRequire) {
// Set up preload modules // Set up preload modules
if (option.modules.length > 0) { if (option.modules.length > 0) {
(Module as any)._preloadModules(option.modules); Module._preloadModules(option.modules);
} }
async function loadApplicationPackage (packagePath: string) { function loadApplicationPackage (packagePath: string) {
// Add a flag indicating app is started from default app. // Add a flag indicating app is started from default app.
Object.defineProperty(process, 'defaultApp', { Object.defineProperty(process, 'defaultApp', {
configurable: false, configurable: false,
@@ -88,19 +89,11 @@ async function loadApplicationPackage (packagePath: string) {
let appPath; let appPath;
if (fs.existsSync(packageJsonPath)) { if (fs.existsSync(packageJsonPath)) {
let packageJson; let packageJson;
const emitWarning = process.emitWarning;
try { try {
process.emitWarning = () => {}; packageJson = require(packageJsonPath);
packageJson = (await import(url.pathToFileURL(packageJsonPath).toString(), {
assert: {
type: 'json'
}
})).default;
} catch (e) { } catch (e) {
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${(e as Error).message}`); showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${(e as Error).message}`);
return; return;
} finally {
process.emitWarning = emitWarning;
} }
if (packageJson.version) { if (packageJson.version) {
@@ -119,15 +112,13 @@ async function loadApplicationPackage (packagePath: string) {
// Set v8 flags, deliberately lazy load so that apps that do not use this // Set v8 flags, deliberately lazy load so that apps that do not use this
// feature do not pay the price // feature do not pay the price
if (packageJson.v8Flags) { if (packageJson.v8Flags) {
(await import('node:v8')).setFlagsFromString(packageJson.v8Flags); require('node:v8').setFlagsFromString(packageJson.v8Flags);
} }
appPath = packagePath; appPath = packagePath;
} }
let filePath: string;
try { try {
filePath = (Module as any)._resolveFilename(packagePath, null, true); const filePath = Module._resolveFilename(packagePath, module, true);
app.setAppPath(appPath || path.dirname(filePath)); app.setAppPath(appPath || path.dirname(filePath));
} catch (e) { } catch (e) {
showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${(e as Error).message}`); showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${(e as Error).message}`);
@@ -135,7 +126,7 @@ async function loadApplicationPackage (packagePath: string) {
} }
// Run the app. // Run the app.
await import(url.pathToFileURL(filePath).toString()); Module._load(packagePath, module, true);
} catch (e) { } catch (e) {
console.error('App threw an error during load'); console.error('App threw an error during load');
console.error((e as Error).stack || e); console.error((e as Error).stack || e);
@@ -150,16 +141,16 @@ function showErrorMessage (message: string) {
} }
async function loadApplicationByURL (appUrl: string) { async function loadApplicationByURL (appUrl: string) {
const { loadURL } = await import('./default_app.js'); const { loadURL } = await import('./default_app');
loadURL(appUrl); loadURL(appUrl);
} }
async function loadApplicationByFile (appPath: string) { async function loadApplicationByFile (appPath: string) {
const { loadFile } = await import('./default_app.js'); const { loadFile } = await import('./default_app');
loadFile(appPath); loadFile(appPath);
} }
async function startRepl () { function startRepl () {
if (process.platform === 'win32') { if (process.platform === 'win32') {
console.error('Electron REPL not currently supported on Windows'); console.error('Electron REPL not currently supported on Windows');
process.exit(1); process.exit(1);
@@ -180,8 +171,8 @@ async function startRepl () {
Using: Node.js ${nodeVersion} and Electron.js ${electronVersion} Using: Node.js ${nodeVersion} and Electron.js ${electronVersion}
`); `);
const { start } = await import('node:repl'); const { REPLServer } = require('node:repl');
const repl = start({ const repl = new REPLServer({
prompt: '> ' prompt: '> '
}).on('exit', () => { }).on('exit', () => {
process.exit(0); process.exit(0);
@@ -234,8 +225,8 @@ async function startRepl () {
const electronBuiltins = [...Object.keys(electron), 'original-fs', 'electron']; const electronBuiltins = [...Object.keys(electron), 'original-fs', 'electron'];
const defaultComplete: Function = repl.completer; const defaultComplete = repl.completer;
(repl as any).completer = (line: string, callback: Function) => { repl.completer = (line: string, callback: Function) => {
const lastSpace = line.lastIndexOf(' '); const lastSpace = line.lastIndexOf(' ');
const currentSymbol = line.substring(lastSpace + 1, repl.cursor); const currentSymbol = line.substring(lastSpace + 1, repl.cursor);
@@ -258,11 +249,11 @@ if (option.file && !option.webdriver) {
const protocol = url.parse(file).protocol; const protocol = url.parse(file).protocol;
const extension = path.extname(file); const extension = path.extname(file);
if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') { if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') {
await loadApplicationByURL(file); loadApplicationByURL(file);
} else if (extension === '.html' || extension === '.htm') { } else if (extension === '.html' || extension === '.htm') {
await loadApplicationByFile(path.resolve(file)); loadApplicationByFile(path.resolve(file));
} else { } else {
await loadApplicationPackage(file); loadApplicationPackage(file);
} }
} else if (option.version) { } else if (option.version) {
console.log('v' + process.versions.electron); console.log('v' + process.versions.electron);
@@ -271,7 +262,7 @@ if (option.file && !option.webdriver) {
console.log(process.versions.modules); console.log(process.versions.modules);
process.exit(0); process.exit(0);
} else if (option.interactive) { } else if (option.interactive) {
await startRepl(); startRepl();
} else { } else {
if (!option.noHelp) { if (!option.noHelp) {
const welcomeMessage = ` const welcomeMessage = `
@@ -294,5 +285,5 @@ Options:
console.log(welcomeMessage); console.log(welcomeMessage);
} }
await loadApplicationByFile('index.html'); loadApplicationByFile('index.html');
} }

View File

@@ -1,6 +1,5 @@
{ {
"name": "electron", "name": "electron",
"productName": "Electron", "productName": "Electron",
"main": "main.js", "main": "main.js"
"type": "module"
} }

View File

@@ -1,4 +1,4 @@
const { ipcRenderer, contextBridge } = require('electron/renderer'); import { ipcRenderer, contextBridge } from 'electron/renderer';
const policy = window.trustedTypes.createPolicy('electron-default-app', { const policy = window.trustedTypes.createPolicy('electron-default-app', {
// we trust the SVG contents // we trust the SVG contents

View File

@@ -106,7 +106,7 @@ These individual tutorials expand on topics discussed in the guide above.
* [app](api/app.md) * [app](api/app.md)
* [autoUpdater](api/auto-updater.md) * [autoUpdater](api/auto-updater.md)
* [BaseWindow](api/base-window.md) * [BrowserView](api/browser-view.md)
* [BrowserWindow](api/browser-window.md) * [BrowserWindow](api/browser-window.md)
* [contentTracing](api/content-tracing.md) * [contentTracing](api/content-tracing.md)
* [desktopCapturer](api/desktop-capturer.md) * [desktopCapturer](api/desktop-capturer.md)
@@ -134,10 +134,8 @@ These individual tutorials expand on topics discussed in the guide above.
* [TouchBar](api/touch-bar.md) * [TouchBar](api/touch-bar.md)
* [Tray](api/tray.md) * [Tray](api/tray.md)
* [utilityProcess](api/utility-process.md) * [utilityProcess](api/utility-process.md)
* [View](api/view.md)
* [webContents](api/web-contents.md) * [webContents](api/web-contents.md)
* [webFrameMain](api/web-frame-main.md) * [webFrameMain](api/web-frame-main.md)
* [WebContentsView](api/web-contents-view.md)
### Modules for the Renderer Process (Web Page): ### Modules for the Renderer Process (Web Page):

View File

@@ -4,7 +4,7 @@
Accelerators are strings that can contain multiple modifiers and a single key code, Accelerators are strings that can contain multiple modifiers and a single key code,
combined by the `+` character, and are used to define keyboard shortcuts combined by the `+` character, and are used to define keyboard shortcuts
throughout your application. Accelerators are case insensitive. throughout your application.
Examples: Examples:
@@ -15,7 +15,7 @@ Shortcuts are registered with the [`globalShortcut`](global-shortcut.md) module
using the [`register`](global-shortcut.md#globalshortcutregisteraccelerator-callback) using the [`register`](global-shortcut.md#globalshortcutregisteraccelerator-callback)
method, i.e. method, i.e.
```js ```javascript
const { app, globalShortcut } = require('electron') const { app, globalShortcut } = require('electron')
app.whenReady().then(() => { app.whenReady().then(() => {

View File

@@ -377,6 +377,35 @@ page.
Emitted whenever there is a GPU info update. Emitted whenever there is a GPU info update.
### Event: 'gpu-process-crashed' _Deprecated_
Returns:
* `event` Event
* `killed` boolean
Emitted when the GPU process crashes or is killed.
**Deprecated:** This event is superceded by the `child-process-gone` event
which contains more information about why the child process disappeared. It
isn't always because it crashed. The `killed` boolean can be replaced by
checking `reason === 'killed'` when you switch to that event.
### Event: 'renderer-process-crashed' _Deprecated_
Returns:
* `event` Event
* `webContents` [WebContents](web-contents.md)
* `killed` boolean
Emitted when the renderer process of `webContents` 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. The `killed` boolean can be replaced by
checking `reason === 'killed'` when you switch to that event.
### Event: 'render-process-gone' ### Event: 'render-process-gone'
Returns: Returns:
@@ -1249,10 +1278,10 @@ Returns `boolean` - Whether the current desktop environment is Unity launcher.
### `app.getLoginItemSettings([options])` _macOS_ _Windows_ ### `app.getLoginItemSettings([options])` _macOS_ _Windows_
* `options` Object (optional) * `options` Object (optional)
* `type` string (optional) _macOS_ - Can be one of `mainAppService`, `agentService`, `daemonService`, or `loginItemService`. Defaults to `mainAppService`. Only available on macOS 13 and up. See [app.setLoginItemSettings](app.md#appsetloginitemsettingssettings-macos-windows) for more information about each type. * `path` string (optional) _Windows_ - The executable path to compare against.
* `serviceName` string (optional) _macOS_ - The name of the service. Required if `type` is non-default. Only available on macOS 13 and up. Defaults to `process.execPath`.
* `path` string (optional) _Windows_ - The executable path to compare against. Defaults to `process.execPath`. * `args` string[] (optional) _Windows_ - The command-line arguments to compare
* `args` string[] (optional) _Windows_ - The command-line arguments to compare against. Defaults to an empty array. against. Defaults to an empty array.
If you provided `path` and `args` options to `app.setLoginItemSettings`, then you If you provided `path` and `args` options to `app.setLoginItemSettings`, then you
need to pass the same arguments here for `openAtLogin` to be set correctly. need to pass the same arguments here for `openAtLogin` to be set correctly.
@@ -1260,11 +1289,17 @@ need to pass the same arguments here for `openAtLogin` to be set correctly.
Returns `Object`: Returns `Object`:
* `openAtLogin` boolean - `true` if the app is set to open at login. * `openAtLogin` boolean - `true` if the app is set to open at login.
* `openAsHidden` boolean _macOS_ _Deprecated_ - `true` if the app is set to open as hidden at login. This does not work on macOS 13 and up. * `openAsHidden` boolean _macOS_ - `true` if the app is set to open as hidden at login.
* `wasOpenedAtLogin` boolean _macOS_ _Deprecated_ - `true` if the app was opened at login automatically. This setting is not available on [MAS builds][mas-builds] or on macOS 13 and up. This setting is not available on [MAS builds][mas-builds].
* `wasOpenedAsHidden` boolean _macOS_ _Deprecated_ - `true` if the app was opened as a hidden login item. This indicates that the app should not open any windows at startup. This setting is not available on [MAS builds][mas-builds] or on macOS 13 and up. * `wasOpenedAtLogin` boolean _macOS_ - `true` if the app was opened at login
* `restoreState` boolean _macOS_ _Deprecated_ - `true` if the app was opened as a login item that should restore the state from the previous session. This indicates that the app should restore the windows that were open the last time the app was closed. This setting is not available on [MAS builds][mas-builds] or on macOS 13 and up. automatically. This setting is not available on [MAS builds][mas-builds].
* `status` string _macOS_ - can be one of `not-registered`, `enabled`, `requires-approval`, or `not-found`. * `wasOpenedAsHidden` boolean _macOS_ - `true` if the app was opened as a hidden login
item. This indicates that the app should not open any windows at startup.
This setting is not available on [MAS builds][mas-builds].
* `restoreState` boolean _macOS_ - `true` if the app was opened as a login item that
should restore the state from the previous session. This indicates that the
app should restore the windows that were open the last time the app was
closed. This setting is not available on [MAS builds][mas-builds].
* `executableWillLaunchAtLogin` boolean _Windows_ - `true` if app is set to open at login and its run key is not deactivated. This differs from `openAtLogin` as it ignores the `args` option, this property will be true if the given executable would be launched at login with **any** arguments. * `executableWillLaunchAtLogin` boolean _Windows_ - `true` if app is set to open at login and its run key is not deactivated. This differs from `openAtLogin` as it ignores the `args` option, this property will be true if the given executable would be launched at login with **any** arguments.
* `launchItems` Object[] _Windows_ * `launchItems` Object[] _Windows_
* `name` string _Windows_ - name value of a registry entry. * `name` string _Windows_ - name value of a registry entry.
@@ -1278,14 +1313,10 @@ Returns `Object`:
* `settings` Object * `settings` Object
* `openAtLogin` boolean (optional) - `true` to open the app at login, `false` to remove * `openAtLogin` boolean (optional) - `true` to open the app at login, `false` to remove
the app as a login item. Defaults to `false`. the app as a login item. Defaults to `false`.
* `openAsHidden` boolean (optional) _macOS_ _Deprecated_ - `true` to open the app as hidden. Defaults to `false`. The user can edit this setting from the System Preferences so `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is opened to know the current value. This setting is not available on [MAS build * `openAsHidden` boolean (optional) _macOS_ - `true` to open the app as hidden. Defaults to
s][mas-builds] or on macOS 13 and up. `false`. The user can edit this setting from the System Preferences so
* `type` string (optional) _macOS_ - The type of service to add as a login item. Defaults to `mainAppService`. Only available on macOS 13 and up. `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app
* `mainAppService` - The primary application. is opened to know the current value. This setting is not available on [MAS builds][mas-builds].
* `agentService` - The property list name for a launch agent. The property list name must correspond to a property list in the apps `Contents/Library/LaunchAgents` directory.
* `daemonService` string (optional) _macOS_ - The property list name for a launch agent. The property list name must correspond to a property list in the apps `Contents/Library/LaunchDaemons` directory.
* `loginItemService` string (optional) _macOS_ - The property list name for a login item service. The property list name must correspond to a property list in the apps `Contents/Library/LoginItems` directory.
* `serviceName` string (optional) _macOS_ - The name of the service. Required if `type` is non-default. Only available on macOS 13 and up.
* `path` string (optional) _Windows_ - The executable to launch at login. * `path` string (optional) _Windows_ - The executable to launch at login.
Defaults to `process.execPath`. Defaults to `process.execPath`.
* `args` string[] (optional) _Windows_ - The command-line arguments to pass to * `args` string[] (optional) _Windows_ - The command-line arguments to pass to
@@ -1294,7 +1325,6 @@ s][mas-builds] or on macOS 13 and up.
* `enabled` boolean (optional) _Windows_ - `true` will change the startup approved registry key and `enable / disable` the App in Task Manager and Windows Settings. * `enabled` boolean (optional) _Windows_ - `true` will change the startup approved registry key and `enable / disable` the App in Task Manager and Windows Settings.
Defaults to `true`. Defaults to `true`.
* `name` string (optional) _Windows_ - value name to write into registry. Defaults to the app's AppUserModelId(). * `name` string (optional) _Windows_ - value name to write into registry. Defaults to the app's AppUserModelId().
Set the app's login item settings. Set the app's login item settings.
To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows], To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows],
@@ -1319,8 +1349,6 @@ app.setLoginItemSettings({
}) })
``` ```
For more information about setting different services as login items on macOS 13 and up, see [`SMAppService`](https://developer.apple.com/documentation/servicemanagement/smappservice?language=objc).
### `app.isAccessibilitySupportEnabled()` _macOS_ _Windows_ ### `app.isAccessibilitySupportEnabled()` _macOS_ _Windows_
Returns `boolean` - `true` if Chrome's accessibility support is enabled, Returns `boolean` - `true` if Chrome's accessibility support is enabled,
@@ -1468,24 +1496,6 @@ details.
**Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed. **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
### `app.setProxy(config)`
* `config` [ProxyConfig](structures/proxy-config.md)
Returns `Promise<void>` - Resolves when the proxy setting process is complete.
Sets the proxy settings for networks requests made without an associated [Session](session.md).
Currently this will affect requests made with [Net](net.md) in the [utility process](../glossary.md#utility-process)
and internal requests made by the runtime (ex: geolocation queries).
This method can only be called after app is ready.
#### `app.resolveProxy(url)`
* `url` URL
Returns `Promise<string>` - Resolves with the proxy information for `url` that will be used when attempting to make requests using [Net](net.md) in the [utility process](../glossary.md#utility-process).
## Properties ## Properties
### `app.accessibilitySupportEnabled` _macOS_ _Windows_ ### `app.accessibilitySupportEnabled` _macOS_ _Windows_
@@ -1532,7 +1542,7 @@ A `boolean` property that returns `true` if the app is packaged, `false` otherw
[tasks]:https://learn.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks [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 [app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
[electron-forge]: https://www.electronforge.io/ [electron-forge]: https://www.electronforge.io/
[electron-packager]: https://github.com/electron/packager [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 [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/documentation/coreservices/1441725-lscopydefaulthandlerforurlscheme?language=objc [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 [handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html
@@ -1561,6 +1571,19 @@ This is the user agent that will be used when no user agent is set at the
app has the same user agent. Set to a custom value as early as possible app has the same user agent. Set to a custom value as early as possible
in your app's initialization to ensure that your overridden value is used. in your app's initialization to ensure that your overridden value is used.
### `app.runningUnderRosettaTranslation` _macOS_ _Readonly_ _Deprecated_
A `boolean` which when `true` indicates that the app is currently running
under the [Rosetta Translator Environment](https://en.wikipedia.org/wiki/Rosetta_(software)).
You can use this property to prompt users to download the arm64 version of
your application when they are running the x64 version under Rosetta
incorrectly.
**Deprecated:** This property is superceded by the `runningUnderARM64Translation`
property which detects when the app is being translated to ARM64 in both macOS
and Windows.
### `app.runningUnderARM64Translation` _Readonly_ _macOS_ _Windows_ ### `app.runningUnderARM64Translation` _Readonly_ _macOS_ _Windows_
A `boolean` which when `true` indicates that the app is currently running under A `boolean` which when `true` indicates that the app is currently running under

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,5 @@
# BrowserView # BrowserView
> **Note**
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
A `BrowserView` can be used to embed additional web content into a A `BrowserView` can be used to embed additional web content into a
[`BrowserWindow`](browser-window.md). It is like a child window, except that it is positioned [`BrowserWindow`](browser-window.md). It is like a child window, except that it is positioned
relative to its owning window. It is meant to be an alternative to the relative to its owning window. It is meant to be an alternative to the
@@ -13,10 +9,6 @@ relative to its owning window. It is meant to be an alternative to the
> Create and control views. > Create and control views.
> **Note**
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
Process: [Main](../glossary.md#main-process) Process: [Main](../glossary.md#main-process)
This module cannot be used until the `ready` event of the `app` This module cannot be used until the `ready` event of the `app`
@@ -24,7 +16,7 @@ module is emitted.
### Example ### Example
```js ```javascript
// In the main process. // In the main process.
const { app, BrowserView, BrowserWindow } = require('electron') const { app, BrowserView, BrowserWindow } = require('electron')
@@ -38,7 +30,7 @@ app.whenReady().then(() => {
}) })
``` ```
### `new BrowserView([options])` _Experimental_ _Deprecated_ ### `new BrowserView([options])` _Experimental_
* `options` Object (optional) * `options` Object (optional)
* `webPreferences` [WebPreferences](structures/web-preferences.md?inline) (optional) - Settings of web page's features. * `webPreferences` [WebPreferences](structures/web-preferences.md?inline) (optional) - Settings of web page's features.
@@ -47,7 +39,7 @@ app.whenReady().then(() => {
Objects created with `new BrowserView` have the following properties: Objects created with `new BrowserView` have the following properties:
#### `view.webContents` _Experimental_ _Deprecated_ #### `view.webContents` _Experimental_
A [`WebContents`](web-contents.md) object owned by this view. A [`WebContents`](web-contents.md) object owned by this view.
@@ -55,7 +47,7 @@ A [`WebContents`](web-contents.md) object owned by this view.
Objects created with `new BrowserView` have the following instance methods: Objects created with `new BrowserView` have the following instance methods:
#### `view.setAutoResize(options)` _Experimental_ _Deprecated_ #### `view.setAutoResize(options)` _Experimental_
* `options` Object * `options` Object
* `width` boolean (optional) - If `true`, the view's width will grow and shrink together * `width` boolean (optional) - If `true`, the view's width will grow and shrink together
@@ -67,19 +59,19 @@ Objects created with `new BrowserView` have the following instance methods:
* `vertical` boolean (optional) - If `true`, the view's y position and height will grow * `vertical` boolean (optional) - If `true`, the view's y position and height will grow
and shrink proportionally with the window. `false` by default. and shrink proportionally with the window. `false` by default.
#### `view.setBounds(bounds)` _Experimental_ _Deprecated_ #### `view.setBounds(bounds)` _Experimental_
* `bounds` [Rectangle](structures/rectangle.md) * `bounds` [Rectangle](structures/rectangle.md)
Resizes and moves the view to the supplied bounds relative to the window. Resizes and moves the view to the supplied bounds relative to the window.
#### `view.getBounds()` _Experimental_ _Deprecated_ #### `view.getBounds()` _Experimental_
Returns [`Rectangle`](structures/rectangle.md) Returns [`Rectangle`](structures/rectangle.md)
The `bounds` of this BrowserView instance as `Object`. The `bounds` of this BrowserView instance as `Object`.
#### `view.setBackgroundColor(color)` _Experimental_ _Deprecated_ #### `view.setBackgroundColor(color)` _Experimental_
* `color` string - Color in Hex, RGB, ARGB, HSL, HSLA or named CSS color format. The alpha channel is * `color` string - Color in Hex, RGB, ARGB, HSL, HSLA or named CSS color format. The alpha channel is
optional for the hex type. optional for the hex type.
@@ -87,25 +79,25 @@ The `bounds` of this BrowserView instance as `Object`.
Examples of valid `color` values: Examples of valid `color` values:
* Hex * Hex
* `#fff` (RGB) * #fff (RGB)
* `#ffff` (ARGB) * #ffff (ARGB)
* `#ffffff` (RRGGBB) * #ffffff (RRGGBB)
* `#ffffffff` (AARRGGBB) * #ffffffff (AARRGGBB)
* RGB * RGB
* `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)` * rgb\((\[\d]+),\s*(\[\d]+),\s*(\[\d]+)\)
* e.g. `rgb(255, 255, 255)` * e.g. rgb(255, 255, 255)
* RGBA * RGBA
* `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)` * rgba\((\[\d]+),\s*(\[\d]+),\s*(\[\d]+),\s*(\[\d.]+)\)
* e.g. `rgba(255, 255, 255, 1.0)` * e.g. rgba(255, 255, 255, 1.0)
* HSL * HSL
* `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)` * hsl\((-?\[\d.]+),\s*(\[\d.]+)%,\s*(\[\d.]+)%\)
* e.g. `hsl(200, 20%, 50%)` * e.g. hsl(200, 20%, 50%)
* HSLA * HSLA
* `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)` * hsla\((-?\[\d.]+),\s*(\[\d.]+)%,\s*(\[\d.]+)%,\s*(\[\d.]+)\)
* e.g. `hsla(200, 20%, 50%, 0.5)` * e.g. hsla(200, 20%, 50%, 0.5)
* Color name * Color name
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148) * Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
* Similar to CSS Color Module Level 3 keywords, but case-sensitive. * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
* e.g. `blueviolet` or `red` * e.g. `blueviolet` or `red`
**Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`. **Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBA` or `RGA`.

View File

@@ -7,7 +7,7 @@ Process: [Main](../glossary.md#main-process)
This module cannot be used until the `ready` event of the `app` This module cannot be used until the `ready` event of the `app`
module is emitted. module is emitted.
```js ```javascript
// In the main process. // In the main process.
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
@@ -38,7 +38,7 @@ While loading the page, the `ready-to-show` event will be emitted when the rende
process has rendered the page for the first time if the window has not been shown yet. Showing process has rendered the page for the first time if the window has not been shown yet. Showing
the window after this event will have no visual flash: the window after this event will have no visual flash:
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow({ show: false }) const win = new BrowserWindow({ show: false })
win.once('ready-to-show', () => { win.once('ready-to-show', () => {
@@ -59,7 +59,7 @@ For a complex app, the `ready-to-show` event could be emitted too late, making
the app feel slow. In this case, it is recommended to show the window the app feel slow. In this case, it is recommended to show the window
immediately, and use a `backgroundColor` close to your app's background: immediately, and use a `backgroundColor` close to your app's background:
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow({ backgroundColor: '#2e2c29' }) const win = new BrowserWindow({ backgroundColor: '#2e2c29' })
@@ -85,7 +85,7 @@ For more information about these color types see valid options in [win.setBackgr
By using `parent` option, you can create child windows: By using `parent` option, you can create child windows:
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const top = new BrowserWindow() const top = new BrowserWindow()
@@ -98,10 +98,10 @@ The `child` window will always show on top of the `top` window.
## Modal windows ## Modal windows
A modal window is a child window that disables parent window. To create a modal A modal window is a child window that disables parent window, to create a modal
window, you have to set both the `parent` and `modal` options: window, you have to set both `parent` and `modal` options:
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const top = new BrowserWindow() const top = new BrowserWindow()
@@ -140,7 +140,7 @@ state is `hidden` in order to minimize power consumption.
* On Linux the type of modal windows will be changed to `dialog`. * On Linux the type of modal windows will be changed to `dialog`.
* On Linux many desktop environments do not support hiding a modal window. * On Linux many desktop environments do not support hiding a modal window.
## Class: BrowserWindow extends `BaseWindow` ## Class: BrowserWindow
> Create and control browser windows. > Create and control browser windows.
@@ -188,7 +188,7 @@ window should be closed, which will also be called when the window is
reloaded. In Electron, returning any value other than `undefined` would cancel the reloaded. In Electron, returning any value other than `undefined` would cancel the
close. For example: close. For example:
```js ```javascript
window.onbeforeunload = (e) => { window.onbeforeunload = (e) => {
console.log('I do not want to be closed') console.log('I do not want to be closed')
@@ -351,7 +351,7 @@ Commands are lowercased, underscores are replaced with hyphens, and the
`APPCOMMAND_` prefix is stripped off. `APPCOMMAND_` prefix is stripped off.
e.g. `APPCOMMAND_BROWSER_BACKWARD` is emitted as `browser-backward`. e.g. `APPCOMMAND_BROWSER_BACKWARD` is emitted as `browser-backward`.
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow() const win = new BrowserWindow()
win.on('app-command', (e, cmd) => { win.on('app-command', (e, cmd) => {
@@ -367,6 +367,36 @@ The following app commands are explicitly supported on Linux:
* `browser-backward` * `browser-backward`
* `browser-forward` * `browser-forward`
#### Event: 'scroll-touch-begin' _macOS_ _Deprecated_
Emitted when scroll wheel event phase has begun.
> **Note**
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
> Changes](../breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
> for details of how to migrate to using the [WebContents
> `input-event`](./web-contents.md#event-input-event) event.
#### Event: 'scroll-touch-end' _macOS_ _Deprecated_
Emitted when scroll wheel event phase has ended.
> **Note**
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
> Changes](../breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
> for details of how to migrate to using the [WebContents
> `input-event`](./web-contents.md#event-input-event) event.
#### Event: 'scroll-touch-edge' _macOS_ _Deprecated_
Emitted when scroll wheel event phase filed upon reaching the edge of element.
> **Note**
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
> Changes](../breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
> for details of how to migrate to using the [WebContents
> `input-event`](./web-contents.md#event-input-event) event.
#### Event: 'swipe' _macOS_ #### Event: 'swipe' _macOS_
Returns: Returns:
@@ -440,14 +470,10 @@ Returns `BrowserWindow | null` - The window that is focused in this application,
Returns `BrowserWindow | null` - The window that owns the given `webContents` Returns `BrowserWindow | null` - The window that owns the given `webContents`
or `null` if the contents are not owned by a window. or `null` if the contents are not owned by a window.
#### `BrowserWindow.fromBrowserView(browserView)` _Deprecated_ #### `BrowserWindow.fromBrowserView(browserView)`
* `browserView` [BrowserView](browser-view.md) * `browserView` [BrowserView](browser-view.md)
> **Note**
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
Returns `BrowserWindow | null` - The window that owns the given `browserView`. If the given view is not attached to any window, returns `null`. Returns `BrowserWindow | null` - The window that owns the given `browserView`. If the given view is not attached to any window, returns `null`.
#### `BrowserWindow.fromId(id)` #### `BrowserWindow.fromId(id)`
@@ -460,7 +486,7 @@ Returns `BrowserWindow | null` - The window with the given `id`.
Objects created with `new BrowserWindow` have the following properties: Objects created with `new BrowserWindow` have the following properties:
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
// In this example `win` is our instance // In this example `win` is our instance
const win = new BrowserWindow({ width: 800, height: 600 }) const win = new BrowserWindow({ width: 800, height: 600 })
@@ -744,16 +770,16 @@ Examples of valid `backgroundColor` values:
* #ffffff (RGB) * #ffffff (RGB)
* #ffffffff (ARGB) * #ffffffff (ARGB)
* RGB * RGB
* `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)` * rgb\((\[\d]+),\s*(\[\d]+),\s*(\[\d]+)\)
* e.g. rgb(255, 255, 255) * e.g. rgb(255, 255, 255)
* RGBA * RGBA
* `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)` * rgba\((\[\d]+),\s*(\[\d]+),\s*(\[\d]+),\s*(\[\d.]+)\)
* e.g. rgba(255, 255, 255, 1.0) * e.g. rgba(255, 255, 255, 1.0)
* HSL * HSL
* `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)` * hsl\((-?\[\d.]+),\s*(\[\d.]+)%,\s*(\[\d.]+)%\)
* e.g. hsl(200, 20%, 50%) * e.g. hsl(200, 20%, 50%)
* HSLA * HSLA
* `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)` * hsla\((-?\[\d.]+),\s*(\[\d.]+)%,\s*(\[\d.]+)%,\s*(\[\d.]+)\)
* e.g. hsla(200, 20%, 50%, 0.5) * e.g. hsla(200, 20%, 50%, 0.5)
* Color name * Color name
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148) * Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
@@ -784,7 +810,7 @@ Closes the currently open [Quick Look][quick-look] panel.
Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values. Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values.
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow() const win = new BrowserWindow()
@@ -1039,7 +1065,7 @@ Changes the attachment point for sheets on macOS. By default, sheets are
attached just below the window frame, but you may want to display them beneath attached just below the window frame, but you may want to display them beneath
a HTML-rendered toolbar. For example: a HTML-rendered toolbar. For example:
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow() const win = new BrowserWindow()
@@ -1182,7 +1208,7 @@ To ensure that file URLs are properly formatted, it is recommended to use
Node's [`url.format`](https://nodejs.org/api/url.html#url_url_format_urlobject) Node's [`url.format`](https://nodejs.org/api/url.html#url_url_format_urlobject)
method: method:
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow() const win = new BrowserWindow()
@@ -1198,7 +1224,7 @@ win.loadURL(url)
You can load a URL using a `POST` request with URL-encoded data by doing You can load a URL using a `POST` request with URL-encoded data by doing
the following: the following:
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow() const win = new BrowserWindow()
@@ -1573,6 +1599,25 @@ Passing `null` will reset the position to default.
Returns `Point | null` - The custom position for the traffic light buttons in Returns `Point | null` - The custom position for the traffic light buttons in
frameless window, `null` will be returned when there is no custom position. frameless window, `null` will be returned when there is no custom position.
#### `win.setTrafficLightPosition(position)` _macOS_ _Deprecated_
* `position` [Point](structures/point.md)
Set a custom position for the traffic light buttons in frameless window.
Passing `{ x: 0, y: 0 }` will reset the position to default.
> **Note**
> This function is deprecated. Use [setWindowButtonPosition](#winsetwindowbuttonpositionposition-macos) instead.
#### `win.getTrafficLightPosition()` _macOS_ _Deprecated_
Returns `Point` - The custom position for the traffic light buttons in
frameless window, `{ x: 0, y: 0 }` will be returned when there is no custom
position.
> **Note**
> This function is deprecated. Use [getWindowButtonPosition](#wingetwindowbuttonposition-macos) instead.
#### `win.setTouchBar(touchBar)` _macOS_ #### `win.setTouchBar(touchBar)` _macOS_
* `touchBar` TouchBar | null * `touchBar` TouchBar | null
@@ -1584,69 +1629,48 @@ machine has a touch bar.
**Note:** The TouchBar API is currently experimental and may change or be **Note:** The TouchBar API is currently experimental and may change or be
removed in future Electron releases. removed in future Electron releases.
#### `win.setBrowserView(browserView)` _Experimental_ _Deprecated_ #### `win.setBrowserView(browserView)` _Experimental_
* `browserView` [BrowserView](browser-view.md) | null - Attach `browserView` to `win`. * `browserView` [BrowserView](browser-view.md) | null - Attach `browserView` to `win`.
If there are other `BrowserView`s attached, they will be removed from If there are other `BrowserView`s attached, they will be removed from
this window. this window.
> **Note** #### `win.getBrowserView()` _Experimental_
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
#### `win.getBrowserView()` _Experimental_ _Deprecated_
Returns `BrowserView | null` - The `BrowserView` attached to `win`. Returns `null` Returns `BrowserView | null` - The `BrowserView` attached to `win`. Returns `null`
if one is not attached. Throws an error if multiple `BrowserView`s are attached. if one is not attached. Throws an error if multiple `BrowserView`s are attached.
> **Note** #### `win.addBrowserView(browserView)` _Experimental_
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
#### `win.addBrowserView(browserView)` _Experimental_ _Deprecated_
* `browserView` [BrowserView](browser-view.md) * `browserView` [BrowserView](browser-view.md)
Replacement API for setBrowserView supporting work with multi browser views. Replacement API for setBrowserView supporting work with multi browser views.
> **Note** #### `win.removeBrowserView(browserView)` _Experimental_
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
#### `win.removeBrowserView(browserView)` _Experimental_ _Deprecated_
* `browserView` [BrowserView](browser-view.md) * `browserView` [BrowserView](browser-view.md)
> **Note** #### `win.setTopBrowserView(browserView)` _Experimental_
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
#### `win.setTopBrowserView(browserView)` _Experimental_ _Deprecated_
* `browserView` [BrowserView](browser-view.md) * `browserView` [BrowserView](browser-view.md)
Raises `browserView` above other `BrowserView`s attached to `win`. Raises `browserView` above other `BrowserView`s attached to `win`.
Throws an error if `browserView` is not attached to `win`. Throws an error if `browserView` is not attached to `win`.
> **Note** #### `win.getBrowserViews()` _Experimental_
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
#### `win.getBrowserViews()` _Experimental_ _Deprecated_
Returns `BrowserView[]` - a sorted by z-index array of all BrowserViews that have been attached Returns `BrowserView[]` - a sorted by z-index array of all BrowserViews that have been attached
with `addBrowserView` or `setBrowserView`. The top-most BrowserView is the last element of the array. with `addBrowserView` or `setBrowserView`. The top-most BrowserView is the last element of the array.
> **Note** **Note:** The BrowserView API is currently experimental and may change or be
> The `BrowserView` class is deprecated, and replaced by the new removed in future Electron releases.
> [`WebContentsView`](web-contents-view.md) class.
#### `win.setTitleBarOverlay(options)` _Windows_ #### `win.setTitleBarOverlay(options)` _Windows_
* `options` Object * `options` Object
* `color` String (optional) _Windows_ - The CSS color of the Window Controls Overlay when enabled. * `color` String (optional) _Windows_ - The CSS color of the Window Controls Overlay when enabled.
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. * `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled.
* `height` Integer (optional) _macOS_ _Windows_ - The height of the title bar and Window Controls Overlay in pixels. * `height` Integer (optional) _Windows_ - The height of the title bar and Window Controls Overlay in pixels.
On a Window with Window Controls Overlay already enabled, this method updates On a Window with Window Controls Overlay already enabled, this method updates
the style of the title bar overlay. the style of the title bar overlay.

View File

@@ -2,7 +2,7 @@
> Make HTTP/HTTPS requests. > Make HTTP/HTTPS requests.
Process: [Main](../glossary.md#main-process), [Utility](../glossary.md#utility-process)<br /> Process: [Main](../glossary.md#main-process)<br />
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._ _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
`ClientRequest` implements the [Writable Stream](https://nodejs.org/api/stream.html#stream_writable_streams) `ClientRequest` implements the [Writable Stream](https://nodejs.org/api/stream.html#stream_writable_streams)
@@ -65,7 +65,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: For instance, we could have created the same request to 'github.com' as follows:
```js ```javascript
const request = net.request({ const request = net.request({
method: 'GET', method: 'GET',
protocol: 'https:', protocol: 'https:',
@@ -104,7 +104,7 @@ The `callback` function is expected to be called back with user credentials:
* `username` string * `username` string
* `password` string * `password` string
```js @ts-type={request:Electron.ClientRequest} ```javascript @ts-type={request:Electron.ClientRequest}
request.on('login', (authInfo, callback) => { request.on('login', (authInfo, callback) => {
callback('username', 'password') callback('username', 'password')
}) })
@@ -113,7 +113,7 @@ request.on('login', (authInfo, callback) => {
Providing empty credentials will cancel the request and report an authentication Providing empty credentials will cancel the request and report an authentication
error on the response object: error on the response object:
```js @ts-type={request:Electron.ClientRequest} ```javascript @ts-type={request:Electron.ClientRequest}
request.on('response', (response) => { request.on('response', (response) => {
console.log(`STATUS: ${response.statusCode}`) console.log(`STATUS: ${response.statusCode}`)
response.on('error', (error) => { response.on('error', (error) => {

View File

@@ -7,7 +7,7 @@ Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer
On Linux, there is also a `selection` clipboard. To manipulate it On Linux, there is also a `selection` clipboard. To manipulate it
you need to pass `selection` to each method: you need to pass `selection` to each method:
```js ```javascript
const { clipboard } = require('electron') const { clipboard } = require('electron')
clipboard.writeText('Example string', 'selection') clipboard.writeText('Example string', 'selection')

View File

@@ -6,7 +6,7 @@ You can use [app.commandLine.appendSwitch][append-switch] to append them in
your app's main script before the [ready][ready] event of the [app][app] module your app's main script before the [ready][ready] event of the [app][app] module
is emitted: is emitted:
```js ```javascript
const { app } = require('electron') const { app } = require('electron')
app.commandLine.appendSwitch('remote-debugging-port', '8315') app.commandLine.appendSwitch('remote-debugging-port', '8315')
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1') app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1')
@@ -185,7 +185,7 @@ list of hosts. This flag has an effect only if used in tandem with
For example: For example:
```js ```javascript
const { app } = require('electron') const { app } = require('electron')
app.commandLine.appendSwitch('proxy-bypass-list', '<local>;*.google.com;*foo.com;1.2.3.4:5678') app.commandLine.appendSwitch('proxy-bypass-list', '<local>;*.google.com;*foo.com;1.2.3.4:5678')
``` ```

View File

@@ -7,7 +7,7 @@ _This class is not exported from the `'electron'` module. It is only available a
The following example shows how to check if the `--disable-gpu` flag is set. The following example shows how to check if the `--disable-gpu` flag is set.
```js ```javascript
const { app } = require('electron') const { app } = require('electron')
app.commandLine.hasSwitch('disable-gpu') app.commandLine.hasSwitch('disable-gpu')
``` ```

View File

@@ -10,7 +10,7 @@ This module does not include a web interface. To view recorded traces, use
**Note:** You should not use this module until the `ready` event of the app **Note:** You should not use this module until the `ready` event of the app
module is emitted. module is emitted.
```js ```javascript
const { app, contentTracing } = require('electron') const { app, contentTracing } = require('electron')
app.whenReady().then(() => { app.whenReady().then(() => {

View File

@@ -6,7 +6,7 @@ Process: [Renderer](../glossary.md#renderer-process)
An example of exposing an API to a renderer from an isolated preload script is given below: An example of exposing an API to a renderer from an isolated preload script is given below:
```js ```javascript
// Preload (Isolated World) // Preload (Isolated World)
const { contextBridge, ipcRenderer } = require('electron') const { contextBridge, ipcRenderer } = require('electron')
@@ -18,7 +18,7 @@ contextBridge.exposeInMainWorld(
) )
``` ```
```js @ts-nocheck ```javascript @ts-nocheck
// Renderer (Main World) // Renderer (Main World)
window.electron.doThing() window.electron.doThing()
@@ -64,7 +64,7 @@ the API become immutable and updates on either side of the bridge do not result
An example of a complex API is shown below: An example of a complex API is shown below:
```js ```javascript
const { contextBridge, ipcRenderer } = require('electron') const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld( contextBridge.exposeInMainWorld(
@@ -92,7 +92,7 @@ contextBridge.exposeInMainWorld(
An example of `exposeInIsolatedWorld` is shown below: An example of `exposeInIsolatedWorld` is shown below:
```js ```javascript
const { contextBridge, ipcRenderer } = require('electron') const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInIsolatedWorld( contextBridge.exposeInIsolatedWorld(
@@ -104,7 +104,7 @@ contextBridge.exposeInIsolatedWorld(
) )
``` ```
```js @ts-nocheck ```javascript @ts-nocheck
// Renderer (In isolated world id1004) // Renderer (In isolated world id1004)
window.electron.doThing() window.electron.doThing()
@@ -145,7 +145,7 @@ The table of supported types described above also applies to Node APIs that you
Please note that many Node APIs grant access to local system resources. Please note that many Node APIs grant access to local system resources.
Be very cautious about which globals and APIs you expose to untrusted remote content. Be very cautious about which globals and APIs you expose to untrusted remote content.
```js ```javascript
const { contextBridge } = require('electron') const { contextBridge } = require('electron')
const crypto = require('node:crypto') const crypto = require('node:crypto')
contextBridge.exposeInMainWorld('nodeCrypto', { contextBridge.exposeInMainWorld('nodeCrypto', {

View File

@@ -10,7 +10,7 @@ a `Session`.
For example: For example:
```js ```javascript
const { session } = require('electron') const { session } = require('electron')
// Query all cookies. // Query all cookies.

View File

@@ -7,7 +7,7 @@ Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer
The following is an example of setting up Electron to automatically submit The following is an example of setting up Electron to automatically submit
crash reports to a remote server: crash reports to a remote server:
```js ```javascript
const { crashReporter } = require('electron') const { crashReporter } = require('electron')
crashReporter.start({ submitURL: 'https://your-domain.com/url-to-submit' }) crashReporter.start({ submitURL: 'https://your-domain.com/url-to-submit' })
@@ -100,7 +100,7 @@ longer than the maximum length will be truncated.
### `crashReporter.getLastCrashReport()` ### `crashReporter.getLastCrashReport()`
Returns [`CrashReport | null`](structures/crash-report.md) - The date and ID of the Returns [`CrashReport`](structures/crash-report.md) - The date and ID of the
last crash report. Only crash reports that have been uploaded will be returned; last crash report. Only crash reports that have been uploaded will be returned;
even if a crash report is present on disk it will not be returned until it is even if a crash report is present on disk it will not be returned until it is
uploaded. In the case that there are no uploaded reports, `null` is returned. uploaded. In the case that there are no uploaded reports, `null` is returned.

View File

@@ -8,7 +8,7 @@ _This class is not exported from the `'electron'` module. It is only available a
Chrome Developer Tools has a [special binding][rdp] available at JavaScript Chrome Developer Tools has a [special binding][rdp] available at JavaScript
runtime that allows interacting with pages and instrumenting them. runtime that allows interacting with pages and instrumenting them.
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow() const win = new BrowserWindow()

View File

@@ -8,7 +8,7 @@ Process: [Main](../glossary.md#main-process)
The following example shows how to capture video from a desktop window whose The following example shows how to capture video from a desktop window whose
title is `Electron`: title is `Electron`:
```js ```javascript
// In the main process. // In the main process.
const { BrowserWindow, desktopCapturer } = require('electron') const { BrowserWindow, desktopCapturer } = require('electron')
@@ -24,7 +24,7 @@ desktopCapturer.getSources({ types: ['window', 'screen'] }).then(async sources =
}) })
``` ```
```js @ts-nocheck ```javascript @ts-nocheck
// In the preload script. // In the preload script.
const { ipcRenderer } = require('electron') const { ipcRenderer } = require('electron')
@@ -68,7 +68,7 @@ To capture both audio and video from the entire desktop the constraints passed
to [`navigator.mediaDevices.getUserMedia`][] must include `chromeMediaSource: 'desktop'`, to [`navigator.mediaDevices.getUserMedia`][] must include `chromeMediaSource: 'desktop'`,
for both `audio` and `video`, but should not include a `chromeMediaSourceId` constraint. for both `audio` and `video`, but should not include a `chromeMediaSourceId` constraint.
```js ```javascript
const constraints = { const constraints = {
audio: { audio: {
mandatory: { mandatory: {

View File

@@ -6,7 +6,7 @@ Process: [Main](../glossary.md#main-process)
An example of showing a dialog to select multiple files: An example of showing a dialog to select multiple files:
```js ```javascript
const { dialog } = require('electron') const { dialog } = require('electron')
console.log(dialog.showOpenDialog({ properties: ['openFile', 'multiSelections'] })) console.log(dialog.showOpenDialog({ properties: ['openFile', 'multiSelections'] }))
``` ```
@@ -52,7 +52,7 @@ The `browserWindow` argument allows the dialog to attach itself to a parent wind
The `filters` specifies an array of file types that can be displayed or The `filters` specifies an array of file types that can be displayed or
selected when you want to limit the user to a specific type. For example: selected when you want to limit the user to a specific type. For example:
```js ```javascript
{ {
filters: [ filters: [
{ name: 'Images', extensions: ['jpg', 'png', 'gif'] }, { name: 'Images', extensions: ['jpg', 'png', 'gif'] },
@@ -119,7 +119,7 @@ The `browserWindow` argument allows the dialog to attach itself to a parent wind
The `filters` specifies an array of file types that can be displayed or The `filters` specifies an array of file types that can be displayed or
selected when you want to limit the user to a specific type. For example: selected when you want to limit the user to a specific type. For example:
```js ```javascript
{ {
filters: [ filters: [
{ name: 'Images', extensions: ['jpg', 'png', 'gif'] }, { name: 'Images', extensions: ['jpg', 'png', 'gif'] },

View File

@@ -7,7 +7,7 @@ _This class is not exported from the `'electron'` module. It is only available a
The following example shows how to bounce your icon on the dock. The following example shows how to bounce your icon on the dock.
```js ```javascript
const { app } = require('electron') const { app } = require('electron')
app.dock.bounce() app.dock.bounce()
``` ```

View File

@@ -9,7 +9,7 @@ _This class is not exported from the `'electron'` module. It is only available a
It is used in `will-download` event of `Session` class, and allows users to It is used in `will-download` event of `Session` class, and allows users to
control the download item. control the download item.
```js ```javascript
// In the main process. // In the main process.
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow() const win = new BrowserWindow()

View File

@@ -59,7 +59,7 @@ geolocation webservice. To enable this feature, acquire a
and place the following code in your main process file, before opening any and place the following code in your main process file, before opening any
browser windows that will make geolocation requests: browser windows that will make geolocation requests:
```js ```javascript
process.env.GOOGLE_API_KEY = 'YOUR_KEY_HERE' process.env.GOOGLE_API_KEY = 'YOUR_KEY_HERE'
``` ```
@@ -111,16 +111,6 @@ Options:
* `kioclient5` * `kioclient5`
* `kioclient` * `kioclient`
### `ELECTRON_OZONE_PLATFORM_HINT` _Linux_
Selects the preferred platform backend used on Linux. The default one is `x11`. `auto` selects Wayland if possible, X11 otherwise.
Options:
* `auto`
* `wayland`
* `x11`
## Development Variables ## Development Variables
The following environment variables are intended primarily for development and The following environment variables are intended primarily for development and
@@ -142,6 +132,11 @@ Setting this variable is the same as passing `--log-file`
on the command line. For more info, see `--log-file` in [command-line on the command line. For more info, see `--log-file` in [command-line
switches](./command-line-switches.md#--log-filepath). switches](./command-line-switches.md#--log-filepath).
### `ELECTRON_DEBUG_DRAG_REGIONS`
Adds coloration to draggable regions on [`BrowserView`](./browser-view.md)s on macOS - draggable regions will be colored
green and non-draggable regions will be colored red to aid debugging.
### `ELECTRON_DEBUG_NOTIFICATIONS` ### `ELECTRON_DEBUG_NOTIFICATIONS`
Adds extra logs to [`Notification`](./notification.md) lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common actions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to. Adds extra logs to [`Notification`](./notification.md) lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common actions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.

View File

@@ -2,11 +2,6 @@
> Use the HTML5 `File` API to work natively with files on the filesystem. > Use the HTML5 `File` API to work natively with files on the filesystem.
> **Warning**
> The `path` property that Electron adds to the `File` interface is deprecated
> and **will** be removed in a future Electron release. We recommend you
> use `webUtils.getPathForFile` instead.
The DOM's File interface provides abstraction around native files in order to The DOM's File interface provides abstraction around native files in order to
let users work on native files directly with the HTML5 file API. Electron has let users work on native files directly with the HTML5 file API. Electron has
added a `path` attribute to the `File` interface which exposes the file's real added a `path` attribute to the `File` interface which exposes the file's real

View File

@@ -12,7 +12,7 @@ shortcuts.
not have the keyboard focus. This module cannot be used before the `ready` not have the keyboard focus. This module cannot be used before the `ready`
event of the app module is emitted. event of the app module is emitted.
```js ```javascript
const { app, globalShortcut } = require('electron') const { app, globalShortcut } = require('electron')
app.whenReady().then(() => { app.whenReady().then(() => {

View File

@@ -2,7 +2,7 @@
> Handle responses to HTTP/HTTPS requests. > Handle responses to HTTP/HTTPS requests.
Process: [Main](../glossary.md#main-process), [Utility](../glossary.md#utility-process)<br /> Process: [Main](../glossary.md#main-process)<br />
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._ _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
`IncomingMessage` implements the [Readable Stream](https://nodejs.org/api/stream.html#stream_readable_streams) `IncomingMessage` implements the [Readable Stream](https://nodejs.org/api/stream.html#stream_readable_streams)
@@ -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 offsets are the associated values. Header names are not lowercased, and
duplicates are not merged. duplicates are not merged.
```js @ts-type={response:Electron.IncomingMessage} ```javascript @ts-type={response:Electron.IncomingMessage}
// Prints something like: // Prints something like:
// //
// [ 'user-agent', // [ 'user-agent',

View File

@@ -32,15 +32,6 @@ The `ipcRenderer` module has the following method to listen for events and send
Listens to `channel`, when a new message arrives `listener` would be called with Listens to `channel`, when a new message arrives `listener` would be called with
`listener(event, args...)`. `listener(event, args...)`.
### `ipcRenderer.off(channel, listener)`
* `channel` string
* `listener` Function
* `event` [IpcRendererEvent][ipc-renderer-event]
* `...args` any[]
Alias for [`ipcRenderer.removeListener`](#ipcrendererremovelistenerchannel-listener).
### `ipcRenderer.once(channel, listener)` ### `ipcRenderer.once(channel, listener)`
* `channel` string * `channel` string
@@ -51,20 +42,10 @@ Alias for [`ipcRenderer.removeListener`](#ipcrendererremovelistenerchannel-liste
Adds a one time `listener` function for the event. This `listener` is invoked Adds a one time `listener` function for the event. This `listener` is invoked
only the next time a message is sent to `channel`, after which it is removed. only the next time a message is sent to `channel`, after which it is removed.
### `ipcRenderer.addListener(channel, listener)`
* `channel` string
* `listener` Function
* `event` [IpcRendererEvent][ipc-renderer-event]
* `...args` any[]
Alias for [`ipcRenderer.on`](#ipcrendereronchannel-listener).
### `ipcRenderer.removeListener(channel, listener)` ### `ipcRenderer.removeListener(channel, listener)`
* `channel` string * `channel` string
* `listener` Function * `listener` Function
* `event` [IpcRendererEvent][ipc-renderer-event]
* `...args` any[] * `...args` any[]
Removes the specified `listener` from the listener array for the specified Removes the specified `listener` from the listener array for the specified
@@ -120,7 +101,7 @@ The main process should listen for `channel` with
For example: For example:
```js @ts-type={someArgument:unknown} @ts-type={doSomeWork:(arg:unknown)=>Promise<unknown>} ```javascript @ts-type={someArgument:unknown} @ts-type={doSomeWork:(arg:unknown)=>Promise<unknown>}
// Renderer process // Renderer process
ipcRenderer.invoke('some-name', someArgument).then((result) => { ipcRenderer.invoke('some-name', someArgument).then((result) => {
// ... // ...
@@ -211,6 +192,14 @@ ipcMain.on('port', (e, msg) => {
For more information on using `MessagePort` and `MessageChannel`, see the [MDN For more information on using `MessagePort` and `MessageChannel`, see the [MDN
documentation](https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel). documentation](https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel).
### `ipcRenderer.sendTo(webContentsId, channel, ...args)` _Deprecated_
* `webContentsId` number
* `channel` string
* `...args` any[]
Sends a message to a window with `webContentsId` via `channel`.
### `ipcRenderer.sendToHost(channel, ...args)` ### `ipcRenderer.sendToHost(channel, ...args)`
* `channel` string * `channel` string

View File

@@ -151,7 +151,7 @@ can have a submenu.
An example of creating the application menu with the simple template API: An example of creating the application menu with the simple template API:
```js @ts-expect-error=[107] ```javascript @ts-expect-error=[107]
const { app, Menu } = require('electron') const { app, Menu } = require('electron')
const isMac = process.platform === 'darwin' const isMac = process.platform === 'darwin'
@@ -353,7 +353,7 @@ By default, items will be inserted in the order they exist in the template unles
Template: Template:
```js ```javascript
[ [
{ id: '1', label: 'one' }, { id: '1', label: 'one' },
{ id: '2', label: 'two' }, { id: '2', label: 'two' },
@@ -373,7 +373,7 @@ Menu:
Template: Template:
```js ```javascript
[ [
{ id: '1', label: 'one' }, { id: '1', label: 'one' },
{ type: 'separator' }, { type: 'separator' },
@@ -397,7 +397,7 @@ Menu:
Template: Template:
```js ```javascript
[ [
{ id: '1', label: 'one', after: ['3'] }, { id: '1', label: 'one', after: ['3'] },
{ id: '2', label: 'two', before: ['1'] }, { id: '2', label: 'two', before: ['1'] },

View File

@@ -4,41 +4,36 @@
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
The `nativeImage` module provides a unified interface for manipulating In Electron, for the APIs that take images, you can pass either file paths or
system images. These can be handy if you want to provide multiple scaled `NativeImage` instances. An empty image will be used when `null` is passed.
versions of the same icon or take advantage of macOS [template images][template-image].
Electron APIs that take image files accept either file paths or For example, when creating a tray or setting a window's icon, you can pass an
`NativeImage` instances. An empty and transparent image will be used when `null` is passed. image file path as a `string`:
For example, when creating a [Tray](../api/tray.md) or setting a [BrowserWindow](../api/browser-window.md)'s ```javascript
icon, you can either pass an image file path as a string:
```js title='Main Process'
const { BrowserWindow, Tray } = require('electron') const { BrowserWindow, Tray } = require('electron')
const tray = new Tray('/Users/somebody/images/icon.png') const appIcon = new Tray('/Users/somebody/images/icon.png')
const win = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }) const win = new BrowserWindow({ icon: '/Users/somebody/images/window.png' })
console.log(appIcon, win)
``` ```
or generate a `NativeImage` instance from the same file: Or read the image from the clipboard, which returns a `NativeImage`:
```js title='Main Process' ```javascript
const { BrowserWindow, nativeImage, Tray } = require('electron') const { clipboard, Tray } = require('electron')
const image = clipboard.readImage()
const trayIcon = nativeImage.createFromPath('/Users/somebody/images/icon.png') const appIcon = new Tray(image)
const appIcon = nativeImage.createFromPath('/Users/somebody/images/window.png') console.log(appIcon)
const tray = new Tray(trayIcon)
const win = new BrowserWindow({ icon: appIcon })
``` ```
## Supported Formats ## Supported Formats
Currently, `PNG` and `JPEG` image formats are supported across all platforms. Currently `PNG` and `JPEG` image formats are supported. `PNG` is recommended
`PNG` is recommended because of its support for transparency and lossless compression. because of its support for transparency and lossless compression.
On Windows, you can also load `ICO` icons from file paths. For best visual On Windows, you can also load `ICO` icons from file paths. For best visual
quality, we recommend including at least the following sizes: quality, it is recommended to include at least the following sizes in the:
* Small icon * Small icon
* 16x16 (100% DPI scale) * 16x16 (100% DPI scale)
@@ -52,30 +47,22 @@ quality, we recommend including at least the following sizes:
* 64x64 (200% DPI scale) * 64x64 (200% DPI scale)
* 256x256 * 256x256
Check the _Icon Scaling_ section in the Windows [App Icon Construction][icons] reference. Check the _Size requirements_ section in [this article][icons].
[icons]: https://learn.microsoft.com/en-us/windows/apps/design/style/iconography/app-icon-construction#icon-scaling [icons]: https://learn.microsoft.com/en-us/windows/win32/uxguide/vis-icons
:::note
EXIF metadata is currently not supported and will not be taken into account during
image encoding and decoding.
:::
## High Resolution Image ## High Resolution Image
On platforms that support high pixel density displays (such as Apple Retina), On platforms that have high-DPI support such as Apple Retina displays, you can
you can append `@2x` after image's base filename to mark it as a 2x scale append `@2x` after image's base filename to mark it as a high resolution image.
high resolution image.
For example, if `icon.png` is a normal image that has standard resolution, then For example, if `icon.png` is a normal image that has standard resolution, then
`icon@2x.png` will be treated as a high resolution image that has double `icon@2x.png` will be treated as a high resolution image that has double DPI
Dots per Inch (DPI) density. density.
If you want to support displays with different DPI densities at the same time, If you want to support displays with different DPI densities at the same time,
you can put images with different sizes in the same folder and use the filename you can put images with different sizes in the same folder and use the filename
without DPI suffixes within Electron. For example: without DPI suffixes. For example:
```plaintext ```plaintext
images/ images/
@@ -84,9 +71,10 @@ images/
└── icon@3x.png └── icon@3x.png
``` ```
```js title='Main Process' ```javascript
const { Tray } = require('electron') const { Tray } = require('electron')
const appTray = new Tray('/Users/somebody/images/icon.png') const appIcon = new Tray('/Users/somebody/images/icon.png')
console.log(appIcon)
``` ```
The following suffixes for DPI are also supported: The following suffixes for DPI are also supported:
@@ -103,23 +91,27 @@ The following suffixes for DPI are also supported:
* `@4x` * `@4x`
* `@5x` * `@5x`
## Template Image _macOS_ ## Template Image
On macOS, [template images][template-image] consist of black and an alpha channel. Template images consist of black and an alpha channel.
Template images are not intended to be used as standalone images and are usually Template images are not intended to be used as standalone images and are usually
mixed with other content to create the desired final appearance. mixed with other content to create the desired final appearance.
The most common case is to use template images for a menu bar (Tray) icon, so it can The most common case is to use template images for a menu bar icon, so it can
adapt to both light and dark menu bars. adapt to both light and dark menu bars.
To mark an image as a template image, its base filename should end with the word **Note:** Template image is only supported on macOS.
`Template` (e.g. `xxxTemplate.png`). You can also specify template images at
different DPI densities (e.g. `xxxTemplate@2x.png`). To mark an image as a template image, its filename should end with the word
`Template`. For example:
* `xxxTemplate.png`
* `xxxTemplate@2x.png`
## Methods ## Methods
The `nativeImage` module has the following methods, all of which return The `nativeImage` module has the following methods, all of which return
an instance of the [`NativeImage`](#class-nativeimage) class: an instance of the `NativeImage` class:
### `nativeImage.createEmpty()` ### `nativeImage.createEmpty()`
@@ -138,7 +130,7 @@ Note: The Windows implementation will ignore `size.height` and scale the height
### `nativeImage.createFromPath(path)` ### `nativeImage.createFromPath(path)`
* `path` string - path to a file that we intend to construct an image out of. * `path` string
Returns `NativeImage` Returns `NativeImage`
@@ -146,8 +138,8 @@ Creates a new `NativeImage` instance from a file located at `path`. This method
returns an empty image if the `path` does not exist, cannot be read, or is not returns an empty image if the `path` does not exist, cannot be read, or is not
a valid image. a valid image.
```js ```javascript
const { nativeImage } = require('electron') const nativeImage = require('electron').nativeImage
const image = nativeImage.createFromPath('/Users/somebody/images/icon.png') const image = nativeImage.createFromPath('/Users/somebody/images/icon.png')
console.log(image) console.log(image)
@@ -184,7 +176,7 @@ Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or JP
Returns `NativeImage` Returns `NativeImage`
Creates a new `NativeImage` instance from `dataUrl`, a base 64 encoded [Data URL][data-url] string. Creates a new `NativeImage` instance from `dataURL`.
### `nativeImage.createFromNamedImage(imageName[, hslShift])` _macOS_ ### `nativeImage.createFromNamedImage(imageName[, hslShift])` _macOS_
@@ -193,14 +185,14 @@ Creates a new `NativeImage` instance from `dataUrl`, a base 64 encoded [Data URL
Returns `NativeImage` Returns `NativeImage`
Creates a new `NativeImage` instance from the `NSImage` that maps to the Creates a new `NativeImage` instance from the NSImage that maps to the
given image name. See Apple's [`NSImageName`](https://developer.apple.com/documentation/appkit/nsimagename#2901388) given image name. See [`System Icons`](https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/)
documentation for a list of possible values. for a list of possible values.
The `hslShift` is applied to the image with the following rules: The `hslShift` is applied to the image with the following rules:
* `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map
to 0 and 360 on the hue color wheel (red). to 0 and 360 on the hue color wheel (red).
* `hsl_shift[1]` (saturation): A saturation shift for the image, with the * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
following key values: following key values:
0 = remove all color. 0 = remove all color.
@@ -217,9 +209,7 @@ This means that `[-1, 0, 1]` will make the image completely white and
In some cases, the `NSImageName` doesn't match its string representation; one example of this is `NSFolderImageName`, whose string representation would actually be `NSFolder`. Therefore, you'll need to determine the correct string representation for your image before passing it in. This can be done with the following: In some cases, the `NSImageName` doesn't match its string representation; one example of this is `NSFolderImageName`, whose string representation would actually be `NSFolder`. Therefore, you'll need to determine the correct string representation for your image before passing it in. This can be done with the following:
```sh `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - && ./test`
echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - && ./test
```
where `SYSTEM_IMAGE_NAME` should be replaced with any value from [this list](https://developer.apple.com/documentation/appkit/nsimagename?language=objc). where `SYSTEM_IMAGE_NAME` should be replaced with any value from [this list](https://developer.apple.com/documentation/appkit/nsimagename?language=objc).
@@ -260,7 +250,7 @@ data.
* `options` Object (optional) * `options` Object (optional)
* `scaleFactor` Number (optional) - Defaults to 1.0. * `scaleFactor` Number (optional) - Defaults to 1.0.
Returns `string` - The [Data URL][data-url] of the image. Returns `string` - The data URL of the image.
#### `image.getBitmap([options])` #### `image.getBitmap([options])`
@@ -276,7 +266,7 @@ current event loop tick; otherwise the data might be changed or destroyed.
#### `image.getNativeHandle()` _macOS_ #### `image.getNativeHandle()` _macOS_
Returns `Buffer` - A [Buffer][buffer] that stores C pointer to underlying native handle of Returns `Buffer` - A [Buffer][buffer] that stores C pointer to underlying native handle of
the image. On macOS, a pointer to `NSImage` instance is returned. the image. On macOS, a pointer to `NSImage` instance would be returned.
Notice that the returned pointer is a weak pointer to the underlying native Notice that the returned pointer is a weak pointer to the underlying native
image instead of a copy, so you _must_ ensure that the associated image instead of a copy, so you _must_ ensure that the associated
@@ -298,11 +288,11 @@ If `scaleFactor` is passed, this will return the size corresponding to the image
* `option` boolean * `option` boolean
Marks the image as a macOS [template image][template-image]. Marks the image as a template image.
#### `image.isTemplateImage()` #### `image.isTemplateImage()`
Returns `boolean` - Whether the image is a macOS [template image][template-image]. Returns `boolean` - Whether the image is a template image.
#### `image.crop(rect)` #### `image.crop(rect)`
@@ -331,13 +321,13 @@ will be preserved in the resized image.
* `scaleFactor` Number (optional) - Defaults to 1.0. * `scaleFactor` Number (optional) - Defaults to 1.0.
Returns `Number` - The image's aspect ratio (width divided by height). Returns `Number` - The image's aspect ratio.
If `scaleFactor` is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value. If `scaleFactor` is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.
#### `image.getScaleFactors()` #### `image.getScaleFactors()`
Returns `Number[]` - An array of all scale factors corresponding to representations for a given `NativeImage`. Returns `Number[]` - An array of all scale factors corresponding to representations for a given nativeImage.
#### `image.addRepresentation(options)` #### `image.addRepresentation(options)`
@@ -352,17 +342,15 @@ Returns `Number[]` - An array of all scale factors corresponding to representati
encoded PNG or JPEG image. encoded PNG or JPEG image.
Add an image representation for a specific scale factor. This can be used Add an image representation for a specific scale factor. This can be used
to programmatically add different scale factor representations to an image. This to explicitly add different scale factor representations to an image. This
can be called on empty images. can be called on empty images.
[buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer
### Instance Properties ### Instance Properties
#### `nativeImage.isMacTemplateImage` _macOS_ #### `nativeImage.isMacTemplateImage` _macOS_
A `boolean` property that determines whether the image is considered a [template image][template-image]. A `boolean` property that determines whether the image is considered a [template image](https://developer.apple.com/documentation/appkit/nsimage/1520017-template).
Please note that this property only has an effect on macOS. Please note that this property only has an effect on macOS.
[buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer
[data-url]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs
[template-image]: https://developer.apple.com/documentation/appkit/nsimage/1520017-template

View File

@@ -4,7 +4,7 @@
Process: [Main](../glossary.md#main-process) Process: [Main](../glossary.md#main-process)
```js ```javascript
const { app, netLog } = require('electron') const { app, netLog } = require('electron')
app.whenReady().then(async () => { app.whenReady().then(async () => {

View File

@@ -2,7 +2,7 @@
> Issue HTTP/HTTPS requests using Chromium's native networking library > Issue HTTP/HTTPS requests using Chromium's native networking library
Process: [Main](../glossary.md#main-process), [Utility](../glossary.md#utility-process) Process: [Main](../glossary.md#main-process)
The `net` module is a client-side API for issuing HTTP(S) requests. It is The `net` module is a client-side API for issuing HTTP(S) requests. It is
similar to the [HTTP](https://nodejs.org/api/http.html) and similar to the [HTTP](https://nodejs.org/api/http.html) and
@@ -26,7 +26,7 @@ Node.js.
Example usage: Example usage:
```js ```javascript
const { app } = require('electron') const { app } = require('electron')
app.whenReady().then(() => { app.whenReady().then(() => {
const { net } = require('electron') const { net } = require('electron')
@@ -119,9 +119,6 @@ protocol.handle('https', (req) => {
}) })
``` ```
Note: in the [utility process](../glossary.md#utility-process) custom protocols
are not supported.
### `net.isOnline()` ### `net.isOnline()`
Returns `boolean` - Whether there is currently internet connection. Returns `boolean` - Whether there is currently internet connection.

View File

@@ -6,7 +6,7 @@ Process: [Main](../glossary.md#main-process)
For example: For example:
```js ```javascript
const { powerSaveBlocker } = require('electron') const { powerSaveBlocker } = require('electron')
const id = powerSaveBlocker.start('prevent-display-sleep') const id = powerSaveBlocker.start('prevent-display-sleep')

View File

@@ -21,6 +21,7 @@ In sandboxed renderers the `process` object contains only a subset of the APIs:
* `getSystemMemoryInfo()` * `getSystemMemoryInfo()`
* `getSystemVersion()` * `getSystemVersion()`
* `getCPUUsage()` * `getCPUUsage()`
* `getIOCounters()`
* `uptime()` * `uptime()`
* `argv` * `argv`
* `execPath` * `execPath`
@@ -161,6 +162,10 @@ The time is represented as number of milliseconds since epoch. It returns null i
Returns [`CPUUsage`](structures/cpu-usage.md) Returns [`CPUUsage`](structures/cpu-usage.md)
### `process.getIOCounters()` _Windows_ _Linux_
Returns [`IOCounters`](structures/io-counters.md)
### `process.getHeapStatistics()` ### `process.getHeapStatistics()`
Returns `Object`: Returns `Object`:

View File

@@ -7,7 +7,7 @@ Process: [Main](../glossary.md#main-process)
An example of implementing a protocol that has the same effect as the An example of implementing a protocol that has the same effect as the
`file://` protocol: `file://` protocol:
```js ```javascript
const { app, protocol, net } = require('electron') const { app, protocol, net } = require('electron')
app.whenReady().then(() => { app.whenReady().then(() => {
@@ -31,7 +31,7 @@ a different session and your custom protocol will not work if you just use
To have your custom protocol work in combination with a custom session, you need To have your custom protocol work in combination with a custom session, you need
to register it to that session explicitly. to register it to that session explicitly.
```js ```javascript
const { app, BrowserWindow, net, protocol, session } = require('electron') const { app, BrowserWindow, net, protocol, session } = require('electron')
const path = require('node:path') const path = require('node:path')
const url = require('url') const url = require('url')
@@ -61,14 +61,13 @@ The `protocol` module has the following methods:
module gets emitted and can be called only once. module gets emitted and can be called only once.
Registers the `scheme` as standard, secure, bypasses content security policy for Registers the `scheme` as standard, secure, bypasses content security policy for
resources, allows registering ServiceWorker, supports fetch API, streaming resources, allows registering ServiceWorker, supports fetch API, and streaming
video/audio, and V8 code cache. Specify a privilege with the value of `true` to video/audio. Specify a privilege with the value of `true` to enable the capability.
enable the capability.
An example of registering a privileged scheme, that bypasses Content Security An example of registering a privileged scheme, that bypasses Content Security
Policy: Policy:
```js ```javascript
const { protocol } = require('electron') const { protocol } = require('electron')
protocol.registerSchemesAsPrivileged([ protocol.registerSchemesAsPrivileged([
{ scheme: 'foo', privileges: { bypassCSP: true } } { scheme: 'foo', privileges: { bypassCSP: true } }
@@ -123,7 +122,7 @@ Example:
```js ```js
const { app, net, protocol } = require('electron') const { app, net, protocol } = require('electron')
const path = require('node:path') const { join } = require('node:path')
const { pathToFileURL } = require('url') const { pathToFileURL } = require('url')
protocol.registerSchemesAsPrivileged([ protocol.registerSchemesAsPrivileged([
@@ -146,19 +145,9 @@ app.whenReady().then(() => {
headers: { 'content-type': 'text/html' } headers: { 'content-type': 'text/html' }
}) })
} }
// NB, this checks for paths that escape the bundle, e.g. // NB, this does not check for paths that escape the bundle, e.g.
// app://bundle/../../secret_file.txt // app://bundle/../../secret_file.txt
const pathToServe = path.resolve(__dirname, pathname) return net.fetch(pathToFileURL(join(__dirname, pathname)).toString())
const relativePath = path.relative(__dirname, pathToServe)
const isSafe = relativePath && !relativePath.startsWith('..') && !path.isAbsolute(relativePath)
if (!isSafe) {
return new Response('bad', {
status: 400,
headers: { 'content-type': 'text/html' }
})
}
return net.fetch(pathToFileURL(pathToServe).toString())
} else if (host === 'api') { } else if (host === 'api') {
return net.fetch('https://api.my-server.com/' + pathname, { return net.fetch('https://api.my-server.com/' + pathname, {
method: req.method, method: req.method,
@@ -223,7 +212,7 @@ property.
Example: Example:
```js ```javascript
protocol.registerBufferProtocol('atom', (request, callback) => { protocol.registerBufferProtocol('atom', (request, callback) => {
callback({ mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>') }) callback({ mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>') })
}) })
@@ -278,7 +267,7 @@ has the `data` property.
Example: Example:
```js ```javascript
const { protocol } = require('electron') const { protocol } = require('electron')
const { PassThrough } = require('stream') const { PassThrough } = require('stream')
@@ -303,7 +292,7 @@ protocol.registerStreamProtocol('atom', (request, callback) => {
It is possible to pass any object that implements the readable stream API (emits It is possible to pass any object that implements the readable stream API (emits
`data`/`end`/`error` events). For example, here's how a file could be returned: `data`/`end`/`error` events). For example, here's how a file could be returned:
```js ```javascript
protocol.registerStreamProtocol('atom', (request, callback) => { protocol.registerStreamProtocol('atom', (request, callback) => {
callback(fs.createReadStream('index.html')) callback(fs.createReadStream('index.html'))
}) })

View File

@@ -6,7 +6,7 @@ Process: [Main](../glossary.md#main-process)
For example, when registering for push notifications via Apple push notification services (APNS): For example, when registering for push notifications via Apple push notification services (APNS):
```js ```javascript
const { pushNotifications, Notification } = require('electron') const { pushNotifications, Notification } = require('electron')
pushNotifications.registerForAPNSNotifications().then((token) => { pushNotifications.registerForAPNSNotifications().then((token) => {

View File

@@ -14,29 +14,20 @@ property, so writing `let { screen } = require('electron')` will not work.
An example of creating a window that fills the whole screen: An example of creating a window that fills the whole screen:
```fiddle docs/fiddles/screen/fit-screen ```javascript fiddle='docs/fiddles/screen/fit-screen'
// Retrieve information about screen size, displays, cursor position, etc. const { app, BrowserWindow, screen } = require('electron')
//
// For more info, see:
// https://www.electronjs.org/docs/latest/api/screen
const { app, BrowserWindow, screen } = require('electron/main')
let mainWindow = null
let win
app.whenReady().then(() => { app.whenReady().then(() => {
// Create a window that fills the screen's available work area. const { width, height } = screen.getPrimaryDisplay().workAreaSize
const primaryDisplay = screen.getPrimaryDisplay() win = new BrowserWindow({ width, height })
const { width, height } = primaryDisplay.workAreaSize win.loadURL('https://github.com')
mainWindow = new BrowserWindow({ width, height })
mainWindow.loadURL('https://electronjs.org')
}) })
``` ```
Another example of creating a window in the external display: Another example of creating a window in the external display:
```js ```javascript
const { app, BrowserWindow, screen } = require('electron') const { app, BrowserWindow, screen } = require('electron')
let win let win

View File

@@ -10,7 +10,7 @@ a `Session`.
For example: For example:
```js ```javascript
const { session } = require('electron') const { session } = require('electron')
// Get all service workers. // Get all service workers.

View File

@@ -9,7 +9,7 @@ The `session` module can be used to create new `Session` objects.
You can also access the `session` of existing pages by using the `session` You can also access the `session` of existing pages by using the `session`
property of [`WebContents`](web-contents.md), or from the `session` module. property of [`WebContents`](web-contents.md), or from the `session` module.
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow({ width: 800, height: 600 }) const win = new BrowserWindow({ width: 800, height: 600 })
@@ -75,7 +75,7 @@ _This class is not exported from the `'electron'` module. It is only available a
You can create a `Session` object in the `session` module: You can create a `Session` object in the `session` module:
```js ```javascript
const { session } = require('electron') const { session } = require('electron')
const ses = session.fromPartition('persist:name') const ses = session.fromPartition('persist:name')
console.log(ses.getUserAgent()) console.log(ses.getUserAgent())
@@ -98,7 +98,7 @@ Emitted when Electron is about to download `item` in `webContents`.
Calling `event.preventDefault()` will cancel the download and `item` will not be Calling `event.preventDefault()` will cancel the download and `item` will not be
available from next tick of the process. available from next tick of the process.
```js @ts-expect-error=[4] ```javascript @ts-expect-error=[4]
const { session } = require('electron') const { session } = require('electron')
session.defaultSession.on('will-download', (event, item, webContents) => { session.defaultSession.on('will-download', (event, item, webContents) => {
event.preventDefault() event.preventDefault()
@@ -214,7 +214,7 @@ cancel the request. Additionally, permissioning on `navigator.hid` can
be further managed by using [`ses.setPermissionCheckHandler(handler)`](#sessetpermissioncheckhandlerhandler) be further managed by using [`ses.setPermissionCheckHandler(handler)`](#sessetpermissioncheckhandlerhandler)
and [`ses.setDevicePermissionHandler(handler)`](#sessetdevicepermissionhandlerhandler). and [`ses.setDevicePermissionHandler(handler)`](#sessetdevicepermissionhandlerhandler).
```js @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)} ```javascript @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)}
const { app, BrowserWindow } = require('electron') const { app, BrowserWindow } = require('electron')
let win = null let win = null
@@ -266,7 +266,7 @@ Returns:
* `event` Event * `event` Event
* `details` Object * `details` Object
* `device` [HIDDevice](structures/hid-device.md) * `device` [HIDDevice[]](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md) * `frame` [WebFrameMain](web-frame-main.md)
Emitted after `navigator.hid.requestDevice` has been called and Emitted after `navigator.hid.requestDevice` has been called and
@@ -281,7 +281,7 @@ Returns:
* `event` Event * `event` Event
* `details` Object * `details` Object
* `device` [HIDDevice](structures/hid-device.md) * `device` [HIDDevice[]](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md) * `frame` [WebFrameMain](web-frame-main.md)
Emitted after `navigator.hid.requestDevice` has been called and Emitted after `navigator.hid.requestDevice` has been called and
@@ -296,7 +296,7 @@ Returns:
* `event` Event * `event` Event
* `details` Object * `details` Object
* `device` [HIDDevice](structures/hid-device.md) * `device` [HIDDevice[]](structures/hid-device.md)
* `origin` string (optional) - The origin that the device has been revoked from. * `origin` string (optional) - The origin that the device has been revoked from.
Emitted after `HIDDevice.forget()` has been called. This event can be used Emitted after `HIDDevice.forget()` has been called. This event can be used
@@ -320,7 +320,7 @@ cancel the request. Additionally, permissioning on `navigator.serial` can
be managed by using [ses.setPermissionCheckHandler(handler)](#sessetpermissioncheckhandlerhandler) be managed by using [ses.setPermissionCheckHandler(handler)](#sessetpermissioncheckhandlerhandler)
with the `serial` permission. with the `serial` permission.
```js @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)} ```javascript @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)}
const { app, BrowserWindow } = require('electron') const { app, BrowserWindow } = require('electron')
let win = null let win = null
@@ -463,7 +463,7 @@ cancel the request. Additionally, permissioning on `navigator.usb` can
be further managed by using [`ses.setPermissionCheckHandler(handler)`](#sessetpermissioncheckhandlerhandler) be further managed by using [`ses.setPermissionCheckHandler(handler)`](#sessetpermissioncheckhandlerhandler)
and [`ses.setDevicePermissionHandler(handler)`](#sessetdevicepermissionhandlerhandler). and [`ses.setDevicePermissionHandler(handler)`](#sessetdevicepermissionhandlerhandler).
```js @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)} @ts-type={updateGrantedDevices:(devices:Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)=>void} ```javascript @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)} @ts-type={updateGrantedDevices:(devices:Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)=>void}
const { app, BrowserWindow } = require('electron') const { app, BrowserWindow } = require('electron')
let win = null let win = null
@@ -589,15 +589,105 @@ Writes any unwritten DOMStorage data to disk.
#### `ses.setProxy(config)` #### `ses.setProxy(config)`
* `config` [ProxyConfig](structures/proxy-config.md) * `config` Object
* `mode` string (optional) - The proxy mode. Should be one of `direct`,
`auto_detect`, `pac_script`, `fixed_servers` or `system`. If it's
unspecified, it will be automatically determined based on other specified
options.
* `direct`
In direct mode all connections are created directly, without any proxy involved.
* `auto_detect`
In auto_detect mode the proxy configuration is determined by a PAC script that can
be downloaded at http://wpad/wpad.dat.
* `pac_script`
In pac_script mode the proxy configuration is determined by a PAC script that is
retrieved from the URL specified in the `pacScript`. This is the default mode
if `pacScript` is specified.
* `fixed_servers`
In fixed_servers mode the proxy configuration is specified in `proxyRules`.
This is the default mode if `proxyRules` is specified.
* `system`
In system mode the proxy configuration is taken from the operating system.
Note that the system mode is different from setting no proxy configuration.
In the latter case, Electron falls back to the system settings
only if no command-line options influence the proxy configuration.
* `pacScript` string (optional) - The URL associated with the PAC file.
* `proxyRules` string (optional) - Rules indicating which proxies to use.
* `proxyBypassRules` string (optional) - Rules indicating which URLs should
bypass the proxy settings.
Returns `Promise<void>` - Resolves when the proxy setting process is complete. Returns `Promise<void>` - Resolves when the proxy setting process is complete.
Sets the proxy settings. Sets the proxy settings.
When `mode` is unspecified, `pacScript` and `proxyRules` are provided together, the `proxyRules`
option is ignored and `pacScript` configuration is applied.
You may need `ses.closeAllConnections` to close currently in flight connections to prevent You may need `ses.closeAllConnections` to close currently in flight connections to prevent
pooled sockets using previous proxy from being reused by future requests. pooled sockets using previous proxy from being reused by future requests.
The `proxyRules` has to follow the rules below:
```sh
proxyRules = schemeProxies[";"<schemeProxies>]
schemeProxies = [<urlScheme>"="]<proxyURIList>
urlScheme = "http" | "https" | "ftp" | "socks"
proxyURIList = <proxyURL>[","<proxyURIList>]
proxyURL = [<proxyScheme>"://"]<proxyHost>[":"<proxyPort>]
```
For example:
* `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
HTTP proxy `foopy2:80` for `ftp://` URLs.
* `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
* `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
* `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
* `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
* `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
proxy if `foopy` is unavailable.
* `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
`socks4://foopy2` for all other URLs.
The `proxyBypassRules` is a comma separated list of rules described below:
* `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
Match all hostnames that match the pattern HOSTNAME_PATTERN.
Examples:
"foobar.com", "\*foobar.com", "\*.foobar.com", "\*foobar.com:99",
"https://x.\*.y.com:99"
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
Match a particular domain suffix.
Examples:
".google.com", ".com", "http://.google.com"
* `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
Match URLs which are IP address literals.
Examples:
"127.0.1", "\[0:0::1]", "\[::1]", "http://\[::1]:99"
* `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
Match any URL that is to an IP literal that falls between the
given range. IP range is specified using CIDR notation.
Examples:
"192.168.1.1/16", "fefe:13::abc/33".
* `<local>`
Match local addresses. The meaning of `<local>` is whether the
host matches one of: "127.0.0.1", "::1", "localhost".
#### `ses.resolveHost(host, [options])` #### `ses.resolveHost(host, [options])`
* `host` string - Hostname to resolve. * `host` string - Hostname to resolve.
@@ -664,7 +754,7 @@ Sets download saving directory. By default, the download directory will be the
Emulates network with the given configuration for the `session`. Emulates network with the given configuration for the `session`.
```js ```javascript
const win = new BrowserWindow() const win = new BrowserWindow()
// To emulate a GPRS connection with 50kbps throughput and 500 ms latency. // To emulate a GPRS connection with 50kbps throughput and 500 ms latency.
@@ -695,7 +785,7 @@ Returns `Promise<void>` - Resolves when all connections are closed.
#### `ses.fetch(input[, init])` #### `ses.fetch(input[, init])`
* `input` string | [GlobalRequest](https://nodejs.org/api/globals.html#request) * `input` string | [GlobalRequest](https://nodejs.org/api/globals.html#request)
* `init` [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/fetch#options) & { bypassCustomProtocolHandlers?: boolean } (optional) * `init` [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/fetch#options) (optional)
Returns `Promise<GlobalResponse>` - see [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response). Returns `Promise<GlobalResponse>` - see [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response).
@@ -778,7 +868,7 @@ calling `callback(-2)` rejects it.
Calling `setCertificateVerifyProc(null)` will revert back to default certificate Calling `setCertificateVerifyProc(null)` will revert back to default certificate
verify proc. verify proc.
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow() const win = new BrowserWindow()
@@ -811,9 +901,7 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
* `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). * `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) * `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. * `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.
* `keyboardLock` - Request capture of keypresses for any or all of the keys on the physical keyboard via the [Keyboard Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/lock). These requests always appear to originate from the main frame.
* `openExternal` - Request to open links in external applications. * `openExternal` - Request to open links in external applications.
* `speaker-selection` - Request to enumerate and select audio output devices via the [speaker-selection permissions policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/speaker-selection).
* `window-management` - Request access to enumerate screens using the [`getScreenDetails`](https://developer.chrome.com/en/articles/multi-screen-window-placement/) API. * `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 * `callback` Function
@@ -832,7 +920,7 @@ To clear the handler, call `setPermissionRequestHandler(null)`. Please note tha
you must also implement `setPermissionCheckHandler` to get complete permission handling. you must also implement `setPermissionCheckHandler` to get complete permission handling.
Most web APIs do a permission check and then make a permission request if the check is denied. Most web APIs do a permission check and then make a permission request if the check is denied.
```js ```javascript
const { session } = require('electron') const { session } = require('electron')
session.fromPartition('some-partition').setPermissionRequestHandler((webContents, permission, callback) => { session.fromPartition('some-partition').setPermissionRequestHandler((webContents, permission, callback) => {
if (webContents.getURL() === 'some-host' && permission === 'notifications') { if (webContents.getURL() === 'some-host' && permission === 'notifications') {
@@ -878,7 +966,7 @@ you must also implement `setPermissionRequestHandler` to get complete permission
Most web APIs do a permission check and then make a permission request if the check is denied. Most web APIs do a permission check and then make a permission request if the check is denied.
To clear the handler, call `setPermissionCheckHandler(null)`. To clear the handler, call `setPermissionCheckHandler(null)`.
```js ```javascript
const { session } = require('electron') const { session } = require('electron')
const url = require('url') const url = require('url')
session.fromPartition('some-partition').setPermissionCheckHandler((webContents, permission, requestingOrigin) => { session.fromPartition('some-partition').setPermissionCheckHandler((webContents, permission, requestingOrigin) => {
@@ -923,7 +1011,7 @@ via the `navigator.mediaDevices.getDisplayMedia` API. Use the
[desktopCapturer](desktop-capturer.md) API to choose which stream(s) to grant [desktopCapturer](desktop-capturer.md) API to choose which stream(s) to grant
access to. access to.
```js ```javascript
const { session, desktopCapturer } = require('electron') const { session, desktopCapturer } = require('electron')
session.defaultSession.setDisplayMediaRequestHandler((request, callback) => { session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
@@ -937,7 +1025,7 @@ session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
Passing a [WebFrameMain](web-frame-main.md) object as a video or audio stream Passing a [WebFrameMain](web-frame-main.md) object as a video or audio stream
will capture the video or audio stream from that frame. will capture the video or audio stream from that frame.
```js ```javascript
const { session } = require('electron') const { session } = require('electron')
session.defaultSession.setDisplayMediaRequestHandler((request, callback) => { session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
@@ -962,11 +1050,11 @@ To clear the handler, call `setDevicePermissionHandler(null)`.
This handler can be used to provide default permissioning to devices without first calling for permission This handler can be used to provide default permissioning to devices without first calling for permission
to devices (eg via `navigator.hid.requestDevice`). If this handler is not defined, the default device to devices (eg via `navigator.hid.requestDevice`). If this handler is not defined, the default device
permissions as granted through device selection (eg via `navigator.hid.requestDevice`) will be used. permissions as granted through device selection (eg via `navigator.hid.requestDevice`) will be used.
Additionally, the default behavior of Electron is to store granted device permission in memory. Additionally, the default behavior of Electron is to store granted device permision in memory.
If longer term storage is needed, a developer can store granted device 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`. permissions (eg when handling the `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`.
```js @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)} ```javascript @ts-type={fetchGrantedDevices:()=>(Array<Electron.DevicePermissionHandlerHandlerDetails['device']>)}
const { app, BrowserWindow } = require('electron') const { app, BrowserWindow } = require('electron')
let win = null let win = null
@@ -1048,7 +1136,7 @@ The return value for the handler is a string array of USB classes which should b
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). 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)`. To clear the handler, call `setUSBProtectedClassesHandler(null)`.
```js ```javascript
const { app, BrowserWindow } = require('electron') const { app, BrowserWindow } = require('electron')
let win = null let win = null
@@ -1103,7 +1191,7 @@ that requires additional validation will be automatically cancelled.
macOS does not require a handler because macOS handles the pairing macOS does not require a handler because macOS handles the pairing
automatically. To clear the handler, call `setBluetoothPairingHandler(null)`. automatically. To clear the handler, call `setBluetoothPairingHandler(null)`.
```js ```javascript
const { app, BrowserWindow, session } = require('electron') const { app, BrowserWindow, session } = require('electron')
const path = require('node:path') const path = require('node:path')
@@ -1149,7 +1237,7 @@ Clears the host resolver cache.
Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
authentication. authentication.
```js ```javascript
const { session } = require('electron') const { session } = require('electron')
// consider any url ending with `example.com`, `foobar.com`, `baz` // consider any url ending with `example.com`, `foobar.com`, `baz`
// for integrated authentication. // for integrated authentication.
@@ -1267,10 +1355,6 @@ registered.
Sets the directory to store the generated JS [code cache](https://v8.dev/blog/code-caching-for-devs) for this session. The directory is not required to be created by the user before this call, the runtime will create if it does not exist otherwise will use the existing directory. If directory cannot be created, then code cache will not be used and all operations related to code cache will fail silently inside the runtime. By default, the directory will be `Code Cache` under the Sets the directory to store the generated JS [code cache](https://v8.dev/blog/code-caching-for-devs) for this session. The directory is not required to be created by the user before this call, the runtime will create if it does not exist otherwise will use the existing directory. If directory cannot be created, then code cache will not be used and all operations related to code cache will fail silently inside the runtime. By default, the directory will be `Code Cache` under the
respective user data folder. respective user data folder.
Note that by default code cache is only enabled for http(s) URLs, to enable code
cache for custom protocols, `codeCache: true` and `standard: true` must be
specified when registering the protocol.
#### `ses.clearCodeCaches(options)` #### `ses.clearCodeCaches(options)`
* `options` Object * `options` Object
@@ -1458,7 +1542,7 @@ A [`WebRequest`](web-request.md) object for this session.
A [`Protocol`](protocol.md) object for this session. A [`Protocol`](protocol.md) object for this session.
```js ```javascript
const { app, session } = require('electron') const { app, session } = require('electron')
const path = require('node:path') const path = require('node:path')
@@ -1477,7 +1561,7 @@ app.whenReady().then(() => {
A [`NetLog`](net-log.md) object for this session. A [`NetLog`](net-log.md) object for this session.
```js ```javascript
const { app, session } = require('electron') const { app, session } = require('electron')
app.whenReady().then(async () => { app.whenReady().then(async () => {

View File

@@ -8,7 +8,7 @@ The `shell` module provides functions related to desktop integration.
An example of opening a URL in the user's default browser: An example of opening a URL in the user's default browser:
```js ```javascript
const { shell } = require('electron') const { shell } = require('electron')
shell.openExternal('https://github.com') shell.openExternal('https://github.com')

View File

@@ -1,152 +0,0 @@
# BaseWindowConstructorOptions Object
* `width` Integer (optional) - Window's width in pixels. Default is `800`.
* `height` Integer (optional) - Window's height in pixels. Default is `600`.
* `x` Integer (optional) - (**required** if y is used) Window's left offset from screen.
Default is to center the window.
* `y` Integer (optional) - (**required** if x is used) Window's top offset from screen.
Default is to center the window.
* `useContentSize` boolean (optional) - The `width` and `height` would be used as web
page's size, which means the actual window's size will include window
frame's size and be slightly larger. Default is `false`.
* `center` boolean (optional) - Show window in the center of the screen. Default is `false`.
* `minWidth` Integer (optional) - Window's minimum width. Default is `0`.
* `minHeight` Integer (optional) - Window's minimum height. Default is `0`.
* `maxWidth` Integer (optional) - Window's maximum width. Default is no limit.
* `maxHeight` Integer (optional) - Window's maximum height. Default is no limit.
* `resizable` boolean (optional) - Whether window is resizable. Default is `true`.
* `movable` boolean (optional) _macOS_ _Windows_ - Whether window is
movable. This is not implemented on Linux. Default is `true`.
* `minimizable` boolean (optional) _macOS_ _Windows_ - Whether window is
minimizable. This is not implemented on Linux. Default is `true`.
* `maximizable` boolean (optional) _macOS_ _Windows_ - Whether window is
maximizable. This is not implemented on Linux. Default is `true`.
* `closable` boolean (optional) _macOS_ _Windows_ - Whether window is
closable. This is not implemented on Linux. Default is `true`.
* `focusable` boolean (optional) - Whether the window can be focused. Default is
`true`. On Windows setting `focusable: false` also implies setting
`skipTaskbar: true`. On Linux setting `focusable: false` makes the window
stop interacting with wm, so the window will always stay on top in all
workspaces.
* `alwaysOnTop` boolean (optional) - Whether the window should always stay on top of
other windows. Default is `false`.
* `fullscreen` boolean (optional) - Whether the window should show in fullscreen. When
explicitly set to `false` the fullscreen button will be hidden or disabled
on macOS. Default is `false`.
* `fullscreenable` boolean (optional) - Whether the window can be put into fullscreen
mode. On macOS, also whether the maximize/zoom button should toggle full
screen mode or maximize window. Default is `true`.
* `simpleFullscreen` boolean (optional) _macOS_ - Use pre-Lion fullscreen on
macOS. Default is `false`.
* `skipTaskbar` boolean (optional) _macOS_ _Windows_ - Whether to show the window in taskbar.
Default is `false`.
* `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control.
* `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`.
* `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored.
* `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is
recommended to use `ICO` icons to get best visual effects, you can also
leave it undefined so the executable's icon will be used.
* `show` boolean (optional) - Whether window should be shown when created. Default is
`true`.
* `frame` boolean (optional) - Specify `false` to create a
[frameless window](../../tutorial/window-customization.md#create-frameless-windows). Default is `true`.
* `parent` BaseWindow (optional) - Specify parent window. Default is `null`.
* `modal` boolean (optional) - Whether this is a modal window. This only works when the
window is a child window. Default is `false`.
* `acceptFirstMouse` boolean (optional) _macOS_ - Whether clicking an
inactive window will also click through to the web contents. Default is
`false` on macOS. This option is not configurable on other platforms.
* `disableAutoHideCursor` boolean (optional) - Whether to hide cursor when typing.
Default is `false`.
* `autoHideMenuBar` boolean (optional) - Auto hide the menu bar unless the `Alt`
key is pressed. Default is `false`.
* `enableLargerThanScreen` boolean (optional) _macOS_ - Enable the window to
be resized larger than screen. Only relevant for macOS, as other OSes
allow larger-than-screen windows by default. Default is `false`.
* `backgroundColor` string (optional) - The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported if `transparent` is set to `true`. Default is `#FFF` (white). See [win.setBackgroundColor](../browser-window.md#winsetbackgroundcolorbackgroundcolor) for more information.
* `hasShadow` boolean (optional) - Whether window should have a shadow. Default is `true`.
* `opacity` number (optional) _macOS_ _Windows_ - Set the initial opacity of
the window, between 0.0 (fully transparent) and 1.0 (fully opaque). This
is only implemented on Windows and macOS.
* `darkTheme` boolean (optional) - Forces using dark theme for the window, only works on
some GTK+3 desktop environments. Default is `false`.
* `transparent` boolean (optional) - Makes the window [transparent](../../tutorial/window-customization.md#create-transparent-windows).
Default is `false`. On Windows, does not work unless the window is frameless.
* `type` string (optional) - The type of window, default is normal window. See more about
this below.
* `visualEffectState` string (optional) _macOS_ - Specify how the material
appearance should reflect window activity state on macOS. Must be used
with the `vibrancy` property. Possible values are:
* `followWindow` - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.
* `active` - The backdrop should always appear active.
* `inactive` - The backdrop should always appear inactive.
* `titleBarStyle` string (optional) _macOS_ _Windows_ - The style of window title bar.
Default is `default`. Possible values are:
* `default` - Results in the standard title bar for macOS or Windows respectively.
* `hidden` - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with `titleBarOverlay: true` it will activate the Window Controls Overlay (see `titleBarOverlay` for more information), otherwise no window controls will be shown.
* `hiddenInset` _macOS_ - Only on macOS, results in a hidden title bar
with an alternative look where the traffic light buttons are slightly
more inset from the window edge.
* `customButtonsOnHover` _macOS_ - Only on macOS, results in a hidden
title bar and a full size content window, the traffic light buttons will
display when being hovered over in the top left of the window.
**Note:** This option is currently experimental.
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
Set a custom position for the traffic light buttons in frameless windows.
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
should have rounded corners on macOS. Default is `true`. Setting this property
to `false` will prevent the window from being fullscreenable.
* `thickFrame` boolean (optional) - Use `WS_THICKFRAME` style for frameless windows on
Windows, which adds standard window frame. Setting it to `false` will remove
window shadow and window animations. Default is `true`.
* `vibrancy` string (optional) _macOS_ - Add a type of vibrancy effect to
the window, only on macOS. Can be `appearance-based`, `titlebar`, `selection`,
`menu`, `popover`, `sidebar`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`,
`tooltip`, `content`, `under-window`, or `under-page`.
* `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](../browser-window.md#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
the preferred width of the web page when zoomed, `false` will cause it to
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. 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.
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
passing a size that does not follow size constraints to `setBounds`/`setSize` or
to the constructor of `BrowserWindow`.
The possible values and behaviors of the `type` option are platform dependent.
Possible values are:
* On Linux, possible types are `desktop`, `dock`, `toolbar`, `splash`,
`notification`.
* The `desktop` type places the window at the desktop background window level
(kCGDesktopWindowLevel - 1). However, note that a desktop window will not
receive focus, keyboard, or mouse events. You can still use globalShortcut to
receive input sparingly.
* The `dock` type creates a dock-like window behavior.
* The `toolbar` type creates a window with a toolbar appearance.
* The `splash` type behaves in a specific way. It is not
draggable, even if the CSS styling of the window's body contains
-webkit-app-region: drag. This type is commonly used for splash screens.
* The `notification` type creates a window that behaves like a system notification.
* On macOS, possible types are `desktop`, `textured`, `panel`.
* The `textured` type adds metal gradient appearance
(`NSWindowStyleMaskTexturedBackground`).
* The `desktop` type places the window at the desktop background window level
(`kCGDesktopWindowLevel - 1`). Note that desktop window will not receive
focus, keyboard or mouse events, but you can use `globalShortcut` to receive
input sparingly.
* The `panel` type enables the window to float on top of full-screened apps
by adding the `NSWindowStyleMaskNonactivatingPanel` style mask,normally
reserved for NSPanel, at runtime. Also, the window will appear on all
spaces (desktops).
* On Windows, possible type is `toolbar`.

View File

@@ -1,11 +1,164 @@
# BrowserWindowConstructorOptions Object extends `BaseWindowConstructorOptions` # BrowserWindowConstructorOptions Object
* `webPreferences` [WebPreferences](web-preferences.md?inline) (optional) - Settings of web page's features. * `width` Integer (optional) - Window's width in pixels. Default is `800`.
* `height` Integer (optional) - Window's height in pixels. Default is `600`.
* `x` Integer (optional) - (**required** if y is used) Window's left offset from screen.
Default is to center the window.
* `y` Integer (optional) - (**required** if x is used) Window's top offset from screen.
Default is to center the window.
* `useContentSize` boolean (optional) - The `width` and `height` would be used as web
page's size, which means the actual window's size will include window
frame's size and be slightly larger. Default is `false`.
* `center` boolean (optional) - Show window in the center of the screen. Default is `false`.
* `minWidth` Integer (optional) - Window's minimum width. Default is `0`.
* `minHeight` Integer (optional) - Window's minimum height. Default is `0`.
* `maxWidth` Integer (optional) - Window's maximum width. Default is no limit.
* `maxHeight` Integer (optional) - Window's maximum height. Default is no limit.
* `resizable` boolean (optional) - Whether window is resizable. Default is `true`.
* `movable` boolean (optional) _macOS_ _Windows_ - Whether window is
movable. This is not implemented on Linux. Default is `true`.
* `minimizable` boolean (optional) _macOS_ _Windows_ - Whether window is
minimizable. This is not implemented on Linux. Default is `true`.
* `maximizable` boolean (optional) _macOS_ _Windows_ - Whether window is
maximizable. This is not implemented on Linux. Default is `true`.
* `closable` boolean (optional) _macOS_ _Windows_ - Whether window is
closable. This is not implemented on Linux. Default is `true`.
* `focusable` boolean (optional) - Whether the window can be focused. Default is
`true`. On Windows setting `focusable: false` also implies setting
`skipTaskbar: true`. On Linux setting `focusable: false` makes the window
stop interacting with wm, so the window will always stay on top in all
workspaces.
* `alwaysOnTop` boolean (optional) - Whether the window should always stay on top of
other windows. Default is `false`.
* `fullscreen` boolean (optional) - Whether the window should show in fullscreen. When
explicitly set to `false` the fullscreen button will be hidden or disabled
on macOS. Default is `false`.
* `fullscreenable` boolean (optional) - Whether the window can be put into fullscreen
mode. On macOS, also whether the maximize/zoom button should toggle full
screen mode or maximize window. Default is `true`.
* `simpleFullscreen` boolean (optional) _macOS_ - Use pre-Lion fullscreen on
macOS. Default is `false`.
* `skipTaskbar` boolean (optional) _macOS_ _Windows_ - Whether to show the window in taskbar.
Default is `false`.
* `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control.
* `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`.
* `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored.
* `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is
recommended to use `ICO` icons to get best visual effects, you can also
leave it undefined so the executable's icon will be used.
* `show` boolean (optional) - Whether window should be shown when created. Default is
`true`.
* `paintWhenInitiallyHidden` boolean (optional) - Whether the renderer should be active when `show` is `false` and it has just been created. In order for `document.visibilityState` to work correctly on first load with `show: false` you should set this to `false`. Setting this to `false` will cause the `ready-to-show` event to not fire. Default is `true`. * `paintWhenInitiallyHidden` boolean (optional) - Whether the renderer should be active when `show` is `false` and it has just been created. In order for `document.visibilityState` to work correctly on first load with `show: false` you should set this to `false`. Setting this to `false` will cause the `ready-to-show` event to not fire. Default is `true`.
* `frame` boolean (optional) - Specify `false` to create a
[frameless window](../../tutorial/window-customization.md#create-frameless-windows). Default is `true`.
* `parent` BrowserWindow (optional) - Specify parent window. Default is `null`.
* `modal` boolean (optional) - Whether this is a modal window. This only works when the
window is a child window. Default is `false`.
* `acceptFirstMouse` boolean (optional) _macOS_ - Whether clicking an
inactive window will also click through to the web contents. Default is
`false` on macOS. This option is not configurable on other platforms.
* `disableAutoHideCursor` boolean (optional) - Whether to hide cursor when typing.
Default is `false`.
* `autoHideMenuBar` boolean (optional) - Auto hide the menu bar unless the `Alt`
key is pressed. Default is `false`.
* `enableLargerThanScreen` boolean (optional) _macOS_ - Enable the window to
be resized larger than screen. Only relevant for macOS, as other OSes
allow larger-than-screen windows by default. Default is `false`.
* `backgroundColor` string (optional) - The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported if `transparent` is set to `true`. Default is `#FFF` (white). See [win.setBackgroundColor](../browser-window.md#winsetbackgroundcolorbackgroundcolor) for more information.
* `hasShadow` boolean (optional) - Whether window should have a shadow. Default is `true`.
* `opacity` number (optional) _macOS_ _Windows_ - Set the initial opacity of
the window, between 0.0 (fully transparent) and 1.0 (fully opaque). This
is only implemented on Windows and macOS.
* `darkTheme` boolean (optional) - Forces using dark theme for the window, only works on
some GTK+3 desktop environments. Default is `false`.
* `transparent` boolean (optional) - Makes the window [transparent](../../tutorial/window-customization.md#create-transparent-windows).
Default is `false`. On Windows, does not work unless the window is frameless.
* `type` string (optional) - The type of window, default is normal window. See more about
this below.
* `visualEffectState` string (optional) _macOS_ - Specify how the material
appearance should reflect window activity state on macOS. Must be used
with the `vibrancy` property. Possible values are:
* `followWindow` - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.
* `active` - The backdrop should always appear active.
* `inactive` - The backdrop should always appear inactive.
* `titleBarStyle` string (optional) _macOS_ _Windows_ - The style of window title bar.
Default is `default`. Possible values are:
* `default` - Results in the standard title bar for macOS or Windows respectively.
* `hidden` - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with `titleBarOverlay: true` it will activate the Window Controls Overlay (see `titleBarOverlay` for more information), otherwise no window controls will be shown.
* `hiddenInset` _macOS_ - Only on macOS, results in a hidden title bar
with an alternative look where the traffic light buttons are slightly
more inset from the window edge.
* `customButtonsOnHover` _macOS_ - Only on macOS, results in a hidden
title bar and a full size content window, the traffic light buttons will
display when being hovered over in the top left of the window.
**Note:** This option is currently experimental.
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
Set a custom position for the traffic light buttons in frameless windows.
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
should have rounded corners on macOS. Default is `true`. Setting this property
to `false` will prevent the window from being fullscreenable.
* `fullscreenWindowTitle` boolean (optional) _macOS_ _Deprecated_ - Shows
the title in the title bar in full screen mode on macOS for `hiddenInset`
titleBarStyle. Default is `false`.
* `thickFrame` boolean (optional) - Use `WS_THICKFRAME` style for frameless windows on
Windows, which adds standard window frame. Setting it to `false` will remove
window shadow and window animations. Default is `true`.
* `vibrancy` string (optional) _macOS_ - Add a type of vibrancy effect to
the window, only on macOS. Can be `appearance-based`, `titlebar`, `selection`,
`menu`, `popover`, `sidebar`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`,
`tooltip`, `content`, `under-window`, or `under-page`.
* `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](../browser-window.md#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
the preferred width of the web page when zoomed, `false` will cause it to
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. 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.
* `webPreferences` [WebPreferences](web-preferences.md?inline) (optional) - Settings of web page's features.
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`. * `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
* `color` String (optional) _Windows_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color. * `color` String (optional) _Windows_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color. * `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
* `height` Integer (optional) _macOS_ _Windows_ - The height of the title bar and Window Controls Overlay in pixels. Default is system height. * `height` Integer (optional) _macOS_ _Windows_ - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
passing a size that does not follow size constraints to `setBounds`/`setSize` or
to the constructor of `BrowserWindow`.
The possible values and behaviors of the `type` option are platform dependent.
Possible values are:
* On Linux, possible types are `desktop`, `dock`, `toolbar`, `splash`,
`notification`.
* The `desktop` type places the window at the desktop background window level
(kCGDesktopWindowLevel - 1). However, note that a desktop window will not
receive focus, keyboard, or mouse events. You can still use globalShortcut to
receive input sparingly.
* The `dock` type creates a dock-like window behavior.
* The `toolbar` type creates a window with a toolbar appearance.
* The `splash` type behaves in a specific way. It is not
draggable, even if the CSS styling of the window's body contains
-webkit-app-region: drag. This type is commonly used for splash screens.
* The `notification` type creates a window that behaves like a system notification.
* On macOS, possible types are `desktop`, `textured`, `panel`.
* The `textured` type adds metal gradient appearance
(`NSWindowStyleMaskTexturedBackground`).
* The `desktop` type places the window at the desktop background window level
(`kCGDesktopWindowLevel - 1`). Note that desktop window will not receive
focus, keyboard or mouse events, but you can use `globalShortcut` to receive
input sparingly.
* The `panel` type enables the window to float on top of full-screened apps
by adding the `NSWindowStyleMaskNonactivatingPanel` style mask,normally
reserved for NSPanel, at runtime. Also, the window will appear on all
spaces (desktops).
* On Windows, possible type is `toolbar`.
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables [overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis [overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis

View File

@@ -9,5 +9,3 @@
* `supportFetchAPI` boolean (optional) - Default false. * `supportFetchAPI` boolean (optional) - Default false.
* `corsEnabled` boolean (optional) - Default false. * `corsEnabled` boolean (optional) - Default false.
* `stream` boolean (optional) - Default false. * `stream` boolean (optional) - Default false.
* `codeCache` boolean (optional) - Enable V8 code cache for the scheme, only
works when `standard` is also set to true. Default false.

View File

@@ -1,25 +1,22 @@
# Display Object # Display Object
* `accelerometerSupport` string - Can be `available`, `unavailable`, `unknown`. * `id` number - Unique identifier associated with the display.
* `bounds` [Rectangle](rectangle.md) - the bounds of the display in DIP points.
* `colorDepth` number - The number of bits per pixel.
* `colorSpace` string - represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions.
* `depthPerComponent` number - The number of bits per color component.
* `detected` boolean - `true`` if the display is detected by the system.
* `displayFrequency` number - The display refresh rate.
* `id` number - Unique identifier associated with the display. A value of of -1 means the display is invalid or the correct `id` is not yet known, and a value of -10 means the display is a virtual display assigned to a unified desktop.
* `internal` boolean - `true` for an internal display and `false` for an external display.
* `label` string - User-friendly label, determined by the platform. * `label` string - User-friendly label, determined by the platform.
* `maximumCursorSize` [Size](size.md) - Maximum cursor size in native pixels.
* `nativeOrigin` [Point](point.md) - Returns the display's origin in pixel coordinates. Only available on windowing systems like X11 that position displays in pixel coordinates.
* `rotation` number - Can be 0, 90, 180, 270, represents screen rotation in * `rotation` number - Can be 0, 90, 180, 270, represents screen rotation in
clock-wise degrees. clock-wise degrees.
* `scaleFactor` number - Output device's pixel scale factor. * `scaleFactor` number - Output device's pixel scale factor.
* `touchSupport` string - Can be `available`, `unavailable`, `unknown`. * `touchSupport` string - Can be `available`, `unavailable`, `unknown`.
* `monochrome` boolean - Whether or not the display is a monochrome display. * `monochrome` boolean - Whether or not the display is a monochrome display.
* `accelerometerSupport` string - Can be `available`, `unavailable`, `unknown`.
* `colorSpace` string - represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions
* `colorDepth` number - The number of bits per pixel.
* `depthPerComponent` number - The number of bits per color component.
* `displayFrequency` number - The display refresh rate.
* `bounds` [Rectangle](rectangle.md) - the bounds of the display in DIP points.
* `size` [Size](size.md) * `size` [Size](size.md)
* `workArea` [Rectangle](rectangle.md) - the work area of the display in DIP points. * `workArea` [Rectangle](rectangle.md) - the work area of the display in DIP points.
* `workAreaSize` [Size](size.md) - The size of the work area. * `workAreaSize` [Size](size.md)
* `internal` boolean - `true` for an internal display and `false` for an external display
The `Display` object represents a physical display connected to the system. A The `Display` object represents a physical display connected to the system. A
fake `Display` may exist on a headless system, or a `Display` may correspond to fake `Display` may exist on a headless system, or a `Display` may correspond to

View File

@@ -0,0 +1,8 @@
# IOCounters Object
* `readOperationCount` number - The number of I/O read operations.
* `writeOperationCount` number - The number of I/O write operations.
* `otherOperationCount` number - Then number of I/O other operations.
* `readTransferCount` number - The number of I/O read transfers.
* `writeTransferCount` number - The number of I/O write transfers.
* `otherTransferCount` number - Then number of I/O other transfers.

View File

@@ -1,6 +1,9 @@
# IpcRendererEvent Object extends `Event` # IpcRendererEvent Object extends `Event`
* `sender` [IpcRenderer](../ipc-renderer.md) - The `IpcRenderer` instance that emitted the event originally * `sender` [IpcRenderer](../ipc-renderer.md) - The `IpcRenderer` instance that emitted the event originally
* `senderId` Integer _Deprecated_ - 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`.
* `senderIsMainFrame` boolean (optional) _Deprecated_ - 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 * `ports` [MessagePort][][] - A list of MessagePorts that were transferred with this message
[ipc-renderer-sendto]: ../ipc-renderer.md#ipcrenderersendtowebcontentsid-channel-args-deprecated
[MessagePort]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort [MessagePort]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort

View File

@@ -14,7 +14,7 @@ The number represented by `status` means different things on different platforms
Below is an example of some of the additional options that may be set which Below is an example of some of the additional options that may be set which
may be different on each platform. may be different on each platform.
```js ```javascript
{ {
name: 'Austin_4th_Floor_Printer___C02XK13BJHD4', name: 'Austin_4th_Floor_Printer___C02XK13BJHD4',
displayName: 'Austin 4th Floor Printer @ C02XK13BJHD4', displayName: 'Austin 4th Floor Printer @ C02XK13BJHD4',

View File

@@ -1,86 +0,0 @@
# ProxyConfig Object
* `mode` string (optional) - The proxy mode. Should be one of `direct`,
`auto_detect`, `pac_script`, `fixed_servers` or `system`.
Defaults to `pac_script` proxy mode if `pacScript` option is specified
otherwise defaults to `fixed_servers`.
* `direct` - In direct mode all connections are created directly, without any proxy involved.
* `auto_detect` - In auto_detect mode the proxy configuration is determined by a PAC script that can
be downloaded at http://wpad/wpad.dat.
* `pac_script` - In pac_script mode the proxy configuration is determined by a PAC script that is
retrieved from the URL specified in the `pacScript`. This is the default mode if `pacScript` is specified.
* `fixed_servers` - In fixed_servers mode the proxy configuration is specified in `proxyRules`.
This is the default mode if `proxyRules` is specified.
* `system` - In system mode the proxy configuration is taken from the operating system.
Note that the system mode is different from setting no proxy configuration.
In the latter case, Electron falls back to the system settings only if no
command-line options influence the proxy configuration.
* `pacScript` string (optional) - The URL associated with the PAC file.
* `proxyRules` string (optional) - Rules indicating which proxies to use.
* `proxyBypassRules` string (optional) - Rules indicating which URLs should
bypass the proxy settings.
When `mode` is unspecified, `pacScript` and `proxyRules` are provided together, the `proxyRules`
option is ignored and `pacScript` configuration is applied.
The `proxyRules` has to follow the rules below:
```sh
proxyRules = schemeProxies[";"<schemeProxies>]
schemeProxies = [<urlScheme>"="]<proxyURIList>
urlScheme = "http" | "https" | "ftp" | "socks"
proxyURIList = <proxyURL>[","<proxyURIList>]
proxyURL = [<proxyScheme>"://"]<proxyHost>[":"<proxyPort>]
```
For example:
* `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
HTTP proxy `foopy2:80` for `ftp://` URLs.
* `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
* `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
* `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
* `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
* `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
proxy if `foopy` is unavailable.
* `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
`socks4://foopy2` for all other URLs.
The `proxyBypassRules` is a comma separated list of rules described below:
* `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
Match all hostnames that match the pattern HOSTNAME_PATTERN.
Examples:
"foobar.com", "\*foobar.com", "\*.foobar.com", "\*foobar.com:99",
"https://x.\*.y.com:99"
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
Match a particular domain suffix.
Examples:
".google.com", ".com", "http://.google.com"
* `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
Match URLs which are IP address literals.
Examples:
"127.0.1", "\[0:0::1]", "\[::1]", "http://\[::1]:99"
* `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
Match any URL that is to an IP literal that falls between the
given range. IP range is specified using CIDR notation.
Examples:
"192.168.1.1/16", "fefe:13::abc/33".
* `<local>`
Match local addresses. The meaning of `<local>` is whether the
host matches one of: "127.0.0.1", "::1", "localhost".

View File

@@ -9,4 +9,4 @@
* `array` Array\<unknown> * `array` Array\<unknown>
* `dictionary` Record\<string, unknown> * `dictionary` Record\<string, unknown>
This type is a helper alias, no object will ever exist of this type. This type is a helper alias, no object will never exist of this type.

View File

@@ -74,11 +74,7 @@
* `defaultEncoding` string (optional) - Defaults to `ISO-8859-1`. * `defaultEncoding` string (optional) - Defaults to `ISO-8859-1`.
* `backgroundThrottling` boolean (optional) - Whether to throttle animations and timers * `backgroundThrottling` boolean (optional) - Whether to throttle animations and timers
when the page becomes background. This also affects the when the page becomes background. This also affects the
[Page Visibility API](../browser-window.md#page-visibility). When at least one [Page Visibility API](../browser-window.md#page-visibility). Defaults to `true`.
[webContents](../web-contents.md) displayed in a single
[browserWindow](../browser-window.md) has disabled `backgroundThrottling` then
frames will be drawn and swapped for the whole window and other
[webContents](../web-contents.md) displayed by it. Defaults to `true`.
* `offscreen` boolean (optional) - Whether to enable offscreen rendering for the browser * `offscreen` boolean (optional) - Whether to enable offscreen rendering for the browser
window. Defaults to `false`. See the window. Defaults to `false`. See the
[offscreen rendering tutorial](../../tutorial/offscreen-rendering.md) for [offscreen rendering tutorial](../../tutorial/offscreen-rendering.md) for

View File

@@ -4,7 +4,7 @@
Process: [Main](../glossary.md#main-process) Process: [Main](../glossary.md#main-process)
```js ```javascript
const { systemPreferences } = require('electron') const { systemPreferences } = require('electron')
console.log(systemPreferences.isAeroGlassEnabled()) console.log(systemPreferences.isAeroGlassEnabled())
``` ```
@@ -189,7 +189,7 @@ enabled, and `false` otherwise.
An example of using it to determine if you should create a transparent window or An example of using it to determine if you should create a transparent window or
not (transparent windows won't work correctly when DWM composition is disabled): not (transparent windows won't work correctly when DWM composition is disabled):
```js ```javascript
const { BrowserWindow, systemPreferences } = require('electron') const { BrowserWindow, systemPreferences } = require('electron')
const browserOptions = { width: 1000, height: 800 } const browserOptions = { width: 1000, height: 800 }
@@ -306,7 +306,7 @@ This API is only available on macOS 10.14 Mojave or newer.
* `window-background` - The background of a window. * `window-background` - The background of a window.
* `window-frame-text` - The text in the window's titlebar area. * `window-frame-text` - The text in the window's titlebar area.
Returns `string` - The system color setting in RGBA hexadecimal form (`#RRGGBBAA`). Returns `string` - The system color setting in RGB hexadecimal form (`#ABCDEF`).
See the [Windows docs][windows-colors] and the [macOS docs][macos-colors] for more details. See the [Windows docs][windows-colors] and the [macOS docs][macos-colors] for more details.
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`. 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`.
@@ -348,7 +348,7 @@ Returns `boolean` - whether or not this device has the ability to use Touch ID.
Returns `Promise<void>` - resolves if the user has successfully authenticated with Touch ID. Returns `Promise<void>` - resolves if the user has successfully authenticated with Touch ID.
```js ```javascript
const { systemPreferences } = require('electron') const { systemPreferences } = require('electron')
systemPreferences.promptTouchID('To get consent for a Security-Gated Thing').then(success => { systemPreferences.promptTouchID('To get consent for a Security-Gated Thing').then(success => {

View File

@@ -79,7 +79,7 @@ immediately updates the escape item in the touch bar.
Below is an example of a simple slot machine touch bar game with a button Below is an example of a simple slot machine touch bar game with a button
and some labels. and some labels.
```js ```javascript
const { app, BrowserWindow, TouchBar } = require('electron') const { app, BrowserWindow, TouchBar } = require('electron')
const { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar const { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar

View File

@@ -8,7 +8,7 @@ Process: [Main](../glossary.md#main-process)
`Tray` is an [EventEmitter][event-emitter]. `Tray` is an [EventEmitter][event-emitter].
```js ```javascript
const { app, Menu, Tray } = require('electron') const { app, Menu, Tray } = require('electron')
let tray = null let tray = null
@@ -39,7 +39,7 @@ app.whenReady().then(() => {
* In order for changes made to individual `MenuItem`s to take effect, * In order for changes made to individual `MenuItem`s to take effect,
you have to call `setContextMenu` again. For example: you have to call `setContextMenu` again. For example:
```js ```javascript
const { app, Menu, Tray } = require('electron') const { app, Menu, Tray } = require('electron')
let appIcon = null let appIcon = null
@@ -60,7 +60,7 @@ app.whenReady().then(() => {
**MacOS** **MacOS**
* Icons passed to the Tray constructor should be [Template Images](native-image.md#template-image-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. * 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. * 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. * 16x16 (72dpi) and 32x32@2x (144dpi) work well for most icons.
@@ -111,15 +111,6 @@ Returns:
Emitted when the tray icon is double clicked. Emitted when the tray icon is double clicked.
#### Event: 'middle-click' _Windows_
Returns:
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `bounds` [Rectangle](structures/rectangle.md) - The bounds of tray icon.
Emitted when the tray icon is middle clicked.
#### Event: 'balloon-show' _Windows_ #### Event: 'balloon-show' _Windows_
Emitted when the tray balloon shows. Emitted when the tray balloon shows.
@@ -187,7 +178,7 @@ Returns:
Emitted when the mouse clicks the tray icon. Emitted when the mouse clicks the tray icon.
#### Event: 'mouse-enter' _macOS_ _Windows_ #### Event: 'mouse-enter' _macOS_
Returns: Returns:
@@ -196,7 +187,7 @@ Returns:
Emitted when the mouse enters the tray icon. Emitted when the mouse enters the tray icon.
#### Event: 'mouse-leave' _macOS_ _Windows_ #### Event: 'mouse-leave' _macOS_
Returns: Returns:

View File

@@ -21,15 +21,15 @@ Process: [Main](../glossary.md#main-process)<br />
of the child process. Default is `inherit`. of the child process. Default is `inherit`.
String value can be one of `pipe`, `ignore`, `inherit`, for more details on these values you can refer to String value can be one of `pipe`, `ignore`, `inherit`, for more details on these values you can refer to
[stdio][] documentation from Node.js. Currently this option only supports configuring `stdout` and [stdio][] documentation from Node.js. Currently this option only supports configuring `stdout` and
`stderr` to either `pipe`, `inherit` or `ignore`. Configuring `stdin` to any property other than `ignore` is not supported and will result in an error. `stderr` to either `pipe`, `inherit` or `ignore`. Configuring `stdin` is not supported; `stdin` will
always be ignored.
For example, the supported values will be processed as following: For example, the supported values will be processed as following:
* `pipe`: equivalent to \['ignore', 'pipe', 'pipe'] * `pipe`: equivalent to \['ignore', 'pipe', 'pipe'] (the default)
* `ignore`: equivalent to \['ignore', 'ignore', 'ignore'] * `ignore`: equivalent to \['ignore', 'ignore', 'ignore']
* `inherit`: equivalent to \['ignore', 'inherit', 'inherit'] (the default) * `inherit`: equivalent to \['ignore', 'inherit', 'inherit']
* `serviceName` string (optional) - Name of the process that will appear in `name` property of * `serviceName` string (optional) - Name of the process that will appear in `name` property of
[`ProcessMetric`](structures/process-metric.md) returned by [`app.getAppMetrics`](app.md#appgetappmetrics) [`child-process-gone` event of `app`](app.md#event-child-process-gone).
and [`child-process-gone` event of `app`](app.md#event-child-process-gone). Default is `node.mojom.NodeService`.
Default is `Node Utility Process`.
* `allowLoadingUnsignedLibraries` boolean (optional) _macOS_ - With this flag, the utility process will be * `allowLoadingUnsignedLibraries` boolean (optional) _macOS_ - With this flag, the utility process will be
launched via the `Electron Helper (Plugin).app` helper executable on macOS, which can be launched via the `Electron Helper (Plugin).app` helper executable on macOS, which can be
codesigned with `com.apple.security.cs.disable-library-validation` and codesigned with `com.apple.security.cs.disable-library-validation` and

View File

@@ -1,106 +0,0 @@
# View
> Create and layout native views.
Process: [Main](../glossary.md#main-process)
This module cannot be used until the `ready` event of the `app`
module is emitted.
```js
const { BaseWindow, View } = require('electron')
const win = new BaseWindow()
const view = new View()
view.setBackgroundColor('red')
view.setBounds({ x: 0, y: 0, width: 100, height: 100 })
win.contentView.addChildView(view)
```
## Class: View
> A basic native view.
Process: [Main](../glossary.md#main-process)
`View` is an [EventEmitter][event-emitter].
### `new View()`
Creates a new `View`.
### Instance Events
Objects created with `new View` emit the following events:
#### Event: 'bounds-changed'
Emitted when the view's bounds have changed in response to being laid out. The
new bounds can be retrieved with [`view.getBounds()`](#viewgetbounds).
### Instance Methods
Objects created with `new View` have the following instance methods:
#### `view.addChildView(view[, index])`
* `view` View - Child view to add.
* `index` Integer (optional) - Index at which to insert the child view.
Defaults to adding the child at the end of the child list.
#### `view.removeChildView(view)`
* `view` View - Child view to remove.
#### `view.setBounds(bounds)`
* `bounds` [Rectangle](structures/rectangle.md) - New bounds of the View.
#### `view.getBounds()`
Returns [`Rectangle`](structures/rectangle.md) - The bounds of this View, relative to its parent.
#### `view.setBackgroundColor(color)`
* `color` string - Color in Hex, RGB, ARGB, HSL, HSLA or named CSS color format. The alpha channel is
optional for the hex type.
Examples of valid `color` values:
* Hex
* `#fff` (RGB)
* `#ffff` (ARGB)
* `#ffffff` (RRGGBB)
* `#ffffffff` (AARRGGBB)
* RGB
* `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)`
* e.g. `rgb(255, 255, 255)`
* RGBA
* `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)`
* e.g. `rgba(255, 255, 255, 1.0)`
* HSL
* `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)`
* e.g. `hsl(200, 20%, 50%)`
* HSLA
* `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)`
* e.g. `hsla(200, 20%, 50%, 0.5)`
* Color name
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
* Similar to CSS Color Module Level 3 keywords, but case-sensitive.
* e.g. `blueviolet` or `red`
**Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
#### `view.setVisible(visible)`
* `visible` boolean - If false, the view will be hidden from display.
### Instance Properties
Objects created with `new View` have the following properties:
#### `view.children` _Readonly_
A `View[]` property representing the child views of this view.
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter

View File

@@ -1,58 +0,0 @@
# WebContentsView
> A View that displays a WebContents.
Process: [Main](../glossary.md#main-process)
This module cannot be used until the `ready` event of the `app`
module is emitted.
```js
const { BaseWindow, WebContentsView } = require('electron')
const win = new BaseWindow({ width: 800, height: 400 })
const view1 = new WebContentsView()
win.contentView.addChildView(view1)
view1.webContents.loadURL('https://electronjs.org')
view1.setBounds({ x: 0, y: 0, width: 400, height: 400 })
const view2 = new WebContentsView()
win.contentView.addChildView(view2)
view2.webContents.loadURL('https://github.com/electron/electron')
view2.setBounds({ x: 400, y: 0, width: 400, height: 400 })
```
## Class: WebContentsView extends `View`
> A View that displays a WebContents.
Process: [Main](../glossary.md#main-process)
`WebContentsView` inherits from [`View`](view.md).
`WebContentsView` is an [EventEmitter][event-emitter].
### `new WebContentsView([options])`
* `options` Object (optional)
* `webPreferences` [WebPreferences](structures/web-preferences.md) (optional) - Settings of web page's features.
Creates an empty WebContentsView.
### Instance Properties
Objects created with `new WebContentsView` have the following properties, in
addition to those inherited from [View](view.md):
#### `view.webContents` _Readonly_
A `WebContents` property containing a reference to the displayed `WebContents`.
Use this to interact with the `WebContents`, for instance to load a URL.
```js
const { WebContentsView } = require('electron')
const view = new WebContentsView()
view.webContents.loadURL('https://electronjs.org/')
```
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter

View File

@@ -9,7 +9,7 @@ It is responsible for rendering and controlling a web page and is a property of
the [`BrowserWindow`](browser-window.md) object. An example of accessing the the [`BrowserWindow`](browser-window.md) object. An example of accessing the
`webContents` object: `webContents` object:
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow({ width: 800, height: 1500 }) const win = new BrowserWindow({ width: 800, height: 1500 })
@@ -53,7 +53,7 @@ If you want to also observe navigations in `<iframe>`s, use [`will-frame-navigat
These methods can be accessed from the `webContents` module: These methods can be accessed from the `webContents` module:
```js ```javascript
const { webContents } = require('electron') const { webContents } = require('electron')
console.log(webContents) console.log(webContents)
``` ```
@@ -439,7 +439,7 @@ Emitted when a `beforeunload` event handler is attempting to cancel a page unloa
Calling `event.preventDefault()` will ignore the `beforeunload` event handler Calling `event.preventDefault()` will ignore the `beforeunload` event handler
and allow the page to be unloaded. and allow the page to be unloaded.
```js ```javascript
const { BrowserWindow, dialog } = require('electron') const { BrowserWindow, dialog } = require('electron')
const win = new BrowserWindow({ width: 800, height: 600 }) const win = new BrowserWindow({ width: 800, height: 600 })
win.webContents.on('will-prevent-unload', (event) => { win.webContents.on('will-prevent-unload', (event) => {
@@ -460,6 +460,20 @@ win.webContents.on('will-prevent-unload', (event) => {
**Note:** This will be emitted for `BrowserViews` but will _not_ be respected - this is because we have chosen not to tie the `BrowserView` lifecycle to its owning BrowserWindow should one exist per the [specification](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event). **Note:** This will be emitted for `BrowserViews` but will _not_ be respected - this is because we have chosen not to tie the `BrowserView` lifecycle to its owning BrowserWindow should one exist per the [specification](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event).
#### Event: 'crashed' _Deprecated_
Returns:
* `event` Event
* `killed` boolean
Emitted 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. The `killed` boolean can be replaced by
checking `reason === 'killed'` when you switch to that event.
#### Event: 'render-process-gone' #### Event: 'render-process-gone'
Returns: Returns:
@@ -527,7 +541,7 @@ and the menu shortcuts.
To only prevent the menu shortcuts, use To only prevent the menu shortcuts, use
[`setIgnoreMenuShortcuts`](#contentssetignoremenushortcutsignore): [`setIgnoreMenuShortcuts`](#contentssetignoremenushortcutsignore):
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow({ width: 800, height: 600 }) const win = new BrowserWindow({ width: 800, height: 600 })
@@ -582,15 +596,6 @@ Returns:
Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu. Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu.
#### Event: 'devtools-search-query'
Returns:
* `event` Event
* `query` string - text to query for.
Emitted when 'Search' is selected for text in its context menu.
#### Event: 'devtools-opened' #### Event: 'devtools-opened'
Emitted when DevTools is opened. Emitted when DevTools is opened.
@@ -778,15 +783,9 @@ Returns:
word and spellchecker is enabled. word and spellchecker is enabled.
* `frameCharset` string - The character encoding of the frame on which the * `frameCharset` string - The character encoding of the frame on which the
menu was invoked. menu was invoked.
* `formControlType` string - The source that the context menu was invoked on. * `inputFieldType` string - If the context menu was invoked on an input
Possible values include `none`, `button-button`, `field-set`, field, the type of that field. Possible values include `none`, `plainText`,
`input-button`, `input-checkbox`, `input-color`, `input-date`, `password`, `other`.
`input-datetime-local`, `input-email`, `input-file`, `input-hidden`,
`input-image`, `input-month`, `input-number`, `input-password`, `input-radio`,
`input-range`, `input-reset`, `input-search`, `input-submit`, `input-telephone`,
`input-text`, `input-time`, `input-url`, `input-week`, `output`, `reset-button`,
`select-list`, `select-list`, `select-multiple`, `select-one`, `submit-button`,
and `text-area`,
* `spellcheckEnabled` boolean - If the context is editable, whether or not spellchecking is enabled. * `spellcheckEnabled` boolean - If the context is editable, whether or not spellchecking is enabled.
* `menuSourceType` string - Input source that invoked the context menu. * `menuSourceType` string - Input source that invoked the context menu.
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`. Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.
@@ -843,7 +842,7 @@ Due to the nature of bluetooth, scanning for devices when
`select-bluetooth-device` to fire multiple times until `callback` is called `select-bluetooth-device` to fire multiple times until `callback` is called
with either a device id or an empty string to cancel the request. with either a device id or an empty string to cancel the request.
```js title='main.js' ```javascript title='main.js'
const { app, BrowserWindow } = require('electron') const { app, BrowserWindow } = require('electron')
let win = null let win = null
@@ -878,7 +877,7 @@ Returns:
Emitted when a new frame is generated. Only the dirty area is passed in the Emitted when a new frame is generated. Only the dirty area is passed in the
buffer. buffer.
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow({ webPreferences: { offscreen: true } }) const win = new BrowserWindow({ webPreferences: { offscreen: true } })
@@ -1010,7 +1009,7 @@ Loads the `url` in the window. The `url` must contain the protocol prefix,
e.g. the `http://` or `file://`. If the load should bypass http cache then e.g. the `http://` or `file://`. If the load should bypass http cache then
use the `pragma` header to achieve it. use the `pragma` header to achieve it.
```js ```javascript
const win = new BrowserWindow() const win = new BrowserWindow()
const options = { extraHeaders: 'pragma: no-cache\n' } const options = { extraHeaders: 'pragma: no-cache\n' }
win.webContents.loadURL('https://github.com', options) win.webContents.loadURL('https://github.com', options)
@@ -1060,7 +1059,7 @@ Initiates a download of the resource at `url` without navigating. The
Returns `string` - The URL of the current web page. Returns `string` - The URL of the current web page.
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow({ width: 800, height: 600 }) const win = new BrowserWindow({ width: 800, height: 600 })
win.loadURL('https://github.com').then(() => { win.loadURL('https://github.com').then(() => {
@@ -1509,7 +1508,7 @@ 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`. Stops any `findInPage` request for the `webContents` with the provided `action`.
```js ```javascript
const win = new BrowserWindow() const win = new BrowserWindow()
win.webContents.on('found-in-page', (event, result) => { win.webContents.on('found-in-page', (event, result) => {
if (result.finalUpdate) win.webContents.stopFindInPage('clearSelection') if (result.finalUpdate) win.webContents.stopFindInPage('clearSelection')
@@ -1619,8 +1618,6 @@ win.webContents.print(options, (success, errorType) => {
* `headerTemplate` string (optional) - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: `date` (formatted print date), `title` (document title), `url` (document location), `pageNumber` (current page number) and `totalPages` (total pages in the document). For example, `<span class=title></span>` would generate span containing the title. * `headerTemplate` string (optional) - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: `date` (formatted print date), `title` (document title), `url` (document location), `pageNumber` (current page number) and `totalPages` (total pages in the document). For example, `<span class=title></span>` would generate span containing the title.
* `footerTemplate` string (optional) - HTML template for the print footer. Should use the same format as the `headerTemplate`. * `footerTemplate` string (optional) - HTML template for the print footer. Should use the same format as the `headerTemplate`.
* `preferCSSPageSize` boolean (optional) - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size. * `preferCSSPageSize` boolean (optional) - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.
* `generateTaggedPDF` boolean (optional) _Experimental_ - Whether or not to generate a tagged (accessible) PDF. Defaults to false. As this property is experimental, the generated PDF may not adhere fully to PDF/UA and WCAG standards.
* `generateDocumentOutline` boolean (optional) _Experimental_ - Whether or not to generate a PDF document outline from content headers. Defaults to false.
Returns `Promise<Buffer>` - Resolves with the generated PDF data. Returns `Promise<Buffer>` - Resolves with the generated PDF data.
@@ -1630,27 +1627,25 @@ The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
An example of `webContents.printToPDF`: An example of `webContents.printToPDF`:
```js ```javascript
const { app, BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const fs = require('node:fs') const fs = require('node:fs')
const path = require('node:path') const path = require('node:path')
const os = require('node:os') const os = require('node:os')
app.whenReady().then(() => { const win = new BrowserWindow()
const win = new BrowserWindow() win.loadURL('https://github.com')
win.loadURL('https://github.com')
win.webContents.on('did-finish-load', () => { win.webContents.on('did-finish-load', () => {
// Use default printing options // Use default printing options
const pdfPath = path.join(os.homedir(), 'Desktop', 'temp.pdf') const pdfPath = path.join(os.homedir(), 'Desktop', 'temp.pdf')
win.webContents.printToPDF({}).then(data => { win.webContents.printToPDF({}).then(data => {
fs.writeFile(pdfPath, data, (error) => { fs.writeFile(pdfPath, data, (error) => {
if (error) throw error if (error) throw error
console.log(`Wrote PDF successfully to ${pdfPath}`) console.log(`Wrote PDF successfully to ${pdfPath}`)
})
}).catch(error => {
console.log(`Failed to write PDF to ${pdfPath}: `, error)
}) })
}).catch(error => {
console.log(`Failed to write PDF to ${pdfPath}: `, error)
}) })
}) })
``` ```
@@ -1664,7 +1659,7 @@ See [Page.printToPdf](https://chromedevtools.github.io/devtools-protocol/tot/Pag
Adds the specified path to DevTools workspace. Must be used after DevTools Adds the specified path to DevTools workspace. Must be used after DevTools
creation: creation:
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow() const win = new BrowserWindow()
win.webContents.on('devtools-opened', () => { win.webContents.on('devtools-opened', () => {
@@ -1987,7 +1982,7 @@ the cursor when dragging.
Returns `Promise<void>` - resolves if the page is saved. Returns `Promise<void>` - resolves if the page is saved.
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
const win = new BrowserWindow() const win = new BrowserWindow()
@@ -2065,24 +2060,6 @@ Setting the WebRTC IP handling policy allows you to control which IPs are
exposed via WebRTC. See [BrowserLeaks](https://browserleaks.com/webrtc) for exposed via WebRTC. See [BrowserLeaks](https://browserleaks.com/webrtc) for
more details. more details.
#### `contents.getWebRTCUDPPortRange()`
Returns `Object`:
* `min` Integer - The minimum UDP port number that WebRTC should use.
* `max` Integer - The maximum UDP port number that WebRTC should use.
By default this value is `{ min: 0, max: 0 }` , which would apply no restriction on the udp port range.
#### `contents.setWebRTCUDPPortRange(udpPortRange)`
* `udpPortRange` Object
* `min` Integer - The minimum UDP port number that WebRTC should use.
* `max` Integer - The maximum UDP port number that WebRTC should use.
Setting the WebRTC UDP Port Range allows you to restrict the udp port range used by WebRTC. By default the port range is unrestricted.
**Note:** To reset to an unrestricted port range this value should be set to `{ min: 0, max: 0 }`.
#### `contents.getMediaSourceId(requestWebContents)` #### `contents.getMediaSourceId(requestWebContents)`
* `requestWebContents` WebContents - Web contents that the id will be registered to. * `requestWebContents` WebContents - Web contents that the id will be registered to.

View File

@@ -8,7 +8,7 @@ The `webFrameMain` module can be used to lookup frames across existing
[`WebContents`](web-contents.md) instances. Navigation events are the common [`WebContents`](web-contents.md) instances. Navigation events are the common
use case. use case.
```js ```javascript
const { BrowserWindow, webFrameMain } = require('electron') const { BrowserWindow, webFrameMain } = require('electron')
const win = new BrowserWindow({ width: 800, height: 1500 }) const win = new BrowserWindow({ width: 800, height: 1500 })
@@ -29,7 +29,7 @@ win.webContents.on(
You can also access frames of existing pages by using the `mainFrame` property You can also access frames of existing pages by using the `mainFrame` property
of [`WebContents`](web-contents.md). of [`WebContents`](web-contents.md).
```js ```javascript
const { BrowserWindow } = require('electron') const { BrowserWindow } = require('electron')
async function main () { async function main () {

View File

@@ -10,7 +10,7 @@ certain properties and methods (e.g. `webFrame.firstChild`).
An example of zooming current page to 200%. An example of zooming current page to 200%.
```js ```javascript
const { webFrame } = require('electron') const { webFrame } = require('electron')
webFrame.setZoomFactor(2) webFrame.setZoomFactor(2)
@@ -96,7 +96,7 @@ with an array of misspelt words when complete.
An example of using [node-spellchecker][spellchecker] as provider: An example of using [node-spellchecker][spellchecker] as provider:
```js @ts-expect-error=[2,6] ```javascript @ts-expect-error=[2,6]
const { webFrame } = require('electron') const { webFrame } = require('electron')
const spellChecker = require('spellchecker') const spellChecker = require('spellchecker')
webFrame.setSpellCheckProvider('en-US', { webFrame.setSpellCheckProvider('en-US', {
@@ -205,14 +205,14 @@ Returns `Object`:
Returns an object describing usage information of Blink's internal memory Returns an object describing usage information of Blink's internal memory
caches. caches.
```js ```javascript
const { webFrame } = require('electron') const { webFrame } = require('electron')
console.log(webFrame.getResourceUsage()) console.log(webFrame.getResourceUsage())
``` ```
This will generate: This will generate:
```js ```javascript
{ {
images: { images: {
count: 22, count: 22,

View File

@@ -23,7 +23,7 @@ called with a `response` object when `listener` has done its work.
An example of adding `User-Agent` header for requests: An example of adding `User-Agent` header for requests:
```js ```javascript
const { session } = require('electron') const { session } = require('electron')
// Modify the user agent for all requests to the following urls. // Modify the user agent for all requests to the following urls.

View File

@@ -1,26 +0,0 @@
# webUtils
> A utility layer to interact with Web API objects (Files, Blobs, etc.)
Process: [Renderer](../glossary.md#renderer-process)
## Methods
The `webUtils` module has the following methods:
### `webUtils.getPathForFile(file)`
* `file` File - A web [File](https://developer.mozilla.org/en-US/docs/Web/API/File) object.
Returns `string` - The file system path that this `File` object points to. In the case where the object passed in is not a `File` object an exception is thrown. In the case where the File object passed in was constructed in JS and is not backed by a file on disk an empty string is returned.
This method superceded the previous augmentation to the `File` object with the `path` property. An example is included below.
```js
// Before
const oldPath = document.querySelector('input').files[0].path
// After
const { webUtils } = require('electron')
const newPath = webUtils.getPathForFile(document.querySelector('input').files[0])
```

View File

@@ -4,10 +4,9 @@
Electron's `webview` tag is based on [Chromium's `webview`][chrome-webview], which Electron's `webview` tag is based on [Chromium's `webview`][chrome-webview], which
is undergoing dramatic architectural changes. This impacts the stability of `webviews`, is undergoing dramatic architectural changes. This impacts the stability of `webviews`,
including rendering, navigation, and event routing. We currently recommend to including rendering, navigation, and event routing. We currently recommend to not
not use the `webview` tag and to consider alternatives, like `iframe`, a use the `webview` tag and to consider alternatives, like `iframe`, [Electron's `BrowserView`](browser-view.md),
[`WebContentsView`](web-contents-view.md), or an architecture that avoids or an architecture that avoids embedded content altogether.
embedded content altogether.
## Enabling ## Enabling
@@ -221,9 +220,7 @@ windows. Popups are disabled by default.
``` ```
A `string` which is a comma separated list of strings which specifies the web preferences to be set on the webview. A `string` which is a comma separated list of strings which specifies the web preferences to be set on the webview.
The full list of supported preference strings can be found in [BrowserWindow](browser-window.md#new-browserwindowoptions). In addition, webview supports the following preferences: The full list of supported preference strings can be found in [BrowserWindow](browser-window.md#new-browserwindowoptions).
* `transparent` boolean (optional) - Whether to enable background transparency for the guest page. Default is `true`. **Note:** The guest page's text and background colors are derived from the [color scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme) of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent.
The string follows the same format as the features string in `window.open`. The string follows the same format as the features string in `window.open`.
A name by itself is given a `true` boolean value. A name by itself is given a `true` boolean value.
@@ -258,7 +255,7 @@ The `webview` tag has the following methods:
**Example** **Example**
```js @ts-expect-error=[3] ```javascript @ts-expect-error=[3]
const webview = document.querySelector('webview') const webview = document.querySelector('webview')
webview.addEventListener('dom-ready', () => { webview.addEventListener('dom-ready', () => {
webview.openDevTools() webview.openDevTools()
@@ -610,8 +607,6 @@ Prints `webview`'s web page. Same as `webContents.print([options])`.
* `headerTemplate` string (optional) - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: `date` (formatted print date), `title` (document title), `url` (document location), `pageNumber` (current page number) and `totalPages` (total pages in the document). For example, `<span class=title></span>` would generate span containing the title. * `headerTemplate` string (optional) - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: `date` (formatted print date), `title` (document title), `url` (document location), `pageNumber` (current page number) and `totalPages` (total pages in the document). For example, `<span class=title></span>` would generate span containing the title.
* `footerTemplate` string (optional) - HTML template for the print footer. Should use the same format as the `headerTemplate`. * `footerTemplate` string (optional) - HTML template for the print footer. Should use the same format as the `headerTemplate`.
* `preferCSSPageSize` boolean (optional) - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size. * `preferCSSPageSize` boolean (optional) - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.
* `generateTaggedPDF` boolean (optional) _Experimental_ - Whether or not to generate a tagged (accessible) PDF. Defaults to false. As this property is experimental, the generated PDF may not adhere fully to PDF/UA and WCAG standards.
* `generateDocumentOutline` boolean (optional) _Experimental_ - Whether or not to generate a PDF document outline from content headers. Defaults to false.
Returns `Promise<Uint8Array>` - Resolves with the generated PDF data. Returns `Promise<Uint8Array>` - Resolves with the generated PDF data.
@@ -806,7 +801,7 @@ Fired when the guest window logs a console message.
The following example code forwards all log messages to the embedder's console The following example code forwards all log messages to the embedder's console
without regard for log level or other properties. without regard for log level or other properties.
```js @ts-expect-error=[3] ```javascript @ts-expect-error=[3]
const webview = document.querySelector('webview') const webview = document.querySelector('webview')
webview.addEventListener('console-message', (e) => { webview.addEventListener('console-message', (e) => {
console.log('Guest page logged a message:', e.message) console.log('Guest page logged a message:', e.message)
@@ -827,7 +822,7 @@ Returns:
Fired when a result is available for Fired when a result is available for
[`webview.findInPage`](#webviewfindinpagetext-options) request. [`webview.findInPage`](#webviewfindinpagetext-options) request.
```js @ts-expect-error=[3,6] ```javascript @ts-expect-error=[3,6]
const webview = document.querySelector('webview') const webview = document.querySelector('webview')
webview.addEventListener('found-in-page', (e) => { webview.addEventListener('found-in-page', (e) => {
webview.stopFindInPage('keepSelection') webview.stopFindInPage('keepSelection')
@@ -952,7 +947,7 @@ Fired when the guest page attempts to close itself.
The following example code navigates the `webview` to `about:blank` when the The following example code navigates the `webview` to `about:blank` when the
guest attempts to close itself. guest attempts to close itself.
```js @ts-expect-error=[3] ```javascript @ts-expect-error=[3]
const webview = document.querySelector('webview') const webview = document.querySelector('webview')
webview.addEventListener('close', () => { webview.addEventListener('close', () => {
webview.src = 'about:blank' webview.src = 'about:blank'
@@ -972,7 +967,7 @@ Fired when the guest page has sent an asynchronous message to embedder page.
With `sendToHost` method and `ipc-message` event you can communicate With `sendToHost` method and `ipc-message` event you can communicate
between guest page and embedder page: between guest page and embedder page:
```js @ts-expect-error=[4,7] ```javascript @ts-expect-error=[4,7]
// In embedder page. // In embedder page.
const webview = document.querySelector('webview') const webview = document.querySelector('webview')
webview.addEventListener('ipc-message', (event) => { webview.addEventListener('ipc-message', (event) => {
@@ -982,7 +977,7 @@ webview.addEventListener('ipc-message', (event) => {
webview.send('ping') webview.send('ping')
``` ```
```js ```javascript
// In guest page. // In guest page.
const { ipcRenderer } = require('electron') const { ipcRenderer } = require('electron')
ipcRenderer.on('ping', () => { ipcRenderer.on('ping', () => {
@@ -990,6 +985,14 @@ ipcRenderer.on('ping', () => {
}) })
``` ```
### Event: 'crashed' _Deprecated_
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' ### Event: 'render-process-gone'
Returns: Returns:
@@ -1048,15 +1051,6 @@ Returns:
Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu. Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu.
#### Event: 'devtools-search-query'
Returns:
* `event` Event
* `query` string - text to query for.
Emitted when 'Search' is selected for text in its context menu.
### Event: 'devtools-opened' ### Event: 'devtools-opened'
Emitted when DevTools is opened. Emitted when DevTools is opened.
@@ -1111,15 +1105,9 @@ Returns:
word and spellchecker is enabled. word and spellchecker is enabled.
* `frameCharset` string - The character encoding of the frame on which the * `frameCharset` string - The character encoding of the frame on which the
menu was invoked. menu was invoked.
* `formControlType` string - The source that the context menu was invoked on. * `inputFieldType` string - If the context menu was invoked on an input
Possible values include `none`, `button-button`, `field-set`, field, the type of that field. Possible values include `none`, `plainText`,
`input-button`, `input-checkbox`, `input-color`, `input-date`, `password`, `other`.
`input-datetime-local`, `input-email`, `input-file`, `input-hidden`,
`input-image`, `input-month`, `input-number`, `input-password`, `input-radio`,
`input-range`, `input-reset`, `input-search`, `input-submit`, `input-telephone`,
`input-text`, `input-time`, `input-url`, `input-week`, `output`, `reset-button`,
`select-list`, `select-list`, `select-multiple`, `select-one`, `submit-button`,
and `text-area`,
* `spellcheckEnabled` boolean - If the context is editable, whether or not spellchecking is enabled. * `spellcheckEnabled` boolean - If the context is editable, whether or not spellchecking is enabled.
* `menuSourceType` string - Input source that invoked the context menu. * `menuSourceType` string - Input source that invoked the context menu.
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`. Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.

View File

@@ -80,7 +80,7 @@ window will not close when the opener window closes. The default value is `false
### Native `Window` example ### Native `Window` example
```js ```javascript
// main.js // main.js
const mainWindow = new BrowserWindow() const mainWindow = new BrowserWindow()
@@ -104,7 +104,7 @@ mainWindow.webContents.setWindowOpenHandler(({ url }) => {
}) })
``` ```
```js ```javascript
// renderer process (mainWindow) // renderer process (mainWindow)
const childWindow = window.open('', 'modal') const childWindow = window.open('', 'modal')
childWindow.document.write('<h1>Hello</h1>') childWindow.document.write('<h1>Hello</h1>')

View File

@@ -12,208 +12,6 @@ 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. * **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. * **Removed:** An API or feature was removed, and is no longer supported by Electron.
## Planned Breaking API Changes (30.0)
### Behavior Changed: cross-origin iframes now use Permission Policy to access features
Cross-origin iframes must now specify features available to a given `iframe` via the `allow`
attribute in order to access them.
See [documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#allow) for
more information.
### Removed: The `--disable-color-correct-rendering` switch
This switch was never formally documented but it's removal is being noted here regardless. Chromium itself now has better support for color spaces so this flag should not be needed.
### Behavior Changed: `BrowserView.setAutoResize` behavior on macOS
In Electron 30, BrowserView is now a wrapper around the new [WebContentsView](api/web-contents-view.md) API.
Previously, the `setAutoResize` function of the `BrowserView` API was backed by [autoresizing](https://developer.apple.com/documentation/appkit/nsview/1483281-autoresizingmask?language=objc) on macOS, and by a custom algorithm on Windows and Linux.
For simple use cases such as making a BrowserView fill the entire window, the behavior of these two approaches was identical.
However, in more advanced cases, BrowserViews would be autoresized differently on macOS than they would be on other platforms, as the custom resizing algorithm for Windows and Linux did not perfectly match the behavior of macOS's autoresizing API.
The autoresizing behavior is now standardized across all platforms.
If your app uses `BrowserView.setAutoResize` to do anything more complex than making a BrowserView fill the entire window, it's likely you already had custom logic in place to handle this difference in behavior on macOS.
If so, that logic will no longer be needed in Electron 30 as autoresizing behavior is consistent.
### Removed: `params.inputFormType` property on `context-menu` on `WebContents`
The `inputFormType` property of the params object in the `context-menu`
event from `WebContents` has been removed. Use the new `formControlType`
property instead.
### Removed: `process.getIOCounters()`
Chromium has removed access to this information.
## Planned Breaking API Changes (29.0)
### Behavior Changed: `ipcRenderer` can no longer be sent over the `contextBridge`
Attempting to send the entire `ipcRenderer` module as an object over the `contextBridge` will now result in
an empty object on the receiving side of the bridge. This change was made to remove / mitigate
a security footgun. You should not directly expose ipcRenderer or its methods over the bridge.
Instead, provide a safe wrapper like below:
```js
contextBridge.exposeInMainWorld('app', {
onEvent: (cb) => ipcRenderer.on('foo', (e, ...args) => cb(args))
})
```
### Removed: `renderer-process-crashed` event on `app`
The `renderer-process-crashed` event on `app` has been removed.
Use the new `render-process-gone` event instead.
```js
// Removed
app.on('renderer-process-crashed', (event, webContents, killed) => { /* ... */ })
// Replace with
app.on('render-process-gone', (event, webContents, details) => { /* ... */ })
```
### Removed: `crashed` event on `WebContents` and `<webview>`
The `crashed` events on `WebContents` and `<webview>` have been removed.
Use the new `render-process-gone` event instead.
```js
// Removed
win.webContents.on('crashed', (event, killed) => { /* ... */ })
webview.addEventListener('crashed', (event) => { /* ... */ })
// Replace with
win.webContents.on('render-process-gone', (event, details) => { /* ... */ })
webview.addEventListener('render-process-gone', (event) => { /* ... */ })
```
### Removed: `gpu-process-crashed` event on `app`
The `gpu-process-crashed` event on `app` has been removed.
Use the new `child-process-gone` event instead.
```js
// Removed
app.on('gpu-process-crashed', (event, killed) => { /* ... */ })
// Replace with
app.on('child-process-gone', (event, details) => { /* ... */ })
```
## Planned Breaking API Changes (28.0)
### Behavior Changed: `WebContents.backgroundThrottling` set to false affects all `WebContents` in the host `BrowserWindow`
`WebContents.backgroundThrottling` set to false will disable frames throttling
in the `BrowserWindow` for all `WebContents` displayed by it.
### Removed: `BrowserWindow.setTrafficLightPosition(position)`
`BrowserWindow.setTrafficLightPosition(position)` has been removed, the
`BrowserWindow.setWindowButtonPosition(position)` API should be used instead
which accepts `null` instead of `{ x: 0, y: 0 }` to reset the position to
system default.
```js
// Removed in Electron 28
win.setTrafficLightPosition({ x: 10, y: 10 })
win.setTrafficLightPosition({ x: 0, y: 0 })
// Replace with
win.setWindowButtonPosition({ x: 10, y: 10 })
win.setWindowButtonPosition(null)
```
### Removed: `BrowserWindow.getTrafficLightPosition()`
`BrowserWindow.getTrafficLightPosition()` has been removed, the
`BrowserWindow.getWindowButtonPosition()` API should be used instead
which returns `null` instead of `{ x: 0, y: 0 }` when there is no custom
position.
```js
// Removed in Electron 28
const pos = win.getTrafficLightPosition()
if (pos.x === 0 && pos.y === 0) {
// No custom position.
}
// Replace with
const ret = win.getWindowButtonPosition()
if (ret === null) {
// No custom position.
}
```
### Removed: `ipcRenderer.sendTo()`
The `ipcRenderer.sendTo()` API has been removed. It should be replaced by setting up a [`MessageChannel`](tutorial/message-ports.md#setting-up-a-messagechannel-between-two-renderers) between the renderers.
The `senderId` and `senderIsMainFrame` properties of `IpcRendererEvent` have been removed as well.
### Removed: `app.runningUnderRosettaTranslation`
The `app.runningUnderRosettaTranslation` property has been removed.
Use `app.runningUnderARM64Translation` instead.
```js
// Removed
console.log(app.runningUnderRosettaTranslation)
// Replace with
console.log(app.runningUnderARM64Translation)
```
### Deprecated: `renderer-process-crashed` event on `app`
The `renderer-process-crashed` event on `app` has been deprecated.
Use the new `render-process-gone` event instead.
```js
// Deprecated
app.on('renderer-process-crashed', (event, webContents, killed) => { /* ... */ })
// Replace with
app.on('render-process-gone', (event, webContents, details) => { /* ... */ })
```
### Deprecated: `params.inputFormType` property on `context-menu` on `WebContents`
The `inputFormType` property of the params object in the `context-menu`
event from `WebContents` has been deprecated. Use the new `formControlType`
property instead.
### Deprecated: `crashed` event on `WebContents` and `<webview>`
The `crashed` events on `WebContents` and `<webview>` have been deprecated.
Use the new `render-process-gone` event instead.
```js
// Deprecated
win.webContents.on('crashed', (event, killed) => { /* ... */ })
webview.addEventListener('crashed', (event) => { /* ... */ })
// Replace with
win.webContents.on('render-process-gone', (event, details) => { /* ... */ })
webview.addEventListener('render-process-gone', (event) => { /* ... */ })
```
### Deprecated: `gpu-process-crashed` event on `app`
The `gpu-process-crashed` event on `app` has been deprecated.
Use the new `child-process-gone` event instead.
```js
// Deprecated
app.on('gpu-process-crashed', (event, killed) => { /* ... */ })
// Replace with
app.on('child-process-gone', (event, details) => { /* ... */ })
```
## Planned Breaking API Changes (27.0) ## Planned Breaking API Changes (27.0)
### Removed: macOS 10.13 / 10.14 support ### Removed: macOS 10.13 / 10.14 support
@@ -247,18 +45,6 @@ systemPreferences.on('high-contrast-color-scheme-changed', () => { /* ... */ })
nativeTheme.on('updated', () => { /* ... */ }) nativeTheme.on('updated', () => { /* ... */ })
``` ```
### Removed: Some `window.setVibrancy` options on macOS
The following vibrancy options have been removed:
* 'light'
* 'medium-light'
* 'dark'
* 'ultra-dark'
* 'appearance-based'
These were previously deprecated and have been removed by Apple in 10.15.
### Removed: `webContents.getPrinters` ### Removed: `webContents.getPrinters`
The `webContents.getPrinters` method has been removed. Use The `webContents.getPrinters` method has been removed. Use
@@ -638,7 +424,7 @@ The `new-window` event of `<webview>` has been removed. There is no direct repla
webview.addEventListener('new-window', (event) => {}) webview.addEventListener('new-window', (event) => {})
``` ```
```js ```javascript fiddle='docs/fiddles/ipc/webview-new-window'
// Replace with // Replace with
// main.js // main.js
@@ -1303,7 +1089,7 @@ module](https://medium.com/@nornagon/electrons-remote-module-considered-harmful-
The APIs are now synchronous and the optional callback is no longer needed. The APIs are now synchronous and the optional callback is no longer needed.
```js ```javascript
// Deprecated // Deprecated
protocol.unregisterProtocol(scheme, () => { /* ... */ }) protocol.unregisterProtocol(scheme, () => { /* ... */ })
// Replace with // Replace with
@@ -1332,7 +1118,7 @@ protocol.unregisterProtocol(scheme)
The APIs are now synchronous and the optional callback is no longer needed. The APIs are now synchronous and the optional callback is no longer needed.
```js ```javascript
// Deprecated // Deprecated
protocol.registerFileProtocol(scheme, handler, () => { /* ... */ }) protocol.registerFileProtocol(scheme, handler, () => { /* ... */ })
// Replace with // Replace with
@@ -1347,7 +1133,7 @@ until navigation happens.
This API is deprecated and users should use `protocol.isProtocolRegistered` This API is deprecated and users should use `protocol.isProtocolRegistered`
and `protocol.isProtocolIntercepted` instead. and `protocol.isProtocolIntercepted` instead.
```js ```javascript
// Deprecated // Deprecated
protocol.isProtocolHandled(scheme).then(() => { /* ... */ }) protocol.isProtocolHandled(scheme).then(() => { /* ... */ })
// Replace with // Replace with

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