Compare commits

...

112 Commits

Author SHA1 Message Date
trop[bot]
d4e22c97b2 build: combine dependent libc patch (#47521)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-06-23 14:40:04 +02:00
trop[bot]
6ce5f88940 build: update cache action to latest (#47520)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-06-23 14:39:56 +02:00
trop[bot]
cfa2efe0c2 feat: add support for --no-experimental-global-navigator (#47418)
chore: add support for --no-experimental-global-navigator

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-06-23 12:21:38 +02:00
electron-roller[bot]
221f5ee3d6 chore: bump chromium to 138.0.7204.35 (37-x-y) (#47504)
* chore: bump chromium in DEPS to 138.0.7204.35

* 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>
2025-06-19 18:47:59 -04:00
trop[bot]
2f1dfc73ac feat: support HIDDevice.collections (#47483)
* feat: support HIDDevice.collections

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

* Update docs/api/structures/hid-device.md

Co-authored-by: Erick Zhao <ezhao@slack-corp.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>
2025-06-18 20:47:06 +02:00
Niklas Wenzel
3ea4c6c3e7 fix: utilityProcess running user script after process.exit is called (#47492)
fix: utilityProcess running user script after process.exit is called (#47469)

* fix: utilityProcess running user script after process.exit is called

* docs: update breaking changes

* chore: update spec

* chore: update spec/api-utility-process-spec.ts



* chore: remove interface bound checks

---------

Co-authored-by: Robo <hop2deep@gmail.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-06-17 21:01:50 -05:00
electron-roller[bot]
5bd18aac95 chore: bump chromium to 138.0.7204.23 (37-x-y) (#47455)
* chore: bump chromium in DEPS to 138.0.7204.23

* chore: update patches

* test: fixup api-desktop-capturer-spec.ts for linux

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-06-17 11:38:13 -04:00
Keeley Hammond
03c32ba3be fix: revert moving IsClosed() and IsClosable() into NativeWindow::Close() (#47485)
fix: revert moving IsClosed() and IsClosable() into NativeWindow::Close() (#47482)

Revert "refactor: move `IsClosed()` and `IsClosable()` tests into `NativeWindow::Close()` (#46888)"

This reverts commit 3faddd5ae2.
2025-06-16 21:20:53 -07:00
trop[bot]
bef6e11b9d refactor: move gin::Converter<PreloadScript> impl to a .cc file (#47466)
refactor: move gin::Converter<PreloadScript> impl to a .cc file

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-06-16 11:10:01 -04:00
trop[bot]
f72ec2c45a refactor: have ShowSaveDialogSync() return a std::optional<base::FilePath> (#47453)
* refactor: have ShowSaveDialogSync() return a std::optional<base::FilePath>

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

* fixup! refactor: have ShowSaveDialogSync() return a std::optional<base::FilePath>

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>
2025-06-13 10:03:03 +02:00
trop[bot]
ba6f0358b0 docs: update remaining references to electron-quick-start (#47448)
* chore: udpate remaining references to electron-quick-start

Co-authored-by: Anny Yang <yangannyx@gmail.com>

* chore: Update docs/tutorial/tutorial-1-prerequisites.md

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

Co-authored-by: Anny Yang <anny@electronjs.org>

* chore: Update docs/tutorial/tutorial-3-preload.md

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

Co-authored-by: Anny Yang <anny@electronjs.org>

* chore: Update docs/tutorial/tutorial-2-first-app.md

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

Co-authored-by: Anny Yang <anny@electronjs.org>

* chore: linebreak

Co-authored-by: Anny Yang <yangannyx@gmail.com>

* chore: swap minimal-repro for npx create-electron-app

Co-authored-by: Anny Yang <yangannyx@gmail.com>

* chore: add back code commands

Co-authored-by: Anny Yang <yangannyx@gmail.com>

* chore: add whitespace

Co-authored-by: Anny Yang <yangannyx@gmail.com>

* chore: remove reference to repo containing old quick start

Co-authored-by: Anny Yang <yangannyx@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Anny Yang <yangannyx@gmail.com>
Co-authored-by: Anny Yang <anny@electronjs.org>
2025-06-12 12:25:24 +02:00
trop[bot]
2f4472f058 fix: crash calling Fetch.continueResponse with WebContentsView (#47444)
fix: crash calling Fetch.continueResponse with WebContentsView

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-06-11 12:25:18 -05:00
trop[bot]
32599dda44 docs: mention kwallet6 command line option (#47437)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-06-10 18:37:12 -05:00
trop[bot]
d2c95a28bb fix: add back fallback wasm-trap handling (#47345)
* fix: add back fallback wasm-trap handling

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

This change sets up wasm-trap handling for the case where content_shell
has not enabled crash reporting but moves the responsibility to
ElectronRendererClient. The default ContentRendererClient assumes
that crash reporting is enabled (crashpad enabled by default) and does
not set up its own handler.

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

* chore: fix build

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-06-10 18:02:14 +02:00
trop[bot]
e90404be7d docs: no class inheritance (#47433)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
2025-06-10 13:12:24 +02:00
trop[bot]
b494ae62ba feat: [net] add "priority" option to net.request (#47321)
document the default value of priority option

Update the priority test to not use the httpbin.org as server

Fixed the lint errors

Fixed the build error

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Zeeker <13848632+zeeker999@users.noreply.github.com>
2025-06-10 10:28:46 +02:00
electron-roller[bot]
5953dca8be chore: bump chromium to 138.0.7204.15 (37-x-y) (#46980)
* chore: bump chromium in DEPS to 138.0.7166.1

* chore: bump chromium in DEPS to 138.0.7166.2

* chore: bump chromium in DEPS to 138.0.7168.1

* chore: bump chromium in DEPS to 138.0.7169.2

* chore: bump chromium in DEPS to 138.0.7170.1

* chore: bump chromium in DEPS to 138.0.7172.1

* chore: bump chromium in DEPS to 138.0.7173.0

* chore: bump chromium in DEPS to 138.0.7175.0

* chore: bump chromium in DEPS to 138.0.7177.1

* chore: bump chromium in DEPS to 138.0.7178.2

* chore: bump chromium in DEPS to 138.0.7180.1

* chore: bump chromium in DEPS to 138.0.7181.0

* chore: bump chromium in DEPS to 138.0.7182.2

* chore: bump chromium in DEPS to 138.0.7184.0

* chore: bump chromium in DEPS to 138.0.7186.0

* chore: bump chromium in DEPS to 138.0.7188.0

* chore: bump chromium in DEPS to 138.0.7190.1

* chore: bump chromium in DEPS to 138.0.7192.0

* chore: bump chromium in DEPS to 138.0.7194.1

* chore: bump chromium in DEPS to 138.0.7196.1

* chore: bump chromium in DEPS to 138.0.7198.1

* chore: bump chromium in DEPS to 138.0.7200.0

* chore: bump chromium in DEPS to 138.0.7202.0

* chore: bump chromium in DEPS to 138.0.7204.0

* chore: bump chromium in DEPS to 138.0.7204.5

* chore: bump chromium in DEPS to 138.0.7204.4

* 6543986: Mac: decouple deserializing and applying sandbox policy

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

(cherry picked from commit d386063e9d2414a35c91c4fa017665d950de5882)

* 6566111: Change UtilityProcessHost to manage its instance internally
Refs https://chromium-review.googlesource.com/c/chromium/src/+/6566111

(cherry picked from commit 93a0a91d447c118de33efec079365f5d0e8363db)

* chore: update patches

* 6577970: Remove superfluous includes for base/strings/stringprintf.h in headers
Refs https://chromium-review.googlesource.com/c/chromium/src/+/6577970

(cherry picked from commit 9ba045f3715d85792e4aa12139e7e05e0b772634)

* 6568811: Add FunctionCall structured metrics event for DevTools
Refs https://chromium-review.googlesource.com/c/chromium/src/+/6568811

(cherry picked from commit 79ae6f2c8b53568b6277998cfe9a91e3a1ee595b)

* [PDF Ink Signatures] Support PdfAnnotationsEnabled policy

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

* Mac: Switch to Xcode 16.3 (16E140) and SDK 15.4 (24E241)

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

* chore: bump chromium in DEPS to 138.0.7204.15

* chore: update patches

* fixup Mac: decouple deserializing and applying sandbox policy

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

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-06-09 09:32:23 -04:00
trop[bot]
9f4b16fa81 fix: rework lifetime mgmt of ClearDataTask/ClearDataOperation (#47412)
* fix: rework lifetime mgmt of ClearDataTask/ClearDataOperation

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

* Update shell/browser/api/electron_api_session.cc

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

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

* Update shell/browser/api/electron_api_session.cc

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

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

* Update shell/browser/api/electron_api_session.cc

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

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

* Update shell/browser/api/electron_api_session.cc

Co-authored-by: Robo <hop2deep@gmail.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>
2025-06-08 12:56:35 +02:00
trop[bot]
a6569b116e fix: printing PDF via webContents.print() (#47398)
fix: printing PDF via webContents.print()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-06-08 12:56:02 +02:00
trop[bot]
dd0fb7d24d fix: silent printing of PDFs with webContents.print (#47397)
fix: silent printing

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-06-07 07:59:50 +02:00
trop[bot]
d657036a1b docs: remove electron-quick-start from README (#47387)
Refs https://github.com/electron/.permissions/pull/293

The repo was renamed to `minimal-repro` and is no longer intended to be used as a way to start new projects (see PR above).

Since we really want bugs in `electron/electron` to be reported with a Fiddle gist instead of a standalone repo (makes reproducing and bisecting sooo much easier and safer!), I removed the repo from the README completely instead of mentioning as an issue reproduction starting point.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-06-07 07:59:20 +02:00
John Kleinschmidt
b875976f04 build: cache gitcache dir (#47396)
build: cache gitcache dir (#47328)

* revert build: migrate to new chromium git auth

* build: cache gitcache dir
2025-06-07 07:59:03 +02:00
trop[bot]
f1f7bd631f docs: mention Azure Trusted Signing (#47384)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-06-05 20:11:30 +02:00
trop[bot]
08e27c02ea docs: Add Swift/macOS tutorial (#47381)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
2025-06-05 19:12:37 +02:00
John Kleinschmidt
8275e86f0a chore: update patches (#47382) 2025-06-05 10:51:39 -04:00
trop[bot]
3fdb77abf1 feat: allow intercepting mouse events (#47364)
* feat: allow intercepting mouse events

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

* test: add specs

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

* Update spec/api-web-contents-spec.ts

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>
2025-06-05 15:47:42 +02:00
trop[bot]
2e2d1f1612 feat: expose win.isContentProtected() (#47310)
* feat: expose win.isContentProtected()

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

* chore: remove stray _isContentProtected

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>
2025-06-05 15:46:57 +02:00
trop[bot]
c68389ad98 docs: update link to runAsNode fuse (#47376)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
2025-06-05 15:20:35 +02:00
trop[bot]
380351c01b fix: do not load source for electron module in ESM loader synchronous flow (#47342)
* fix: do not load electron from ESM loader's CJS compatibility

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

* chore: upgrade patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-06-05 10:04:11 +02:00
Keeley Hammond
c382d4c875 chore: cherry-pick 45eb42cd398e from v8 (#47356)
* chore: cherry-pick 45eb42cd398e from v8

* chore: update patches
2025-06-04 17:46:54 +02:00
Keeley Hammond
2fb2cc030d chore: cherry-pick f1e6422a355c from chromium (#47358)
* chore: cherry-pick f1e6422a355c from chromium

* chore: update patches
2025-06-04 17:38:39 +02:00
trop[bot]
1d8e9e1d52 fix: addChildView() crashes when adding a closed WebContentsView (#47338)
fix: addChildView() crashes when add a closed WebContentsView

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Sida Zhu <zhusida@bytedance.com>
2025-06-04 14:08:49 +02:00
electron-roller[bot]
bdcf09861e chore: bump node to v22.16.0 (37-x-y) (#47216) 2025-06-04 05:34:16 +02:00
Keeley Hammond
cd1afd6d9a chore: cherry-pick 1 changes from 1-M137 (#47352)
* chore: [37-x-y] cherry-pick 1 changes from 1-M137

* 7bc0a67ebfbf from v8

* chore: update patches
2025-06-04 01:28:18 +02:00
trop[bot]
ca22facaaf chore: bump chromium to 138.0.7190.0 (37-x-y) (#47349)
* chore: bump chromium in DEPS to 138.0.7180.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 6546797: Add a metric for the overall success of the "safe storage" item retrieval.

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

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

* 6548078: extensions: Fix TODO in ScriptInjectionTracker for desktop Android

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

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

* 6544950: Revert "FSA: Only normalize the hardcoded rules once during initialization"

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

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

* chore: bump chromium in DEPS to 138.0.7181.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

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

* fix: correctly clamp HSL shift values between 0 and 1

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

* chore: bump DEPS to 138.0.7183.0

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

* 6553142: Remove SelectFileDialogLinuxKde | https://chromium-review.googlesource.com/c/chromium/src/+/6553142

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

* chore: update patches

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

* chore: bump chromium in DEPS to 138.0.7184.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 138.0.7186.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 138.0.7190.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

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

* 6547778: Remove some superfluous //ui/gfx includes from //chrome headers | https://chromium-review.googlesource.com/c/chromium/src/+/6547778

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

* 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022

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

* fix: remove pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/4099130

This was removed 2 years ago in Chrome.

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* fix: provide BrowserContext to pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/6558173

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* fixup! 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* fix: pass in navigation throttle registry https://chromium-review.googlesource.com/c/chromium/src/+/6536175

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* fixup! 6556022: Reland "FSA: Only normalize the hardcoded rules once during initialization" | https://chromium-review.googlesource.com/c/chromium/src/+/6556022

This partially reverts commit 20d709dd15ba0ff332e24ee314149d642dc5d47c.

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

* 6545984: corner-shape: render dashed & dotted borders Refs https://chromium-review.googlesource.com/c/chromium/src/+/6545984

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* Update corner smoothing expected images

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

* Apply "future" revert commit to fix windows build

> Reason for revert: Multiple eng reporting that this is causing build failures due to too-long pathnames, with no immediate feasible workaround

This issue also affects our CI builds.

Problematic CL in current roll: 6494836: [webgl] Add stub WebGL[2]RenderingContextWebGPU | https://chromium-review.googlesource.com/c/chromium/src/+/6494836
"Future" revert CL: 6565622: Revert "[webgl] Add stub WebGL[2]RenderingContextWebGPU" | https://chromium-review.googlesource.com/c/chromium/src/+/6565622

This patch should automatically disappear when we roll the revert.

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

* 6533919: win: don't add WS_CAPTION style to popup windows https://chromium-review.googlesource.com/c/chromium/src/+/6533919

This mirrors the change made earlier to the code ours is based on: 6374074: [headless] Provide headless aware window metrics on Windows | https://chromium-review.googlesource.com/c/chromium/src/+/6374074

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

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-06-03 17:06:30 -04:00
trop[bot]
95212a539b docs: correct 'select-bluetooth-device' requirement (#47336)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-06-03 10:53:54 +02:00
trop[bot]
91c153ed0b fix: Squirrel.Mac crash when zip extraction fails (#47302)
* fix: Squirrel.Mac crash when zip extraction process fails to launch

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

* chore: add end-to-end test

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-05-30 10:46:12 -04:00
trop[bot]
ab78c8a295 docs: add documentation for ImageView (#47297)
* docs: Add documentation for ImageView

* docs: Add ImageView main process module list in README.md

* test: Add some basic tests for ImageView

* test: Fill out Window embedding tests to better reflect how someone might use an ImageView

* docs: Add notes about using ImageView as a splash screen



* docs: Update ImageView example to show a more complete splash screen example

* docs: Remove view resizing logic since the ImageView automatically gets resized

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Will Anderson <andersonw@dropbox.com>
2025-05-30 13:48:13 +02:00
trop[bot]
c2e8d71683 ci: add a problem matcher for ESLint output (#47305)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-30 11:00:37 +02:00
trop[bot]
47e0baf21d fix: regression with directory selection in macOS dialogs (#47277)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-05-27 11:17:32 -04:00
trop[bot]
f9b86609a9 fix: titlebar showing in content protected window (#47266)
Closes https://github.com/electron/electron/issues/47152.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-27 14:24:48 +02:00
trop[bot]
7dd024a9dc chore: debug crash on DevTools SetOwnerWindow (#47263)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-26 20:32:45 -07:00
trop[bot]
65b9accc80 build: migrate to new chromium git auth (#47255)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-05-26 10:06:40 +02:00
trop[bot]
584fa31adc chore: update @electron/lint-roller to 3.1.1 (#47257)
* chore: update @electron/lint-roller to 3.1.1

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

* docs: fix broken link in breaking-changes.md

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

* chore: fix for Node.js versions without require(esm)

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-26 09:45:48 +02:00
trop[bot]
c0149676fb refactor: use base::fixed_flat_set in NativeWindowViews::SetAlwaysOnTop() (#47237)
refactor: use base::fixed_flat_set in NativeWindowViews::SetAlwaysOnTop()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-25 07:56:50 -05:00
trop[bot]
b39305af61 ci: add problem matcher for patch conflict output (#47225)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-22 17:31:08 -04:00
trop[bot]
6e7271ff7e ci: add problem matcher for clang output (#47220)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-22 10:30:16 -07:00
trop[bot]
3e07a0e9a3 build: fix depot tool pathing on Windows (#47205)
build: properly set depot_tools pathing for Windows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-05-22 11:16:37 -04:00
trop[bot]
6a16fc3144 build(dev-deps): update @electron/lint-roller and markdownlint-cli2 (#47145)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-22 12:37:27 +02:00
trop[bot]
e53a7c7c00 fix: remove extra 'suspend'/'resume' handling from powerMonitor (#47188)
fix: remove extra 'suspend'/'resume' handling from powerMonitor

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-22 00:01:17 -05:00
trop[bot]
63052c45a1 refactor: prefer base::circular_deque over std::deque (#47192)
* refactor: use base::circular_deque in ResolveProxyHelper

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

* refactor: use base::circular_deque in GetExtraCrashKeys()

refactor: reduce visibility of kMaxCrashKeyValueSize

This change is to match Chromium's usage advice from
base/containers/README.md: `base:circular_deque` is preferred over
`std::deque` to provide consistent performance across platforms.

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>
2025-05-21 15:49:18 -05:00
trop[bot]
28c5f7026f refactor: make NativeWindow::transparent_ const (#47198)
* refactor: use in-class member initialization for NativeWindow::widget_

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

* refactor: make NativeWindow::transparent_ const

refactor: make NativeWindow::enable_larger_than_screen_ const

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

* chore: make linter happy after rebase

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>
2025-05-21 15:32:52 -05:00
trop[bot]
c78be76176 refactor: make NativeWindow::has_client_frame_ const (#47180)
* refactor: make NativeWindow::has_client_frame_ const

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

* refactor: make NativeWindow::has_client_frame_ const but not constexpr

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>
2025-05-21 11:44:36 +02:00
trop[bot]
73dd132202 refactor: match upstream macOS a11y handling (#47170)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-21 10:31:47 +02:00
trop[bot]
f6e7cdb8b6 refactor: make NativeWindow::pending_transitions_ a base::queue (#47181)
refactor: make NativeWindow::pending_transitions a base::queue

Follow the base/containers/README.md advice that "Chromium code should
always use `base::circular_deque` or `base::queue` in preference to
`std::deque` or `std::queue` due to memory usage and platform variation."

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-20 21:02:47 -05:00
trop[bot]
54f2c93fec build: update_depot_tools on initial install (#47169)
this ensures that python is setup for proper use from depot_tools

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-05-20 19:46:05 +02:00
trop[bot]
ecc00f149f fix: prevent gc monitor 2nd pass crash (#47165)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: reito <cnschwarzer@qq.com>
2025-05-20 11:55:54 -05:00
electron-roller[bot]
791235b15b chore: bump node to v22.15.1 (37-x-y) (#47104)
* chore: bump node in DEPS to v22.15.1

* chore: fixup patch indices

* src: fix error handling on async crypto operations

https://github.com/nodejs-private/node-private/pull/709

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-20 13:32:53 +02:00
trop[bot]
692d648edb refactor: NativeWindows should prefer widget() over GetWidget() for internal use (#47155)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-19 18:52:14 -05:00
trop[bot]
bbb6aabe41 fix: explicit microtask scope DCHECK condition (#47140)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-05-19 21:01:05 +02:00
trop[bot]
cc302c2f07 perf: don't create unused menuitem icons (#47129)
GTK >= 3.90.0 removed support for menuitem icons. When Electron is
built with GTK >= 3.90.0, our code builds these icons and then throws
them away unused. Instead, let's just not build them.

Our gtk_util::GdkPixbufFromSkBitmap utility uses BGRAToRGBA and is
expensive to call.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-16 08:47:16 -05:00
trop[bot]
b6779056f2 test: fix desktopCapturer mocha syntax (#47113)
do not nest `it` calls in desktopCapturer specs

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-16 02:32:22 -05:00
trop[bot]
d7990ca180 refactor: decouple NativeWindowViews and GlobalMenuBarX11 (#47119)
The GlobalMenuBar used to hold a raw_ptr reference to its NativeWindow;
but since it doesn't use it & only wants the gfx::AcceleratedWidget info,
let's remove the NativeWindowViews reference.

AFAICT, GlobalMenuBarX11::window_ has never been used

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-15 19:39:05 -05:00
trop[bot]
7cb5a46b66 refactor: make TrackableObject::weak_map_id() constexpr (#47115)
* refactor: make TrackableObject::weak_map_id() constexpr

refactor: make BaseWindow::GetID() inline and constexpr

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

* refactor: make NativeWindow::window_id() constexpr too

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>
2025-05-15 19:38:34 -05:00
trop[bot]
917e95433a docs: add note on DIP and DPI (#47121)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
2025-05-15 17:16:33 -05:00
trop[bot]
7db9671420 chore: bump chromium to 138.0.7178.0 (37-x-y) (#47106)
* chore: bump chromium in DEPS to 138.0.7178.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 6351556: [source-phase-imports] Support Wasm Source Phase Imports

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

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

* chore: update patches

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

* 6509682: extensions: Use ChromeExtensionsBrowserClient on desktop Android, part 2

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

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-15 16:47:39 -04:00
trop[bot]
a3d19d7a99 fix: opening package paths as directory on macOS (#47108)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-05-15 16:11:05 -04:00
trop[bot]
f1562543a3 feat: add support for --experimental-network-inspection (#47031)
* feat: add support for `--experimental-network-inspection`

Co-authored-by: Aman Karmani <aman@tmm1.net>

* docs: fix minor formatting issues

visible on both GH[1] and the docs site[2]

[1] https://github.com/electron/electron/blob/main/docs/api/command-line-switches.md#nodejs-flags
[2] https://www.electronjs.org/docs/latest/api/command-line-switches#--inspect-brkhostport

Co-authored-by: Aman Karmani <aman@tmm1.net>

* docs: add entry for new nodejs flag

Co-authored-by: Aman Karmani <aman@tmm1.net>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Aman Karmani <aman@tmm1.net>
2025-05-14 16:03:02 -05:00
trop[bot]
bf54b8d709 feat: enable innerWidth and innerHeight for window open (#47039)
feat: enable innerWidth and innerHeight for window open (#46749)

* feat: enable innerWidth and innerHeight for window open

* update comment for added special innerWidth and innerHeight

* update 100 min spec requirement handling

* update testing to include getContentSize

* update macOS min requirement handling

* adjust refactored consts

* update const values from nativewindowviews

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
2025-05-14 16:02:46 -05:00
trop[bot]
ec83c1303c feat: enable secondary label for macOS menu (#47042)
* feat: enable secondary label for macOS menu

Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>

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

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

Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>

* fix for lint

Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>

* update docs for sublabel

Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>
Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
2025-05-14 16:02:32 -05:00
trop[bot]
ec1b0f4923 refactor: remove CreateViewForWidget patch (#47084)
* refactor: remove CreateViewForWidget patch

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

* chore: rm unintended osr change

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-05-14 16:01:44 -05:00
trop[bot]
be5b02386d chore: bump chromium to 138.0.7177.0 (37-x-y) (#47085)
* chore: bump chromium in DEPS to 138.0.7177.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 6530423: [WebContents] Fix IsNeverComposited() calls during initialization

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

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

* 6512551: [ios] Enable -Wobjc-property-assign-on-object-type

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

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

* chore: update patches

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-14 13:55:23 -04:00
trop[bot]
df8ed0acc3 refactor: use kKeyModifiers in IsAltModifier() (#47089)
We probably didn't use this before because IsAltModifier() was written
two years before the KeyModifiers mask was added upstream in 98ec378a.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-14 12:53:59 -05:00
trop[bot]
8de0bb5bc3 chore: bump chromium to 138.0.7175.0 (37-x-y) (#47078)
* chore: bump chromium in DEPS to 138.0.7166.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 138.0.7166.2

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 6508373: Add WebContents, Tab getters for future Clank navigation capture rework

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

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

* 6470924: Introduce auto-populated Search Engine icons.

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

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

* 6502977: Force same tab navigation while actor coordinator is acting on a tab

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

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

* chore: bump chromium in DEPS to 138.0.7168.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

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

* fix grit patch

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

* chore: bump Chromium to 138.0.7169.2

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

* fixup! 6508373: Add WebContents, Tab getters for future Clank navigation capture rework

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

* 6493688: NavigationThrottleRunner2: void CreateThrottlesForNavigation

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

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

* 6488755: Reland "WebSQL: Remove WebPreference"

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

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

* 6428707: FSA: Only normalize the hardcoded rules once during initialization

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

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

* chore: fixup patch indices

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

* chore: bump chromium in DEPS to 138.0.7170.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 6514121: Remove origin calculation debug info and related methods

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

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

* chore: bump chromium in DEPS to 138.0.7172.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 138.0.7173.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 138.0.7175.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* fixup! 6514121: Remove origin calculation debug info and related methods

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

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

* 6531585: Don't retry LayerTreeSink creation on the high priority queue

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

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

* 6512253: Modernize base::apple's base bundle ID

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

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

* fixup! 6428707: FSA: Only normalize the hardcoded rules once during initialization

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

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

* fixup! 6508373: Add WebContents, Tab getters for future Clank navigation capture rework

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

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

* chore: update patches

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

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-14 10:07:45 -04:00
trop[bot]
25c7f0017a fix: white window flicker on window creation (#47051)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-11 15:00:11 -05:00
trop[bot]
546d9f4ba6 fix: webview crash on focus (#47036)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-09 17:46:53 -05:00
trop[bot]
434f77e6c1 docs: unify [!NOTE] structure (#47048)
* docs: unify [!NOTE] structure

Co-authored-by: Erick Zhao <ezhao@slack-corp.com>

* Update docs/api/command-line.md

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

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

* Update docs/api/browser-window.md

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

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

* Update docs/api/download-item.md

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

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

* Update docs/api/global-shortcut.md

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

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

* revert line break

Co-authored-by: Erick Zhao <ezhao@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2025-05-09 17:46:11 -05:00
trop[bot]
ace7ef4316 fix: restore previous Windows screenshotting (#47033)
Fixes https://github.com/electron/electron/issues/45990

We previously made a change in https://github.com/electron/electron/pull/45868
to fix content protection being lost on hide and re-show. However, this
cause a breaking change where protected windows were made opaque black
instead of being hidden as before. This overrides relevant methods in
ElectronDesktopWindowTreeHostWin to restore the previous behavior.
without regressing the original issue.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-09 13:10:44 -04:00
trop[bot]
0e9c0d8c04 fix: use-after-move of bus connection in xdg portal detection (#47023)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-05-09 09:39:17 -05:00
trop[bot]
8f37d42241 build: move release script to new hasher function (#46993)
build: move to new hasher function

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2025-05-09 09:38:19 +02:00
trop[bot]
3d836267ed refactor: use gin_helper::Dictionary::ValueOrDefault() (#47014)
refactor: use `gin_helper::Dictionary::ValueOrDefault()` (#46982)

* refactor: use ValueOrDefault() in electron_api_web_contents.cc

* refactor: use ValueOrDefault() in electron_api_url_loader.cc

* refactor: use ValueOrDefault() in electron_download_manager_delegate.cc

* refactor: use ValueOrDefault() in electron_touch_bar.mm

* refactor: use ValueOrDefault() in electron_url_loader_factory.cc

* refactor: use ValueOrDefault() in electron_browser_context.cc

* refactor: use ValueOrDefault() in electron_touch_bar.mm

* refactor: use ValueOrDefault() in blink_converter.cc

* feat: add ValueOrDefault() to PersistentDictionary

* empty commit

* refactor: use ValueOrDefault() in blink_converter.cc

* refactor: inline the rectangle base::Value::Dict

* refactor: remove has_scroll temporary

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-09 09:36:47 +02:00
trop[bot]
440cdec061 build: update hasher return value (#47011)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2025-05-09 09:36:35 +02:00
trop[bot]
4eea6e4974 build: remove deps_add_v8_object_setinternalfieldfornodecore.patch (#46998)
chore: remove deps_add_v8_object_setinternalfieldfornodecore.patch

This was a Node 20-specific workaround that's no longer needed in Node 22.

Xref: https://github.com/nodejs/node/pull/49874.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-08 15:34:41 -05:00
trop[bot]
2c6f713d72 refactor: reduce use of NativeWidgetPrivate (#47006)
* refactor: do not use native_widget_private() in NativeWindowViews::SetContentProtection()

refactor: do not use native_widget_private() in NativeWindowViews::IsContentProtected()

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

* refactor: do not use native_widget_private() in NativeWindowViews::Show()

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

* chore: remove native_widget_private #include from native_window_views_win

Not needed since Feb 2025: 9199d5c6

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>
2025-05-08 15:33:43 -05:00
trop[bot]
057437f739 test: enable hasShadow tests on Linux (#47001)
refactor: enable hasShadow tests on Linux

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-08 09:37:26 -05:00
trop[bot]
b59a7ef2c3 refactor: Node.js temporary "explicit" microtask policy scope pattern (#46991)
refactor: Node.js explicit microtask scope pattern

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-05-08 01:06:31 -05:00
trop[bot]
069c9a9e1f chore: bump chromium to 138.0.7165.0 (37-x-y) (#46985)
* chore: bump chromium in DEPS to 138.0.7165.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 6492127: Add new less invasive context menu mode for mobile interesttarget

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

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

* chore: fixup patch indices

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-07 20:01:39 -05:00
trop[bot]
5602efb2b6 fix: printing when no mediaSize specified (#46971)
fix: printing when no mediaSize specified

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-07 09:36:17 +02:00
trop[bot]
839590eb90 chore: bump chromium to 138.0.7164.0 (37-x-y) (#46964)
* chore: bump chromium in DEPS to 138.0.7164.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 6508870: Add missing PermissionType mapping and remove default case.

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

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

* chore: fixup patch indices

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-07 09:35:56 +02:00
trop[bot]
c9d1615b19 refactor: add gin_helper::Dictionary::ValueOrDefault() (#46969)
* feat: add gin_helper::Dictionary::ValueOrDefault()

A convenience function for using a default value if the
specified key isn't present in the dictionary.

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

* refactor: use ValueOrDefault() in native_window.cc

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

* refactor: use ValueOrDefault() in native_window_mac.mm

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

* refactor: use ValueOrDefault() in native_window_views.cc

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

* refactor: use ValueOrDefault() in electron_api_native_image.cc

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>
2025-05-06 19:11:30 -05:00
trop[bot]
4597f4ba9e refactor: pass gfx::ResizeEdge by value (#46960)
refactor: pass gfx::ResizeEdge by value

It is an enum class, so no reason to pass by reference

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-06 16:08:57 -05:00
trop[bot]
2cf774b2b8 test: test menu rendering accelerators (#46965)
* test: test menu rendering accelerators

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

* Update spec/api-menu-spec.ts

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

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>
2025-05-06 15:56:36 -05:00
trop[bot]
3029cdb4dd fix: crash on macOS dialog after window-all-closed (#46952)
fix: crash on dialog after window-all-closed

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-06 17:29:14 +02:00
trop[bot]
6bd6180703 fix: allowed dialog file types with one filter (#46946)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-06 16:10:25 +02:00
electron-roller[bot]
cd023b54f5 chore: bump node to v22.15.0 (37-x-y) (#46869)
* chore: bump node in DEPS to v22.15.0

* inspector: fix GN build

https://github.com/nodejs/node/pull/56798

* test: search cctest files

https://github.com/nodejs/node/pull/56791

* crypto: fix missing OPENSSL_NO_ENGINE guard

https://github.com/nodejs/node/pull/57012

* test,crypto: make tests work for BoringSSL

https://github.com/nodejs/node/pull/57021

* module: use synchronous hooks for preparsing in import(cjs)

https://github.com/nodejs/node/pull/55698

* deps: update simdjson to 3.12.0

https://github.com/nodejs/node/pull/56874

* build: remove explicit linker call to libm on macOS

https://github.com/nodejs/node/pull/56901

* test: make eval snapshot comparison more flexible

https://github.com/nodejs/node/pull/57020

* src: allow embedder customization of OOMErrorHandler

https://github.com/nodejs/node/pull/57325

* src: do not pass nullptr to std::string ctor

https://github.com/nodejs/node/pull/57354

* src: lock the isolate properly in IsolateData destructor

https://github.com/nodejs/node/pull/57031

* chore: shrink --trace-atomics-wait patch

* chore: fixup patch indices

* build: fix GN build failure

https://github.com/nodejs/node/pull/57013

* crypto: expose security levels

https://github.com/nodejs/node/pull/56601

* zlib: add zstd support

https://github.com/nodejs/node/pull/52100

* test: move crypto related common utilities in common/crypto

https://github.com/nodejs/node/pull/56714

* cli: move --trace-atomics-wait to eol

https://github.com/nodejs/node/pull/52747

* test: disable test-https-client-renegotiation-limit

BoringSSL doesn't support caller-initiated renegotiation - see
https://source.chromium.org/chromium/chromium/src/+/main:third_party/boringssl/src/ssl/ssl_lib.cc;l=1627-1631

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-06 10:29:19 +02:00
Charles Kerr
7dfa2b92fb refactor: remove some NativeWindow public API (37-x-y) (#46934)
refactor: remove some `NativeWindow` public API (#46919)

* refactor: make NativeWindow::titlebar_overlay_height_ private

* refactor: make NativeWindow::set_has_frame() protected

* refactor: remove NativeWindow::background_material()

It's only used once, in NativeWindow, so use |background_material_| directly.

* refactor: remove NativeWindow::vibrancy()

It's only used once, in a NativeWindow method, so use |vibrancy_| directly.

* refactor: unfriend api::BrowserView

It was added in Oct 2022 by 23d4a25 for access to protected NativeWindow
methods add_inspectable_view() and remove_inspectable_view().

That dependency was removed in Nov 2022 by 184ac2b, so BrowserView
doesn't need access to NativeWindow's private fields & methods anymore.

* refactor: make NativeWindow::ContentBoundsToWindowBounds() protected

refactor: make NativeWindow::WindowBoundsToContentBounds() protected
2025-05-06 09:51:08 +02:00
trop[bot]
8189b01987 docs: use correct heading level for API function (#46941)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
2025-05-05 16:28:15 -05:00
trop[bot]
0c683552ec chore: bump chromium to 138.0.7160.0 (37-x-y) (#46938)
* chore: bump chromium in DEPS to 138.0.7158.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 138.0.7160.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 6509206: Move Keychain UI suppression code into apple_keychain.cc

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

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

* 6489036: Fix DesktopDataControlsDialog for Glic

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

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

* chore: fixup patch indices

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

* 6506662: Reland "NavigationThrottleRunner2: content::NavigationThrottleRegistry"

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

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

* 6499811: [video pip] Add live caption dialog

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

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

* 6487926: Add GetMaxImageDimension function to ScreenAI service API for OCR.

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

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

* 6494942: [json] Activate stringify fast-path by default

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

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-05 16:05:40 -05:00
trop[bot]
018e2f6a31 refactor: devirtualize NativeWindow methods (#46931)
* refactor: devirtualize NativeWindow::SetSize()

refactor: devirtualize NativeWindow::GetSize()

refactor: devirtualize NativeWindow::SetPosition()

refactor: devirtualize NativeWindow::GetPosition()

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

* refactor: devirtualize NativeWinodw::SetMinimumSize()

refactor: devirtualize NativeWinodw::GetMinimumSize()

refactor: devirtualize NativeWinodw::SetMaximumSize()

refactor: devirtualize NativeWinodw::GetMaximumSize()

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

* refactor: devirtualize NativeWindow::SetSheetOffset()

refactor: devirtualize NativeWindow::GetSheetOffsetX()

refactor: devirtualize NativeWindow::GetSheetOffsetY()

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

* refactor: devirtualize NativeWindow::GetContentMinimumSize()

refactor: devirtualize NativeWindow::GetContentMaximumSize()

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>
2025-05-05 20:39:50 +02:00
trop[bot]
3c8d971c53 refactor: simplify NativeWindow::FullScreenTransitionState (#46929)
* refactor: make NativeWindow::fullscreen_transition_state_ private

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

* refactor: add NativeWindow::is_transitioning_fullscreen() helper

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

* refactor: remove unused NativeWindow::fullscreen_transition_state()

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

* refactor: replace NativeWindow::set_fullscreen_transition_state() with NativeWindow::set_is_transitioning_fullscreen()

refactor: remove unused NativeWindow::FullScreenTransitionState

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>
2025-05-05 13:26:41 -04:00
trop[bot]
258762929f refactor: add NativeWindow::FromWidget() helper (#46928)
refactor: add NativeWindow::FromWidet() helper

refactor: make kElectronNativeWindowKey a protected field

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-05 13:02:47 -04:00
trop[bot]
01994637e8 fix: xdg portal version detection for file dialogs on linux (#46922)
* chore: use dbus thread for portal version detection

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

* Update shell/browser/ui/file_dialog_linux_portal.cc

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

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-05 20:59:34 +09:00
trop[bot]
0810fe54d4 chore: bump chromium to 138.0.7156.0 (37-x-y) (#46913)
* chore: bump chromium in DEPS to 138.0.7156.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

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

* chore: ICWYU

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

* Allow SecKeychain and SecItem implementations of AppleKeychain to coexist

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

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-05-02 22:46:54 -05:00
trop[bot]
d783f134d9 feat: support dip <-> screen conversion on Linux X11 (#46895)
feat: support dip <-> screen conversion on Linux

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-02 19:08:50 -05:00
trop[bot]
bf94f88569 refactor: move IsClosed() and IsClosable() tests into NativeWindow::Close() (#46907)
refactor: devirtualize NativeWindow::IsClosed()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-02 19:08:28 -05:00
trop[bot]
47e25dfd57 fix: prevent log files being written to current directory on Windows (#46910)
* fix: prevent log files being written to current directory on Windows

Co-authored-by: Derek Cicerone <derekcicerone@gmail.com>

* Update shell/common/logging.cc

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

Co-authored-by: Derek Cicerone <120135886+derekcicerone@users.noreply.github.com>

* chore: add test

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

* chore: update includes

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

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

* chore: address review feedback

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Derek Cicerone <derekcicerone@gmail.com>
Co-authored-by: Derek Cicerone <120135886+derekcicerone@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-05-02 19:08:00 -05:00
trop[bot]
03d83c293f chore: bump chromium to 138.0.7154.0 (37-x-y) (#46894)
* chore: bump chromium in DEPS to 138.0.7152.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

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

* chore: bump chromium in DEPS to 138.0.7154.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

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

* ozone/wayland: Fix bookmark dropdown right click context menu

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

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

* Use base::cstring_view in base::Environment

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

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

* Remove Add/Remove AXMode methods

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

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

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

* build: update filenames.libcxx.gni

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

* Use base::cstring_view in base::Environment

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

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

* Use getters to expose NativePixmapHandle from GpuMemoryBufferHandle

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

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-05-02 10:08:04 -04:00
trop[bot]
46e3ab6353 refactor: use base::ObserverList::Notify() (#46896)
* refactor: use ObserverList::Notify() in shell/browser/window_list.cc

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

* refactor: use ObserverList::Notify() in shell/browser/web_contents_zoom_controller.cc

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

* refactor: use ObserverList::Notify() in shell/browser/usb/usb_chooser_context.cc

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

* refactor: use ObserverList::Notify() in shell/browser/usb/electron_usb_delegate.cc

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

* refactor: use ObserverList::Notify() in shell/browser/ui/views/menu_delegate.cc

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

* refactor: use ObserverList::Notify() in shell/browser/ui/tray_icon.cc

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

* refactor: use ObserverList::Notify() in shell/browser/ui/electron_menu_model.cc

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

* refactor: use ObserverList::Notify() in shell/browser/serial/serial_chooser_context.cc

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

* refactor: use ObserverList::Notify() in shell/browser/native_window.cc

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

* refactor: use ObserverList::Notify() in shell/browser/serial/electron_serial_delegate.cc

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

* refactor: use ObserverList::Notify() in shell/browser/browser.cc

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

* refactor: use ObserverList::Notify() in shell/browser/api/electron_api_web_contents.cc

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

* refactor: use ObserverList::Notify() in shell/browser/hid/electron_hid_delegate.cc

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

* refactor: use ObserverList::Notify() in shell/browser/hid/hid_chooser_context.cc

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>
2025-05-02 07:50:47 -05:00
trop[bot]
620f3a57dd docs: clarified usage of createFromPath() (#46898)
* docs: clarified usage of createFromPath()

Co-authored-by: Yuri <rarescrap@gmail.com>

* Update docs/api/native-image.md

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

Co-authored-by: Yuri <rarescrap@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Yuri <rarescrap@gmail.com>
2025-05-02 13:19:52 +02:00
trop[bot]
534ad05cf2 fix: revert macOS content protection logic refactor (#46891)
Revert "refactor: use upstream content protection logic on macOS (#46813)"

This reverts commit 34adb976b6.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2025-05-02 13:18:46 +02:00
trop[bot]
7c77018b19 refactor: don't call deprecated WidgetDelegate API in NativeWindowViews (#46885)
* refactor: don't call RegisterDeleteDelegateCallback()

move NativeWindowViews' on-widget-delegate-destroyed callback logic to
the NativeWindowViews destructor.

Since NativeWindowViews subclasses from WidgetDelegate and |this| *is*
the delegate being destroyed, we can handle this more cleanly in
~NativeWindowViews() instead of in a separate callback.

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

* chore: remove NativeWindowViews from the grandfathered-classes-that-can-call-deprecated-views-behavior patch

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

* refactor: don't call RegisterDeleteDelegateCallback()

RegisterDeleteDelegateCallback() is private upstream API, so we
shouldn't be using it.

Move the on-widget-delegate-destroyed callback logic over to our methods
NativeWindowViews::OnWidgetDestroying() and
NativeWindowViews::OnWidgetDestroyed().

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>
2025-05-01 23:52:19 -05:00
trop[bot]
6696b98ecc refactor: add EmitDeprecationWarning helper (#46878)
* refactor: add EmitDeprecationWarning helper

Also switches EmitWarning to using Node's ProcessEmitWarningGeneric

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

* chore: use node namespace for function call

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-01 11:41:45 -05:00
388 changed files with 6909 additions and 5068 deletions

View File

@@ -38,6 +38,9 @@ runs:
run: |
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"x64\" v8_snapshot_toolchain=\"//build/toolchain/mac:clang_x64\""
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
- name: Add Clang problem matcher
shell: bash
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json"
- name: Build Electron ${{ inputs.step-suffix }}
shell: bash
run: |
@@ -199,6 +202,9 @@ runs:
e build --target electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
- name: Remove Clang problem matcher
shell: bash
run: echo "::remove-matcher owner=clang::"
- name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
if: ${{ inputs.is-release == 'true' }}
shell: bash

View File

@@ -0,0 +1,83 @@
name: 'Build Git Cache'
description: 'Runs a gclient sync to build the git cache for Electron'
inputs:
target-platform:
description: 'Target platform, should be linux, win, macos'
runs:
using: "composite"
steps:
- name: Set GIT_CACHE_PATH to make gclient to use the cache
shell: bash
run: |
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
- name: Set Chromium Git Cookie
uses: ./src/electron/.github/actions/set-chromium-cookie
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Set up cache drive
shell: bash
run: |
if [ "${{ inputs.target-platform }}" = "win" ]; then
echo "CACHE_DRIVE=/mnt/win-cache" >> $GITHUB_ENV
else
echo "CACHE_DRIVE=/mnt/cross-instance-cache" >> $GITHUB_ENV
fi
- name: Check cross instance cache disk space
shell: bash
run: |
# if there is less than 35 GB free space then creating the cache might fail so exit early
freespace=`df -m $CACHE_DRIVE | grep -w $CACHE_DRIVE | awk '{print $4}'`
freespace_human=`df -h $CACHE_DRIVE | grep -w $CACHE_DRIVE | awk '{print $4}'`
if [ $freespace -le 35000 ]; then
echo "The cross mount cache has $freespace_human free space which is not enough - exiting"
exit 1
else
echo "The cross mount cache has $freespace_human free space - continuing"
fi
- name: Restore gitcache
shell: bash
run: |
GIT_CACHE_TAR="$CACHE_DRIVE/gitcache.tar"
if [ ! -f "$GIT_CACHE_TAR" ]; then
echo "Git cache tar file does not exist, skipping restore"
exit 0
fi
echo "Restoring git cache from $GIT_CACHE_TAR to $GIT_CACHE_PATH"
mkdir -p $GIT_CACHE_PATH
tar -xf $GIT_CACHE_TAR -C $GIT_CACHE_PATH
- name: Gclient Sync
shell: bash
run: |
e d gclient config \
--name "src/electron" \
--unmanaged \
${GCLIENT_EXTRA_ARGS} \
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
if [ "$TARGET_OS" != "" ]; then
echo "target_os=['$TARGET_OS']" >> ./.gclient
fi
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags --nohooks -vv
- name: Compress Git Cache Directory
shell: bash
run: |
echo "Uncompressed gitcache size: $(du -sh $GIT_CACHE_PATH | cut -f1 -d' ')"
cd $GIT_CACHE_PATH
tar -cf ../gitcache.tar .
cd ..
echo "Compressed gitcache to $(du -sh gitcache.tar | cut -f1 -d' ')"
# remove the old cache file if it exists
if [ -f $CACHE_DRIVE/gitcache.tar ]; then
echo "Removing old gitcache.tar from $CACHE_DRIVE"
rm $CACHE_DRIVE/gitcache.tar
fi
cp ./gitcache.tar $CACHE_DRIVE/
- name: Wait for active SSH sessions
shell: bash
if: always() && !cancelled()
run: |
while [ -f /var/.ssh-lock ]
do
sleep 60
done

View File

@@ -43,7 +43,7 @@ runs:
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$CACHE_FILE?platform=${{ inputs.target-platform }}" > sas-token
- name: Save SAS Key
if: ${{ inputs.generate-sas-token == 'true' }}
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: sas-token
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
@@ -80,6 +80,21 @@ runs:
else
echo "The cross mount cache has $freespace_human free space - continuing"
fi
- name: Add patch conflict problem matcher
shell: bash
run: echo "::add-matcher::src/electron/.github/problem-matchers/patch-conflict.json"
- name: Restore gitcache
if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash
run: |
GIT_CACHE_TAR="$CACHE_DRIVE/gitcache.tar"
if [ ! -f "$GIT_CACHE_TAR" ]; then
echo "Git cache tar file does not exist, skipping restore"
exit 0
fi
echo "Restoring git cache from $GIT_CACHE_TAR to $GIT_CACHE_PATH"
mkdir -p $GIT_CACHE_PATH
tar -xf $GIT_CACHE_TAR -C $GIT_CACHE_PATH
- name: Gclient Sync
if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash
@@ -128,7 +143,11 @@ runs:
echo "No changes to patches detected"
fi
fi
- name: Remove patch conflict problem matcher
shell: bash
run: |
echo "::remove-matcher owner=merge-conflict::"
echo "::remove-matcher owner=patch-conflict::"
# delete all .git directories under src/ except for
# third_party/angle/ and third_party/dawn/ because of build time generation of files
# gen/angle/commit.h depends on third_party/angle/.git/HEAD

View File

@@ -13,13 +13,18 @@ runs:
git config --global core.fscache true
git config --global core.preloadindex true
fi
export BUILD_TOOLS_SHA=6e8526315ea3b4828882497e532b8340e64e053c
export BUILD_TOOLS_SHA=f2a960b4d82e6b5c9dbbd437378a39489f399c50
npm i -g @electron/build-tools
# Update depot_tools to ensure python
e d update_depot_tools
e auto-update disable
# Disable further updates of depot_tools
e d auto-update disable
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
e d cipd.bat --version
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
fi
echo "$HOME/.electron_build_tools/third_party/depot_tools" >> $GITHUB_PATH
echo "$HOME/.electron_build_tools/third_party/depot_tools/python-bin" >> $GITHUB_PATH
echo "C:\Users\ContainerAdministrator\.electron_build_tools\third_party\depot_tools" >> $GITHUB_PATH
else
echo "$HOME/.electron_build_tools/third_party/depot_tools" >> $GITHUB_PATH
echo "$HOME/.electron_build_tools/third_party/depot_tools/python-bin" >> $GITHUB_PATH
fi

View File

@@ -7,7 +7,7 @@ runs:
shell: bash
id: yarn-cache-dir-path
run: echo "dir=$(node src/electron/script/yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}

View File

@@ -8,14 +8,14 @@ runs:
steps:
- name: Obtain SAS Key
continue-on-error: true
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: sas-token
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-1
enableCrossOsArchive: true
- name: Obtain SAS Key
continue-on-error: true
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: sas-token
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
@@ -32,7 +32,7 @@ runs:
shell: bash
command: |
sas_token=$(cat sas-token)
if [ -z $sas-token ]; then
if [ -z "$sas_token" ]; then
echo "SAS Token not found; exiting src cache download early..."
exit 1
else

18
.github/problem-matchers/clang.json vendored Normal file
View File

@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "clang",
"fromPath": "src/out/Default/args.gn",
"pattern": [
{
"regexp": "^(.+)[(:](\\d+)[:,](\\d+)\\)?:\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
}

View File

@@ -0,0 +1,22 @@
{
"problemMatcher": [
{
"owner": "eslint-stylish",
"pattern": [
{
"regexp": "^\\s*([^\\s].*)$",
"file": 1
},
{
"regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*)\\s\\s+(.*)$",
"line": 1,
"column": 2,
"severity": 3,
"message": 4,
"code": 5,
"loop": true
}
]
}
]
}

View File

@@ -0,0 +1,24 @@
{
"problemMatcher": [
{
"owner": "merge-conflict",
"pattern": [
{
"regexp": "^CONFLICT\\s\\(\\S+\\): (Merge conflict in \\S+)$",
"message": 1
}
]
},
{
"owner": "patch-conflict",
"pattern": [
{
"regexp": "^error: (patch failed: (\\S+):(\\d+))$",
"message": 1,
"file": 2,
"line": 3
}
]
}
]
}

View File

@@ -15,7 +15,7 @@ jobs:
- name: Setup Node.js/npm
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 20.11.x
node-version: 20.19.x
- name: Setting Up Dig Site
run: |
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"

74
.github/workflows/build-git-cache.yml vendored Normal file
View File

@@ -0,0 +1,74 @@
name: Build Git Cache
# This workflow updates git cache on the cross-instance cache volumes
# It runs daily at midnight.
on:
schedule:
- cron: "0 0 * * *"
jobs:
build-git-cache-linux:
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
options: --user root
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps:
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
- name: Build Git Cache
uses: ./src/electron/.github/actions/build-git-cache
with:
target-platform: linux
build-git-cache-windows:
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
volumes:
- /mnt/win-cache:/mnt/win-cache
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
TARGET_OS: 'win'
steps:
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
- name: Build Git Cache
uses: ./src/electron/.github/actions/build-git-cache
with:
target-platform: win
build-git-cache-macos:
runs-on: electron-arc-linux-amd64-32core
# This job updates the same git cache as linux, so it needs to run after the linux one.
needs: build-git-cache-linux
container:
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
options: --user root
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
steps:
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
- name: Build Git Cache
uses: ./src/electron/.github/actions/build-git-cache
with:
target-platform: macos

View File

@@ -128,7 +128,7 @@ jobs:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
outputs:

View File

@@ -61,6 +61,9 @@ jobs:
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
- name: Add ESLint problem matcher
shell: bash
run: echo "::add-matcher::src/electron/.github/problem-matchers/eslint-stylish.json"
- name: Run Lint
shell: bash
run: |

View File

@@ -104,7 +104,7 @@ jobs:
if: ${{ inputs.target-platform == 'macos' }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 20.11.x
node-version: 20.19.x
cache: yarn
cache-dependency-path: src/electron/yarn.lock
- name: Install Dependencies

View File

@@ -81,7 +81,7 @@ jobs:
if: ${{ inputs.target-platform == 'win' }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 20.11.x
node-version: 20.19.x
- name: Add TCC permissions on macOS
if: ${{ inputs.target-platform == 'macos' }}
run: |

View File

@@ -1,6 +1,7 @@
{
"config": {
"extends": "@electron/lint-roller/configs/markdownlint.json",
"descriptive-link-text": false,
"link-image-style": {
"autolink": false,
"shortcut": false
@@ -26,6 +27,6 @@
"no-newline-in-links": true
},
"customRules": [
"@electron/lint-roller/markdownlint-rules/"
"./node_modules/@electron/lint-roller/markdownlint-rules/index.mjs"
]
}

View File

@@ -670,6 +670,8 @@ source_set("electron_lib") {
sources += [
"shell/browser/certificate_manager_model.cc",
"shell/browser/certificate_manager_model.h",
"shell/browser/linux/x11_util.cc",
"shell/browser/linux/x11_util.h",
"shell/browser/ui/gtk_util.cc",
"shell/browser/ui/gtk_util.h",
]

4
DEPS
View File

@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'137.0.7151.0',
'138.0.7204.35',
'node_version':
'v22.14.0',
'v22.16.0',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':

View File

@@ -44,29 +44,17 @@ Each Electron release provides binaries for macOS, Windows, and Linux.
* Fedora 32 and newer
* Debian 10 and newer
## Quick start & Electron Fiddle
## Electron Fiddle
Use [`Electron Fiddle`](https://github.com/electron/fiddle)
to build, run, and package small Electron experiments, to see code examples for all of Electron's APIs, and
to try out different versions of Electron. It's designed to make the start of your journey with
Electron easier.
Alternatively, clone and run the
[electron/electron-quick-start](https://github.com/electron/electron-quick-start)
repository to see a minimal Electron app in action:
```sh
git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install
npm start
```
## Resources for learning Electron
* [electronjs.org/docs](https://electronjs.org/docs) - All of Electron's documentation
* [electron/fiddle](https://github.com/electron/fiddle) - A tool to build, run, and package small Electron experiments
* [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - A very basic starter Electron app
* [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - Sample starter apps created by the community
## Programmatic usage

View File

@@ -113,6 +113,7 @@ These individual tutorials expand on topics discussed in the guide above.
* [dialog](api/dialog.md)
* [globalShortcut](api/global-shortcut.md)
* [inAppPurchase](api/in-app-purchase.md)
* [ImageView](api/image-view.md)
* [ipcMain](api/ipc-main.md)
* [Menu](api/menu.md)
* [MenuItem](api/menu-item.md)

View File

@@ -41,9 +41,10 @@ that was used to open the application, if it was launched from Notification Cent
You can also call `app.isReady()` to check if this event has already fired and `app.whenReady()`
to get a Promise that is fulfilled when Electron is initialized.
**Note**: The `ready` event is only fired after the main process has finished running the first
tick of the event loop. If an Electron API needs to be called before the `ready` event, ensure
that it is called synchronously in the top-level context of the main process.
> [!NOTE]
> The `ready` event is only fired after the main process has finished running the first
> tick of the event loop. If an Electron API needs to be called before the `ready` event, ensure
> that it is called synchronously in the top-level context of the main process.
### Event: 'window-all-closed'
@@ -66,12 +67,14 @@ Emitted before the application starts closing its windows.
Calling `event.preventDefault()` will prevent the default behavior, which is
terminating the application.
**Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
then `before-quit` is emitted _after_ emitting `close` event on all windows and
closing them.
> [!NOTE]
> If application quit was initiated by `autoUpdater.quitAndInstall()`,
> then `before-quit` is emitted _after_ emitting `close` event on all windows and
> closing them.
**Note:** On Windows, this event will not be emitted if the app is closed due
to a shutdown/restart of the system or a user logout.
> [!NOTE]
> On Windows, this event will not be emitted if the app is closed due
> to a shutdown/restart of the system or a user logout.
### Event: 'will-quit'
@@ -86,8 +89,9 @@ terminating the application.
See the description of the `window-all-closed` event for the differences between
the `will-quit` and `window-all-closed` events.
**Note:** On Windows, this event will not be emitted if the app is closed due
to a shutdown/restart of the system or a user logout.
> [!NOTE]
> On Windows, this event will not be emitted if the app is closed due
> to a shutdown/restart of the system or a user logout.
### Event: 'quit'
@@ -98,8 +102,9 @@ Returns:
Emitted when the application is quitting.
**Note:** On Windows, this event will not be emitted if the app is closed due
to a shutdown/restart of the system or a user logout.
> [!NOTE]
> On Windows, this event will not be emitted if the app is closed due
> to a shutdown/restart of the system or a user logout.
### Event: 'open-file' _macOS_
@@ -470,24 +475,28 @@ and `workingDirectory` is its current working directory. Usually
applications respond to this by making their primary window focused and
non-minimized.
**Note:** `argv` will not be exactly the same list of arguments as those passed
to the second instance. The order might change and additional arguments might be appended.
If you need to maintain the exact same arguments, it's advised to use `additionalData` instead.
> [!NOTE]
> `argv` will not be exactly the same list of arguments as those passed
> to the second instance. The order might change and additional arguments might be appended.
> If you need to maintain the exact same arguments, it's advised to use `additionalData` instead.
**Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
> [!NOTE]
> If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
This event is guaranteed to be emitted after the `ready` event of `app`
gets emitted.
**Note:** Extra command line arguments might be added by Chromium,
such as `--original-process-start-time`.
> [!NOTE]
> Extra command line arguments might be added by Chromium,
> such as `--original-process-start-time`.
## Methods
The `app` object has the following methods:
**Note:** Some methods are only available on specific operating systems and are
labeled as such.
> [!NOTE]
> Some methods are only available on specific operating systems and are
> labeled as such.
### `app.quit()`
@@ -679,7 +688,8 @@ preferred over `name` by Electron.
Overrides the current application's name.
**Note:** This function overrides the name used internally by Electron; it does not affect the name that the OS uses.
> [!NOTE]
> This function overrides the name used internally by Electron; it does not affect the name that the OS uses.
### `app.getLocale()`
@@ -688,18 +698,22 @@ Possible return values are documented [here](https://source.chromium.org/chromiu
To set the locale, you'll want to use a command line switch at app startup, which may be found [here](command-line-switches.md).
**Note:** When distributing your packaged app, you have to also ship the
`locales` folder.
> [!NOTE]
> When distributing your packaged app, you have to also ship the
> `locales` folder.
**Note:** This API must be called after the `ready` event is emitted.
> [!NOTE]
> This API must be called after the `ready` event is emitted.
**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
> [!NOTE]
> To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
### `app.getLocaleCountryCode()`
Returns `string` - User operating system's locale two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code. The value is taken from native OS APIs.
**Note:** When unable to detect locale country code, it returns empty string.
> [!NOTE]
> When unable to detect locale country code, it returns empty string.
### `app.getSystemLocale()`
@@ -712,9 +726,11 @@ Different operating systems also use the regional data differently:
Therefore, this API can be used for purposes such as choosing a format for rendering dates and times in a calendar app, especially when the developer wants the format to be consistent with the OS.
**Note:** This API must be called after the `ready` event is emitted.
> [!NOTE]
> This API must be called after the `ready` event is emitted.
**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
> [!NOTE]
> To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
### `app.getPreferredSystemLanguages()`
@@ -777,16 +793,18 @@ Once registered, all links with `your-protocol://` will be opened with the
current executable. The whole link, including protocol, will be passed to your
application as a parameter.
**Note:** On macOS, you can only register protocols that have been added to
your app's `info.plist`, which cannot be modified at runtime. However, you can
change the file during build time via [Electron Forge][electron-forge],
[Electron Packager][electron-packager], or by editing `info.plist` with a text
editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
> [!NOTE]
> On macOS, you can only register protocols that have been added to
> your app's `info.plist`, which cannot be modified at runtime. However, you can
> change the file during build time via [Electron Forge][electron-forge],
> [Electron Packager][electron-packager], or by editing `info.plist` with a text
> editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
**Note:** In a Windows Store environment (when packaged as an `appx`) this API
will return `true` for all calls but the registry key it sets won't be accessible
by other applications. In order to register your Windows Store application
as a default protocol handler you must [declare the protocol in your manifest](https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
> [!NOTE]
> In a Windows Store environment (when packaged as an `appx`) this API
> will return `true` for all calls but the registry key it sets won't be accessible
> by other applications. In order to register your Windows Store application
> as a default protocol handler you must [declare the protocol in your manifest](https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internally.
@@ -810,11 +828,12 @@ protocol (aka URI scheme). If so, it will remove the app as the default handler.
Returns `boolean` - Whether the current executable is the default handler for a
protocol (aka URI scheme).
**Note:** On macOS, you can use this method to check if the app has been
registered as the default protocol handler for a protocol. You can also verify
this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
macOS machine. Please refer to
[Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details.
> [!NOTE]
> On macOS, you can use this method to check if the app has been
> registered as the default protocol handler for a protocol. You can also verify
> this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
> macOS machine. Please refer to
> [Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details.
The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme` internally.
@@ -858,8 +877,9 @@ Adds `tasks` to the [Tasks][tasks] category of the Jump List on Windows.
Returns `boolean` - Whether the call succeeded.
**Note:** If you'd like to customize the Jump List even more use
`app.setJumpList(categories)` instead.
> [!NOTE]
> If you'd like to customize the Jump List even more use
> `app.setJumpList(categories)` instead.
### `app.getJumpListSettings()` _Windows_
@@ -897,21 +917,24 @@ following strings:
If `categories` is `null` the previously set custom Jump List (if any) will be
replaced by the standard Jump List for the app (managed by Windows).
**Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
property set then its `type` is assumed to be `tasks`. If the `name` property
> [!NOTE]
> If a `JumpListCategory` object has neither the `type` nor the `name`
> property set then its `type` is assumed to be `tasks`. If the `name` property
is set but the `type` property is omitted then the `type` is assumed to be
`custom`.
**Note:** Users can remove items from custom categories, and Windows will not
allow a removed item to be added back into a custom category until **after**
the next successful call to `app.setJumpList(categories)`. Any attempt to
re-add a removed item to a custom category earlier than that will result in the
entire custom category being omitted from the Jump List. The list of removed
items can be obtained using `app.getJumpListSettings()`.
> [!NOTE]
> Users can remove items from custom categories, and Windows will not
> allow a removed item to be added back into a custom category until **after**
> the next successful call to `app.setJumpList(categories)`. Any attempt to
> re-add a removed item to a custom category earlier than that will result in the
> entire custom category being omitted from the Jump List. The list of removed
> items can be obtained using `app.getJumpListSettings()`.
**Note:** The maximum length of a Jump List item's `description` property is
260 characters. Beyond this limit, the item will not be added to the Jump
List, nor will it be displayed.
> [!NOTE]
> The maximum length of a Jump List item's `description` property is
> 260 characters. Beyond this limit, the item will not be added to the Jump
> List, nor will it be displayed.
Here's a very simple example of creating a custom Jump List:
@@ -1188,7 +1211,8 @@ Returns [`ProcessMetric[]`](structures/process-metric.md): Array of `ProcessMetr
Returns [`GPUFeatureStatus`](structures/gpu-feature-status.md) - The Graphics Feature Status from `chrome://gpu/`.
**Note:** This information is only usable after the `gpu-info-update` event is emitted.
> [!NOTE]
> This information is only usable after the `gpu-info-update` event is emitted.
### `app.getGPUInfo(infoType)`
@@ -1242,11 +1266,13 @@ badge.
On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
please read the [Unity integration documentation][unity-requirement].
> [!NOTE]
> Unity launcher requires a `.desktop` file to work. For more information,
> please read the [Unity integration documentation][unity-requirement].
**Note:** On macOS, you need to ensure that your application has the permission
to display notifications for this method to work.
> [!NOTE]
> On macOS, you need to ensure that your application has the permission
> to display notifications for this method to work.
### `app.getBadgeCount()` _Linux_ _macOS_
@@ -1348,7 +1374,8 @@ details. Disabled by default.
This API must be called after the `ready` event is emitted.
**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
> [!NOTE]
> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
### `app.showAboutPanel()`
@@ -1476,7 +1503,8 @@ By using this API, important information such as password and other sensitive in
See [Apple's documentation](https://developer.apple.com/library/archive/technotes/tn2150/_index.html) for more
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)`
@@ -1490,7 +1518,7 @@ and internal requests made by the runtime (ex: geolocation queries).
This method can only be called after app is ready.
#### `app.resolveProxy(url)`
### `app.resolveProxy(url)`
* `url` URL
@@ -1538,7 +1566,8 @@ See [Chromium's accessibility docs](https://www.chromium.org/developers/design-d
This API must be called after the `ready` event is emitted.
**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
> [!NOTE]
> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
### `app.applicationMenu`
@@ -1551,11 +1580,13 @@ An `Integer` property that returns the badge count for current app. Setting the
On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
please read the [Unity integration documentation][unity-requirement].
> [!NOTE]
> Unity launcher requires a `.desktop` file to work. For more information,
> please read the [Unity integration documentation][unity-requirement].
**Note:** On macOS, you need to ensure that your application has the permission
to display notifications for this property to take effect.
> [!NOTE]
> On macOS, you need to ensure that your application has the permission
> to display notifications for this property to take effect.
### `app.commandLine` _Readonly_

View File

@@ -26,8 +26,9 @@ requirements, you can read [Server Support][server-support]. Note that
update process. Apps that need to disable ATS can add the
`NSAllowsArbitraryLoads` key to their app's plist.
**Note:** Your application must be signed for automatic updates on macOS.
This is a requirement of `Squirrel.Mac`.
> [!IMPORTANT]
> Your application must be signed for automatic updates on macOS.
> This is a requirement of `Squirrel.Mac`.
### Windows
@@ -93,8 +94,9 @@ Emitted when an update has been downloaded.
On Windows only `releaseName` is available.
**Note:** It is not strictly necessary to handle this event. A successfully
downloaded update will still be applied the next time the application starts.
> [!NOTE]
> It is not strictly necessary to handle this event. A successfully
> downloaded update will still be applied the next time the application starts.
### Event: 'before-quit-for-update'
@@ -125,8 +127,9 @@ Returns `string` - The current update feed URL.
Asks the server whether there is an update. You must call `setFeedURL` before
using this API.
**Note:** If an update is available it will be downloaded automatically.
Calling `autoUpdater.checkForUpdates()` twice will download the update two times.
> [!NOTE]
> If an update is available it will be downloaded automatically.
> Calling `autoUpdater.checkForUpdates()` twice will download the update two times.
### `autoUpdater.quitAndInstall()`
@@ -137,9 +140,10 @@ Under the hood calling `autoUpdater.quitAndInstall()` will close all application
windows first, and automatically call `app.quit()` after all windows have been
closed.
**Note:** It is not strictly necessary to call this function to apply an update,
as a successfully downloaded update will always be applied the next time the
application starts.
> [!NOTE]
> It is not strictly necessary to call this function to apply an update,
> as a successfully downloaded update will always be applied the next time the
> application starts.
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support

View File

@@ -4,7 +4,7 @@
Process: [Main](../glossary.md#main-process)
> **Note**
> [!NOTE]
> `BaseWindow` provides a flexible way to compose multiple web views in a
> single window. For windows with only a single, full-size web view, the
> [`BrowserWindow`](browser-window.md) class may be a simpler option.
@@ -99,6 +99,10 @@ Process: [Main](../glossary.md#main-process)
It creates a new `BaseWindow` with native properties as set by the `options`.
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### `new BaseWindow([options])`
* `options` [BaseWindowConstructorOptions](structures/base-window-options.md?inline) (optional)
@@ -107,8 +111,9 @@ It creates a new `BaseWindow` with native properties as set by the `options`.
Objects created with `new BaseWindow` emit the following events:
**Note:** Some events are only available on specific operating systems and are
labeled as such.
> [!NOTE]
> Some events are only available on specific operating systems and are
> labeled as such.
#### Event: 'close'
@@ -137,7 +142,11 @@ window.onbeforeunload = (e) => {
}
```
_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._
> [!NOTE]
> There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and
> `window.addEventListener('beforeunload', handler)`. It is recommended to always set the
> `event.returnValue` explicitly, instead of only returning a value, as the former works more
> consistently within Electron.
#### Event: 'closed'
@@ -252,7 +261,8 @@ Emitted when the window is being moved to a new position.
Emitted once when the window is moved to a new position.
**Note**: On macOS this event is an alias of `move`.
> [!NOTE]
> On macOS, this event is an alias of `move`.
#### Event: 'enter-full-screen'
@@ -356,7 +366,7 @@ as `-webkit-app-region: drag` in a frameless window.
Calling `event.preventDefault()` will prevent the menu from being displayed.
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows).
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux).
### Static Methods
@@ -421,7 +431,8 @@ A `boolean` property that determines whether the window is focusable.
A `boolean` property that determines whether the window is visible on all workspaces.
**Note:** Always returns false on Windows.
> [!NOTE]
> Always returns false on Windows.
#### `win.shadow`
@@ -431,7 +442,8 @@ A `boolean` property that determines whether the window has a shadow.
A `boolean` property that determines whether the menu bar should be visible.
**Note:** If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
> [!NOTE]
> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
#### `win.kiosk`
@@ -452,7 +464,8 @@ and the icon of the file will show in window's title bar.
A `string` property that determines the title of the native window.
**Note:** The title of the web page can be different from the title of the native window.
> [!NOTE]
> The title of the web page can be different from the title of the native window.
#### `win.minimizable` _macOS_ _Windows_
@@ -521,8 +534,9 @@ A `boolean` property that indicates whether the window is arranged via [Snap.](h
Objects created with `new BaseWindow` have the following instance methods:
**Note:** Some methods are only available on specific operating systems and are
labeled as such.
> [!NOTE]
> Some methods are only available on specific operating systems and are
> labeled as such.
#### `win.setContentView(view)`
@@ -614,7 +628,8 @@ Returns `boolean` - Whether the window is minimized.
Sets whether the window should be in fullscreen mode.
**Note:** On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](base-window.md#event-enter-full-screen) or ['leave-full-screen'](base-window.md#event-leave-full-screen) events.
> [!NOTE]
> On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](base-window.md#event-enter-full-screen) or > ['leave-full-screen'](base-window.md#event-leave-full-screen) events.
#### `win.isFullScreen()`
@@ -728,13 +743,15 @@ win.setBounds({ width: 100 })
console.log(win.getBounds())
```
**Note:** On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
> [!NOTE]
> On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
#### `win.getBounds()`
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
**Note:** On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
> [!NOTE]
> On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
#### `win.getBackgroundColor()`
@@ -742,7 +759,8 @@ Returns `string` - Gets the background color of the window in Hex (`#RRGGBB`) fo
See [Setting `backgroundColor`](browser-window.md#setting-the-backgroundcolor-property).
**Note:** The alpha value is _not_ returned alongside the red, green, and blue values.
> [!NOTE]
> The alpha value is _not_ returned alongside the red, green, and blue values.
#### `win.setContentBounds(bounds[, animate])`
@@ -760,7 +778,8 @@ Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window's cl
Returns [`Rectangle`](structures/rectangle.md) - Contains the window bounds of the normal state
**Note:** whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
> [!NOTE]
> Whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
#### `win.setEnabled(enable)`
@@ -957,8 +976,9 @@ Changes the title of native window to `title`.
Returns `string` - The title of the native window.
**Note:** The title of the web page can be different from the title of the native
window.
> [!NOTE]
> The title of the web page can be different from the title of the native
> window.
#### `win.setSheetOffset(offsetY[, offsetX])` _macOS_
@@ -1232,8 +1252,9 @@ in the taskbar.
Sets the properties for the window's taskbar button.
**Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
together. If one of those properties is not set, then neither will be used.
> [!NOTE]
> `relaunchCommand` and `relaunchDisplayName` must always be set
> together. If one of those properties is not set, then neither will be used.
#### `win.setIcon(icon)` _Windows_ _Linux_
@@ -1293,13 +1314,15 @@ maximize button, or by dragging it to the edges of the screen.
Sets whether the window should be visible on all workspaces.
**Note:** This API does nothing on Windows.
> [!NOTE]
> This API does nothing on Windows.
#### `win.isVisibleOnAllWorkspaces()` _macOS_ _Linux_
Returns `boolean` - Whether the window is visible on all workspaces.
**Note:** This API always returns false on Windows.
> [!NOTE]
> This API always returns false on Windows.
#### `win.setIgnoreMouseEvents(ignore[, options])`
@@ -1327,6 +1350,10 @@ On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
For Windows 10 version 2004 and up the window will be removed from capture entirely,
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
#### `win.isContentProtected()` _macOS_ _Windows_
Returns `boolean` - whether or not content protection is currently enabled.
#### `win.setFocusable(focusable)` _macOS_ _Windows_
* `focusable` boolean
@@ -1416,7 +1443,8 @@ This method sets the browser window's system-drawn background material, includin
See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details.
**Note:** This method is only supported on Windows 11 22H2 and up.
> [!NOTE]
> This method is only supported on Windows 11 22H2 and up.
#### `win.setWindowButtonPosition(position)` _macOS_
@@ -1438,8 +1466,9 @@ Sets the touchBar layout for the current window. Specifying `null` or
`undefined` clears the touch bar. This method only has an effect if the
machine has a touch bar.
**Note:** The TouchBar API is currently experimental and may change or be
removed in future Electron releases.
> [!NOTE]
> The TouchBar API is currently experimental and may change or be
> removed in future Electron releases.
#### `win.setTitleBarOverlay(options)` _Windows_ _Linux_

View File

@@ -8,7 +8,7 @@ deprecated:
```
-->
> **Note**
> [!NOTE]
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
@@ -29,7 +29,7 @@ deprecated:
> Create and control views.
> **Note**
> [!NOTE]
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
@@ -38,6 +38,10 @@ Process: [Main](../glossary.md#main-process)
This module cannot be used until the `ready` event of the `app`
module is emitted.
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### Example
```js
@@ -176,4 +180,5 @@ Examples of valid `color` values:
* 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`.
> [!NOTE]
> Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.

View File

@@ -150,6 +150,10 @@ Process: [Main](../glossary.md#main-process)
It creates a new `BrowserWindow` with native properties as set by the `options`.
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### `new BrowserWindow([options])`
* `options` [BrowserWindowConstructorOptions](structures/browser-window-options.md?inline) (optional)
@@ -158,7 +162,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
Objects created with `new BrowserWindow` emit the following events:
**Note:** Some events are only available on specific operating systems and are
> [!NOTE]
> Some events are only available on specific operating systems and are
labeled as such.
#### Event: 'page-title-updated'
@@ -200,7 +205,11 @@ window.onbeforeunload = (e) => {
}
```
_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._
> [!NOTE]
> There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and
> `window.addEventListener('beforeunload', handler)`. It is recommended to always set the
> `event.returnValue` explicitly, instead of only returning a value, as the former works more
> consistently within Electron.
#### Event: 'closed'
@@ -323,7 +332,8 @@ Emitted when the window is being moved to a new position.
Emitted once when the window is moved to a new position.
**Note**: On macOS this event is an alias of `move`.
> [!NOTE]
> On macOS, this event is an alias of `move`.
#### Event: 'enter-full-screen'
@@ -435,7 +445,7 @@ as `-webkit-app-region: drag` in a frameless window.
Calling `event.preventDefault()` will prevent the menu from being displayed.
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows).
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux).
### Static Methods
@@ -460,7 +470,7 @@ or `null` if the contents are not owned by a window.
* `browserView` [BrowserView](browser-view.md)
> **Note**
> [!NOTE]
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
@@ -522,7 +532,8 @@ A `boolean` property that determines whether the window is focusable.
A `boolean` property that determines whether the window is visible on all workspaces.
**Note:** Always returns false on Windows.
> [!NOTE]
> Always returns false on Windows.
#### `win.shadow`
@@ -532,7 +543,8 @@ A `boolean` property that determines whether the window has a shadow.
A `boolean` property that determines whether the menu bar should be visible.
**Note:** If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
> [!NOTE]
> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
#### `win.kiosk`
@@ -553,7 +565,8 @@ and the icon of the file will show in window's title bar.
A `string` property that determines the title of the native window.
**Note:** The title of the web page can be different from the title of the native window.
> [!NOTE]
> The title of the web page can be different from the title of the native window.
#### `win.minimizable` _macOS_ _Windows_
@@ -621,8 +634,9 @@ A `boolean` property that indicates whether the window is arranged via [Snap.](h
Objects created with `new BrowserWindow` have the following instance methods:
**Note:** Some methods are only available on specific operating systems and are
labeled as such.
> [!NOTE]
> Some methods are only available on specific operating systems and are
> labeled as such.
#### `win.destroy()`
@@ -704,13 +718,15 @@ Returns `boolean` - Whether the window is minimized.
Sets whether the window should be in fullscreen mode.
**Note:** On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events.
> [!NOTE]
> On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events.
#### `win.isFullScreen()`
Returns `boolean` - Whether the window is in fullscreen mode.
**Note:** On macOS, fullscreen transitions take place asynchronously. When querying for a BrowserWindow's fullscreen status, you should ensure that either the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events have been emitted.
> [!NOTE]
> On macOS, fullscreen transitions take place asynchronously. When querying for a BrowserWindow's fullscreen status, you should ensure that either the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events have been emitted.
#### `win.setSimpleFullScreen(flag)` _macOS_
@@ -820,13 +836,15 @@ win.setBounds({ width: 100 })
console.log(win.getBounds())
```
**Note:** On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
> [!NOTE]
> On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
#### `win.getBounds()`
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
**Note:** On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
> [!NOTE]
> On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
#### `win.getBackgroundColor()`
@@ -834,7 +852,8 @@ Returns `string` - Gets the background color of the window in Hex (`#RRGGBB`) fo
See [Setting `backgroundColor`](#setting-the-backgroundcolor-property).
**Note:** The alpha value is _not_ returned alongside the red, green, and blue values.
> [!NOTE]
> The alpha value is _not_ returned alongside the red, green, and blue values.
#### `win.setContentBounds(bounds[, animate])`
@@ -852,7 +871,8 @@ Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window's cl
Returns [`Rectangle`](structures/rectangle.md) - Contains the window bounds of the normal state
**Note:** whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
> [!NOTE]
> Whatever the current state of the window (maximized, minimized or in fullscreen), this function always returns the position and size of the window in normal state. In normal state, `getBounds` and `getNormalBounds` return the same [`Rectangle`](structures/rectangle.md).
#### `win.setEnabled(enable)`
@@ -1049,8 +1069,9 @@ Changes the title of native window to `title`.
Returns `string` - The title of the native window.
**Note:** The title of the web page can be different from the title of the native
window.
> [!NOTE]
> The title of the web page can be different from the title of the native
> window.
#### `win.setSheetOffset(offsetY[, offsetX])` _macOS_
@@ -1409,8 +1430,9 @@ in the taskbar.
Sets the properties for the window's taskbar button.
**Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
together. If one of those properties is not set, then neither will be used.
> [!NOTE]
> `relaunchCommand` and `relaunchDisplayName` must always be set
> together. If one of those properties is not set, then neither will be used.
#### `win.showDefinitionForSelection()` _macOS_
@@ -1474,13 +1496,15 @@ maximize button, or by dragging it to the edges of the screen.
Sets whether the window should be visible on all workspaces.
**Note:** This API does nothing on Windows.
> [!NOTE]
> This API does nothing on Windows.
#### `win.isVisibleOnAllWorkspaces()` _macOS_ _Linux_
Returns `boolean` - Whether the window is visible on all workspaces.
**Note:** This API always returns false on Windows.
> [!NOTE]
> This API always returns false on Windows.
#### `win.setIgnoreMouseEvents(ignore[, options])`
@@ -1508,6 +1532,10 @@ On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
For Windows 10 version 2004 and up the window will be removed from capture entirely,
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
#### `win.isContentProtected()` _macOS_ _Windows_
Returns `boolean` - whether or not content protection is currently enabled.
#### `win.setFocusable(focusable)` _macOS_ _Windows_
* `focusable` boolean
@@ -1601,7 +1629,8 @@ This method sets the browser window's system-drawn background material, includin
See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details.
**Note:** This method is only supported on Windows 11 22H2 and up.
> [!NOTE]
> This method is only supported on Windows 11 22H2 and up.
#### `win.setWindowButtonPosition(position)` _macOS_
@@ -1623,8 +1652,9 @@ Sets the touchBar layout for the current window. Specifying `null` or
`undefined` clears the touch bar. This method only has an effect if the
machine has a touch bar.
**Note:** The TouchBar API is currently experimental and may change or be
removed in future Electron releases.
> [!NOTE]
> The TouchBar API is currently experimental and may change or be
> removed in future Electron releases.
#### `win.setBrowserView(browserView)` _Experimental_ _Deprecated_
@@ -1632,7 +1662,7 @@ removed in future Electron releases.
If there are other `BrowserView`s attached, they will be removed from
this window.
> **Note**
> [!WARNING]
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
@@ -1641,7 +1671,7 @@ this window.
Returns `BrowserView | null` - The `BrowserView` attached to `win`. Returns `null`
if one is not attached. Throws an error if multiple `BrowserView`s are attached.
> **Note**
> [!WARNING]
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
@@ -1651,7 +1681,7 @@ if one is not attached. Throws an error if multiple `BrowserView`s are attached.
Replacement API for setBrowserView supporting work with multi browser views.
> **Note**
> [!WARNING]
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
@@ -1659,7 +1689,7 @@ Replacement API for setBrowserView supporting work with multi browser views.
* `browserView` [BrowserView](browser-view.md)
> **Note**
> [!WARNING]
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
@@ -1670,7 +1700,7 @@ Replacement API for setBrowserView supporting work with multi browser views.
Raises `browserView` above other `BrowserView`s attached to `win`.
Throws an error if `browserView` is not attached to `win`.
> **Note**
> [!WARNING]
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.
@@ -1679,7 +1709,7 @@ Throws an error if `browserView` is not attached to `win`.
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.
> **Note**
> [!WARNING]
> The `BrowserView` class is deprecated, and replaced by the new
> [`WebContentsView`](web-contents-view.md) class.

View File

@@ -60,6 +60,10 @@ following properties:
`strict-origin-when-cross-origin`.
* `cache` string (optional) - can be `default`, `no-store`, `reload`,
`no-cache`, `force-cache` or `only-if-cached`.
* `priority` string (optional) - can be `throttled`, `idle`, `lowest`,
`low`, `medium`, or `highest`. Defaults to `idle`.
* `priorityIncremental` boolean (optional) - the incremental loading flag as part
of HTTP extensible priorities (RFC 9218). Default is `true`.
`options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
strictly follow the Node.js model as described in the

View File

@@ -18,7 +18,8 @@ console.log(clipboard.readText('selection'))
The `clipboard` module has the following methods:
**Note:** Experimental APIs are marked as such and could be removed in future.
> [!NOTE]
> Experimental APIs are marked as such and could be removed in future.
### `clipboard.readText([type])`
@@ -141,9 +142,10 @@ bookmark is unavailable. The `title` value will always be empty on Windows.
Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
**Note:** Most apps on Windows don't support pasting bookmarks into them so
you can use `clipboard.write` to write both a bookmark and fallback text to the
clipboard.
> [!NOTE]
> Most apps on Windows don't support pasting bookmarks into them so
> you can use `clipboard.write` to write both a bookmark and fallback text to the
> clipboard.
```js
const { clipboard } = require('electron')

View File

@@ -73,7 +73,8 @@ Passing `--enable-logging=file` will result in logs being saved to the file
specified by `--log-file=...`, or to `electron_debug.log` in the user-data
directory if `--log-file` is not specified.
> **Note:** On Windows, logs from child processes cannot be sent to stderr.
> [!NOTE]
> On Windows, logs from child processes cannot be sent to stderr.
> Logging to a file is the most reliable way to collect logs on Windows.
See also `--log-file`, `--log-level`, `--v`, and `--vmodule`.
@@ -252,9 +253,10 @@ the required version is unavailable. Current default is set to `3`.
Electron supports some of the [CLI flags][node-cli] supported by Node.js.
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
> [!NOTE]
> Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
### `--inspect-brk\[=\[host:]port]`
### `--inspect-brk[=[host:]port]`
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
@@ -266,13 +268,13 @@ Activate inspector on `host:port` and break at start of the first internal
JavaScript script executed when the inspector is available.
Default `host:port` is `127.0.0.1:9229`.
### `--inspect-port=\[host:]port`
### `--inspect-port=[host:]port`
Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is `127.0.0.1`.
Aliased to `--debug-port=[host:]port`.
### `--inspect\[=\[host:]port]`
### `--inspect[=[host:]port]`
Activate inspector on `host:port`. Default is `127.0.0.1:9229`.
@@ -288,6 +290,10 @@ Specify ways of the inspector web socket url exposure.
By default inspector websocket url is available in stderr and under /json/list endpoint on `http://host:port/json/list`.
### `--experimental-network-inspector`
Enable support for devtools network inspector events, for visibility into requests made by the nodejs `http` and `https` modules.
### `--no-deprecation`
Silence deprecation warnings.
@@ -319,6 +325,10 @@ Set the directory to which all Node.js diagnostic output files are written. Defa
Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https://nodejs.org/docs/latest/api/v8.html#v8setheapsnapshotnearheaplimitlimit).
### `--no-experimental-global-navigator`
Disable exposition of [Navigator API][] on the global scope from Node.js.
[app]: app.md
[append-switch]: command-line.md#commandlineappendswitchswitch-value
[debugging-main-process]: ../tutorial/debugging-main-process.md
@@ -327,3 +337,4 @@ Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https:
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
[ready]: app.md#event-ready
[severities]: https://source.chromium.org/chromium/chromium/src/+/main:base/logging.h?q=logging::LogSeverity&ss=chromium
[Navigator API]: https://github.com/nodejs/node/blob/main/doc/api/globals.md#navigator

View File

@@ -25,8 +25,9 @@ document.
Append a switch (with optional `value`) to Chromium's command line.
**Note:** This will not affect `process.argv`. The intended usage of this function is to
control Chromium's behavior.
> [!NOTE]
> This will not affect `process.argv`. The intended usage of this function is to
> control Chromium's behavior.
```js
const { app } = require('electron')
@@ -49,8 +50,9 @@ const { app } = require('electron')
app.commandLine.appendArgument('--enable-experimental-web-platform-features')
```
**Note:** This will not affect `process.argv`. The intended usage of this function is to
control Chromium's behavior.
> [!NOTE]
> This will not affect `process.argv`. The intended usage of this function is to
> control Chromium's behavior.
#### `commandLine.hasSwitch(switch)`
@@ -84,7 +86,8 @@ const portValue = app.commandLine.getSwitchValue('remote-debugging-port')
console.log(portValue) // '8315'
```
**Note:** When the switch is not present or has no value, it returns empty string.
> [!NOTE]
> When the switch is not present or has no value, it returns empty string.
#### `commandLine.removeSwitch(switch)`
@@ -102,5 +105,6 @@ app.commandLine.removeSwitch('remote-debugging-port')
console.log(app.commandLine.hasSwitch('remote-debugging-port')) // false
```
**Note:** This will not affect `process.argv`. The intended usage of this function is to
control Chromium's behavior.
> [!NOTE]
> This will not affect `process.argv`. The intended usage of this function is to
> control Chromium's behavior.

View File

@@ -7,8 +7,9 @@ Process: [Main](../glossary.md#main-process)
This module does not include a web interface. To view recorded traces, use
[trace viewer][], available at `chrome://tracing` in Chrome.
**Note:** You should not use this module until the `ready` event of the app
module is emitted.
> [!NOTE]
> You should not use this module until the `ready` event of the app
> module is emitted.
```js
const { app, contentTracing } = require('electron')

View File

@@ -19,7 +19,8 @@ following projects:
* [socorro](https://github.com/mozilla-services/socorro)
* [mini-breakpad-server](https://github.com/electron/mini-breakpad-server)
> **Note:** Electron uses Crashpad, not Breakpad, to collect and upload
> [!NOTE]
> Electron uses Crashpad, not Breakpad, to collect and upload
> crashes, but for the time being, the [upload protocol is the same](https://chromium.googlesource.com/crashpad/crashpad/+/HEAD/doc/overview_design.md#Upload-to-collection-server).
Or use a 3rd party hosted solution:
@@ -84,19 +85,23 @@ before `app.on('ready')`. If the crash reporter is not initialized at the time
a renderer process is created, then that renderer process will not be monitored
by the crash reporter.
**Note:** You can test out the crash reporter by generating a crash using
`process.crash()`.
> [!NOTE]
> You can test out the crash reporter by generating a crash using
> `process.crash()`.
**Note:** If you need to send additional/updated `extra` parameters after your
first call `start` you can call `addExtraParameter`.
> [!NOTE]
> If you need to send additional/updated `extra` parameters after your
> first call `start` you can call `addExtraParameter`.
**Note:** Parameters passed in `extra`, `globalExtra` or set with
`addExtraParameter` have limits on the length of the keys and values. Key names
must be at most 39 bytes long, and values must be no longer than 127 bytes.
Keys with names longer than the maximum will be silently ignored. Key values
longer than the maximum length will be truncated.
> [!NOTE]
> Parameters passed in `extra`, `globalExtra` or set with
> `addExtraParameter` have limits on the length of the keys and values. Key names
> must be at most 39 bytes long, and values must be no longer than 127 bytes.
> Keys with names longer than the maximum will be silently ignored. Key values
> longer than the maximum length will be truncated.
**Note:** This method is only available in the main process.
> [!NOTE]
> This method is only available in the main process.
### `crashReporter.getLastCrashReport()`
@@ -105,7 +110,8 @@ 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
uploaded. In the case that there are no uploaded reports, `null` is returned.
**Note:** This method is only available in the main process.
> [!NOTE]
> This method is only available in the main process.
### `crashReporter.getUploadedReports()`
@@ -114,14 +120,16 @@ Returns [`CrashReport[]`](structures/crash-report.md):
Returns all uploaded crash reports. Each report contains the date and uploaded
ID.
**Note:** This method is only available in the main process.
> [!NOTE]
> This method is only available in the main process.
### `crashReporter.getUploadToServer()`
Returns `boolean` - Whether reports should be submitted to the server. Set through
the `start` method or `setUploadToServer`.
**Note:** This method is only available in the main process.
> [!NOTE]
> This method is only available in the main process.
### `crashReporter.setUploadToServer(uploadToServer)`
@@ -130,7 +138,8 @@ the `start` method or `setUploadToServer`.
This would normally be controlled by user preferences. This has no effect if
called before `start` is called.
**Note:** This method is only available in the main process.
> [!NOTE]
> This method is only available in the main process.
### `crashReporter.addExtraParameter(key, value)`
@@ -148,10 +157,11 @@ with crashes from renderer or other child processes. Similarly, adding extra
parameters in a renderer process will not result in those parameters being sent
with crashes that occur in other renderer processes or in the main process.
**Note:** Parameters have limits on the length of the keys and values. Key
names must be no longer than 39 bytes, and values must be no longer than 20320
bytes. Keys with names longer than the maximum will be silently ignored. Key
values longer than the maximum length will be truncated.
> [!NOTE]
> Parameters have limits on the length of the keys and values. Key
> names must be no longer than 39 bytes, and values must be no longer than 20320
> bytes. Keys with names longer than the maximum will be silently ignored. Key
> values longer than the maximum length will be truncated.
### `crashReporter.removeExtraParameter(key)`

View File

@@ -70,8 +70,9 @@ stopButton.addEventListener('click', () => {
See [`navigator.mediaDevices.getDisplayMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia) for more information.
**Note:** `navigator.mediaDevices.getDisplayMedia` does not permit the use of `deviceId` for
selection of a source - see [specification](https://w3c.github.io/mediacapture-screen-share/#constraints).
> [!NOTE]
> `navigator.mediaDevices.getDisplayMedia` does not permit the use of `deviceId` for
> selection of a source - see [specification](https://w3c.github.io/mediacapture-screen-share/#constraints).
## Methods
@@ -92,8 +93,9 @@ The `desktopCapturer` module has the following methods:
Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`DesktopCapturerSource`](structures/desktop-capturer-source.md) objects, each `DesktopCapturerSource` represents a screen or an individual window that can be captured.
**Note** Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
which can detected by [`systemPreferences.getMediaAccessStatus`][].
> [!NOTE]
> Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
> which can detected by [`systemPreferences.getMediaAccessStatus`][].
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-windows-macos

View File

@@ -67,10 +67,11 @@ The `extensions` array should contain extensions without wildcards or dots (e.g.
`'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
`'*'` wildcard (no other wildcard is supported).
**Note:** On Windows and Linux an open dialog can not be both a file selector
and a directory selector, so if you set `properties` to
`['openFile', 'openDirectory']` on these platforms, a directory selector will be
shown.
> [!NOTE]
> On Windows and Linux an open dialog can not be both a file selector
> and a directory selector, so if you set `properties` to
> `['openFile', 'openDirectory']` on these platforms, a directory selector will be
> shown.
```js @ts-type={mainWindow:Electron.BaseWindow}
dialog.showOpenDialogSync(mainWindow, {
@@ -78,10 +79,11 @@ dialog.showOpenDialogSync(mainWindow, {
})
```
**Note:** On Linux `defaultPath` is not supported when using portal file chooser
dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
[command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
to force gtk or kde dialogs.
> [!NOTE]
> On Linux `defaultPath` is not supported when using portal file chooser
> dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
> [command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
> to force gtk or kde dialogs.
### `dialog.showOpenDialog([window, ]options)`
@@ -139,10 +141,11 @@ The `extensions` array should contain extensions without wildcards or dots (e.g.
`'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
`'*'` wildcard (no other wildcard is supported).
**Note:** On Windows and Linux an open dialog can not be both a file selector
and a directory selector, so if you set `properties` to
`['openFile', 'openDirectory']` on these platforms, a directory selector will be
shown.
> [!NOTE]
> On Windows and Linux an open dialog can not be both a file selector
> and a directory selector, so if you set `properties` to
> `['openFile', 'openDirectory']` on these platforms, a directory selector will be
> shown.
```js @ts-type={mainWindow:Electron.BaseWindow}
dialog.showOpenDialog(mainWindow, {
@@ -155,10 +158,11 @@ dialog.showOpenDialog(mainWindow, {
})
```
**Note:** On Linux `defaultPath` is not supported when using portal file chooser
dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
[command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
to force gtk or kde dialogs.
> [!NOTE]
> On Linux `defaultPath` is not supported when using portal file chooser
> dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
> [command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
> to force gtk or kde dialogs.
### `dialog.showSaveDialogSync([window, ]options)`
@@ -225,8 +229,9 @@ The `window` argument allows the dialog to attach itself to a parent window, mak
The `filters` specifies an array of file types that can be displayed, see
`dialog.showOpenDialog` for an example.
**Note:** On macOS, using the asynchronous version is recommended to avoid issues when
expanding and collapsing the dialog.
> [!NOTE]
> On macOS, using the asynchronous version is recommended to avoid issues when
> expanding and collapsing the dialog.
### `dialog.showMessageBoxSync([window, ]options)`

View File

@@ -28,7 +28,8 @@ When `informational` is passed, the dock icon will bounce for one second.
However, the request remains active until either the application becomes active
or the request is canceled.
**Note:** This method can only be used while the app is not focused; when the app is focused it will return -1.
> [!NOTE]
> This method can only be used while the app is not focused; when the app is focused it will return -1.
#### `dock.cancelBounce(id)` _macOS_

View File

@@ -115,7 +115,8 @@ Returns `boolean` - Whether the download is paused.
Resumes the download that has been paused.
**Note:** To enable resumable downloads the server you are downloading from must support range requests and provide both `Last-Modified` and `ETag` header values. Otherwise `resume()` will dismiss previously received bytes and restart the download from the beginning.
> [!NOTE]
> To enable resumable downloads the server you are downloading from must support range requests and provide both `Last-Modified` and `ETag` header values. Otherwise `resume()` will dismiss previously received bytes and restart the download from the beginning.
#### `downloadItem.canResume()`
@@ -141,9 +142,10 @@ Returns `boolean` - Whether the download has user gesture.
Returns `string` - The file name of the download item.
**Note:** The file name is not always the same as the actual one saved in local
disk. If user changes the file name in a prompted download saving dialog, the
actual name of saved file will be different.
> [!NOTE]
> The file name is not always the same as the actual one saved in local
> disk. If user changes the file name in a prompted download saving dialog, the
> actual name of saved file will be different.
#### `downloadItem.getCurrentBytesPerSecond()`
@@ -172,8 +174,9 @@ header.
Returns `string` - The current state. Can be `progressing`, `completed`, `cancelled` or `interrupted`.
**Note:** The following methods are useful specifically to resume a
`cancelled` item when session is restarted.
> [!NOTE]
> The following methods are useful specifically to resume a
> `cancelled` item when session is restarted.
#### `downloadItem.getURLChain()`

View File

@@ -104,7 +104,7 @@ you would when running the normal Node.js executable, with the exception of the
These flags are disabled owing to the fact that Electron uses BoringSSL instead of OpenSSL when building Node.js'
`crypto` module, and so will not work as designed.
If the [`runAsNode` fuse](../tutorial/fuses.md#L13) is disabled, `ELECTRON_RUN_AS_NODE` will be ignored.
If the [`runAsNode` fuse](../tutorial/fuses.md#runasnode) is disabled, `ELECTRON_RUN_AS_NODE` will be ignored.
### `ELECTRON_NO_ATTACH_CONSOLE` _Windows_

View File

@@ -92,11 +92,13 @@ app.whenReady().then(async () => {
This API does not support loading packed (.crx) extensions.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
> [!NOTE]
> This API cannot be called before the `ready` event of the `app` module
> is emitted.
**Note:** Loading extensions into in-memory (non-persistent) sessions is not
supported and will throw an error.
> [!NOTE]
> Loading extensions into in-memory (non-persistent) sessions is not
> supported and will throw an error.
#### `extensions.removeExtension(extensionId)`
@@ -104,8 +106,9 @@ supported and will throw an error.
Unloads an extension.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
> [!NOTE]
> This API cannot be called before the `ready` event of the `app` module
> is emitted.
#### `extensions.getExtension(extensionId)`
@@ -113,12 +116,14 @@ is emitted.
Returns `Extension | null` - The loaded extension with the given ID.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
> [!NOTE]
> This API cannot be called before the `ready` event of the `app` module
> is emitted.
#### `extensions.getAllExtensions()`
Returns `Extension[]` - A list of all loaded extensions.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
> [!NOTE]
> This API cannot be called before the `ready` event of the `app` module
> is emitted.

View File

@@ -6,7 +6,8 @@ but it also happens to support some other extension capabilities.
[chrome-extensions-api-index]: https://developer.chrome.com/extensions/api_index
> **Note:** Electron does not support arbitrary Chrome extensions from the
> [!NOTE]
> Electron does not support arbitrary Chrome extensions from the
> store, and it is a **non-goal** of the Electron project to be perfectly
> compatible with Chrome's implementation of Extensions.
@@ -160,7 +161,8 @@ The following methods of `chrome.tabs` are supported:
- `chrome.tabs.update` (partial support)
- supported properties: `url`, `muted`.
> **Note:** In Chrome, passing `-1` as a tab ID signifies the "currently active
> [!NOTE]
> In Chrome, passing `-1` as a tab ID signifies the "currently active
> tab". Since Electron has no such concept, passing `-1` as a tab ID is not
> supported and will raise an error.
@@ -170,6 +172,7 @@ See [official documentation](https://developer.chrome.com/docs/extensions/refere
All features of this API are supported.
> **NOTE:** Electron's [`webRequest`](web-request.md) module takes precedence over `chrome.webRequest` if there are conflicting handlers.
> [!NOTE]
> Electron's [`webRequest`](web-request.md) module takes precedence over `chrome.webRequest` if there are conflicting handlers.
See [official documentation](https://developer.chrome.com/docs/extensions/reference/webRequest) for more information.

View File

@@ -8,13 +8,13 @@ The `globalShortcut` module can register/unregister a global keyboard shortcut
with the operating system so that you can customize the operations for various
shortcuts.
**Note:** The shortcut is global; it will work even if the app does
not have the keyboard focus. This module cannot be used before the `ready`
event of the app module is emitted.
Please also note that it is also possible to use Chromium's
`GlobalShortcutsPortal` implementation, which allows apps to bind global
shortcuts when running within a Wayland session.
> [!NOTE]
> The shortcut is global; it will work even if the app does
> not have the keyboard focus. This module cannot be used before the `ready`
> event of the app module is emitted.
> Please also note that it is also possible to use Chromium's
> `GlobalShortcutsPortal` implementation, which allows apps to bind global
> shortcuts when running within a Wayland session.
```js
const { app, globalShortcut } = require('electron')

65
docs/api/image-view.md Normal file
View File

@@ -0,0 +1,65 @@
# ImageView
> A View that displays an image.
Process: [Main](../glossary.md#main-process)
This module cannot be used until the `ready` event of the `app`
module is emitted.
Useful for showing splash screens that will be swapped for `WebContentsView`s
when the content finishes loading.
Note that `ImageView` is experimental and may be changed or removed in the future.
```js
const { BaseWindow, ImageView, nativeImage, WebContentsView } = require('electron')
const path = require('node:path')
const win = new BaseWindow({ width: 800, height: 600 })
// Create a "splash screen" image to display while the WebContentsView loads
const splashView = new ImageView()
const splashImage = nativeImage.createFromPath(path.join(__dirname, 'loading.png'))
splashView.setImage(splashImage)
win.setContentView(splashView)
const webContentsView = new WebContentsView()
webContentsView.webContents.once('did-finish-load', () => {
// Now that the WebContentsView has loaded, swap out the "splash screen" ImageView
win.setContentView(webContentsView)
})
webContentsView.webContents.loadURL('https://electronjs.org')
```
## Class: ImageView extends `View`
> A View that displays an image.
Process: [Main](../glossary.md#main-process)
`ImageView` inherits from [`View`](view.md).
`ImageView` is an [EventEmitter][event-emitter].
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### `new ImageView()` _Experimental_
Creates an ImageView.
### Instance Methods
The following methods are available on instances of the `ImageView` class, in
addition to those inherited from [View](view.md):
#### `image.setImage(image)` _Experimental_
* `image` NativeImage
Sets the image for this `ImageView`. Note that only image formats supported by
`NativeImage` can be used with an `ImageView`.
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter

View File

@@ -11,6 +11,10 @@ Process: [Main](../glossary.md#main-process)
<!-- TODO(samuelmaddock): refactor doc gen to allow generics to reduce duplication -->
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### Instance Methods
#### `ipcMainServiceWorker.on(channel, listener)`

View File

@@ -156,7 +156,7 @@ If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRender
If you do not need a response to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
> **Note**
> [!NOTE]
> Sending non-standard JavaScript types such as DOM objects or
> special Electron objects will throw an exception.
>
@@ -165,7 +165,7 @@ If you do not need a response to the message, consider using [`ipcRenderer.send`
> Electron's IPC to the main process, as the main process would have no way to decode
> them. Attempting to send such objects over IPC will result in an error.
> **Note**
> [!NOTE]
> If the handler in the main process throws an error,
> the promise returned by `invoke` will reject.
> However, the `Error` object in the renderer process
@@ -195,7 +195,8 @@ throw an exception.
The main process handles it by listening for `channel` with [`ipcMain`](./ipc-main.md) module,
and replies by setting `event.returnValue`.
> :warning: **WARNING**: Sending a synchronous message will block the whole
> [!WARNING]
> Sending a synchronous message will block the whole
> renderer process until the reply is received, so use this method only as a
> last resort. It's much better to use the asynchronous version,
> [`invoke()`](./ipc-renderer.md#ipcrendererinvokechannel-args).

View File

@@ -6,6 +6,10 @@ Process: [Main](../glossary.md#main-process)
See [`Menu`](menu.md) for examples.
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### `new MenuItem(options)`
* `options` Object
@@ -19,7 +23,7 @@ See [`Menu`](menu.md) for examples.
* `type` string (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
`radio`.
* `label` string (optional)
* `sublabel` string (optional)
* `sublabel` string (optional) _macOS_ - Available in macOS >= 14.4
* `toolTip` string (optional) _macOS_ - Hover text for this menu item.
* `accelerator` [Accelerator](accelerator.md) (optional)
* `icon` ([NativeImage](native-image.md) | string) (optional)
@@ -51,7 +55,8 @@ See [`Menu`](menu.md) for examples.
the placement of their containing group after the containing group of the item
with the specified id.
**Note:** `acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development.
> [!NOTE]
> `acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development.
### Roles
@@ -125,7 +130,8 @@ When specifying a `role` on macOS, `label` and `accelerator` are the only
options that will affect the menu item. All other options will be ignored.
Lowercase `role`, e.g. `toggledevtools`, is still supported.
**Note:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
> [!NOTE]
> The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
### Instance Properties
@@ -170,7 +176,8 @@ An `Accelerator` (optional) indicating the item's accelerator, if set.
An `Accelerator | null` indicating the item's [user-assigned accelerator](https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc) for the menu item.
**Note:** This property is only initialized after the `MenuItem` has been added to a `Menu`. Either via `Menu.buildFromTemplate` or via `Menu.append()/insert()`. Accessing before initialization will just return `null`.
> [!NOTE]
> This property is only initialized after the `MenuItem` has been added to a `Menu`. Either via `Menu.buildFromTemplate` or via `Menu.append()/insert()`. Accessing before initialization will just return `null`.
#### `menuItem.icon`

View File

@@ -6,6 +6,10 @@
Process: [Main](../glossary.md#main-process)
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### `new Menu()`
Creates a new menu.
@@ -32,16 +36,18 @@ In order to escape the `&` character in an item name, add a proceeding `&`. For
Passing `null` will suppress the default menu. On Windows and Linux,
this has the additional effect of removing the menu bar from the window.
**Note:** The default menu will be created automatically if the app does not set one.
It contains standard items such as `File`, `Edit`, `View`, `Window` and `Help`.
> [!NOTE]
> The default menu will be created automatically if the app does not set one.
> It contains standard items such as `File`, `Edit`, `View`, `Window` and `Help`.
#### `Menu.getApplicationMenu()`
Returns `Menu | null` - The application menu, if set, or `null`, if not set.
**Note:** The returned `Menu` instance doesn't support dynamic addition or
removal of menu items. [Instance properties](#instance-properties) can still
be dynamically modified.
> [!NOTE]
> The returned `Menu` instance doesn't support dynamic addition or
> removal of menu items. [Instance properties](#instance-properties) can still
> be dynamically modified.
#### `Menu.sendActionToFirstResponder(action)` _macOS_
@@ -119,8 +125,9 @@ Inserts the `menuItem` to the `pos` position of the menu.
Objects created with `new Menu` or returned by `Menu.buildFromTemplate` emit the following events:
**Note:** Some events are only available on specific operating systems and are
labeled as such.
> [!NOTE]
> Some events are only available on specific operating systems and are
> labeled as such.
#### Event: 'menu-will-show'
@@ -329,6 +336,27 @@ name, no matter what label you set. To change it, modify your app bundle's
[About Information Property List Files][AboutInformationPropertyListFiles]
for more information.
### Menu Sublabels
Menu sublabels, or [subtitles](https://developer.apple.com/documentation/appkit/nsmenuitem/subtitle?language=objc), can be added to menu items using the `sublabel` option. Below is an example based on the renderer example above:
```js @ts-expect-error=[12]
// main
ipcMain.on('show-context-menu', (event) => {
const template = [
{
label: 'Menu Item 1',
sublabel: 'Subtitle 1',
click: () => { event.sender.send('context-menu-command', 'menu-item-1') }
},
{ type: 'separator' },
{ label: 'Menu Item 2', sublabel: 'Subtitle 2', type: 'checkbox', checked: true }
]
const menu = Menu.buildFromTemplate(template)
menu.popup({ window: BrowserWindow.fromWebContents(event.sender) })
})
```
## Setting Menu for Specific Browser Window (_Linux_ _Windows_)
The [`setMenu` method][setMenu] of browser windows can set the menu of certain

View File

@@ -33,6 +33,10 @@ ipcRenderer.on('port', (e) => {
})
```
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### Instance Properties
#### `channel.port1`

View File

@@ -134,7 +134,8 @@ Creates an empty `NativeImage` instance.
Returns `Promise<NativeImage>` - fulfilled with the file's thumbnail preview image, which is a [NativeImage](native-image.md).
Note: The Windows implementation will ignore `size.height` and scale the height according to `size.width`.
> [!NOTE]
> Windows implementation will ignore `size.height` and scale the height according to `size.width`.
### `nativeImage.createFromPath(path)`
@@ -142,8 +143,8 @@ Note: The Windows implementation will ignore `size.height` and scale the height
Returns `NativeImage`
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
Creates a new `NativeImage` instance from an image file (e.g., PNG or JPEG) located at `path`.
This method returns an empty image if the `path` does not exist, cannot be read, or is not
a valid image.
```js

View File

@@ -17,8 +17,9 @@ app.whenReady().then(async () => {
See [`--log-net-log`](command-line-switches.md#--log-net-logpath) to log network events throughout the app's lifecycle.
**Note:** All methods unless specified can only be used after the `ready` event
of the `app` module gets emitted.
> [!NOTE]
> All methods unless specified can only be used after the `ready` event
> of the `app` module gets emitted.
## Methods

View File

@@ -117,8 +117,9 @@ protocol.handle('https', (req) => {
})
```
Note: in the [utility process](../glossary.md#utility-process) custom protocols
are not supported.
> [!NOTE]
> In the [utility process](../glossary.md#utility-process), custom protocols
> are not supported.
### `net.isOnline()`

View File

@@ -4,12 +4,9 @@
Process: [Main](../glossary.md#main-process)
:::info Renderer process notifications
If you want to show notifications from a renderer process you should use the
[web Notifications API](../tutorial/notifications.md)
:::
> [!NOTE]
> If you want to show notifications from a renderer process you should use the
> [web Notifications API](../tutorial/notifications.md)
## Class: Notification
@@ -21,6 +18,10 @@ Process: [Main](../glossary.md#main-process)
It creates a new `Notification` with native properties as set by the `options`.
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### Static Methods
The `Notification` class has the following static methods:

View File

@@ -33,10 +33,11 @@ Returns `Integer` - The blocker ID that is assigned to this power blocker.
Starts preventing the system from entering lower-power mode. Returns an integer
identifying the power save blocker.
**Note:** `prevent-display-sleep` has higher precedence over
`prevent-app-suspension`. Only the highest precedence type takes effect. In
other words, `prevent-display-sleep` always takes precedence over
`prevent-app-suspension`.
> [!NOTE]
> `prevent-display-sleep` has higher precedence over
> `prevent-app-suspension`. Only the highest precedence type takes effect. In
> other words, `prevent-display-sleep` always takes precedence over
> `prevent-app-suspension`.
For example, an API calling A requests for `prevent-app-suspension`, and
another calling B requests for `prevent-display-sleep`. `prevent-display-sleep`

View File

@@ -233,7 +233,8 @@ console.log(version)
// On Linux -> '4.15.0-45-generic'
```
**Note:** It returns the actual operating system version instead of kernel version on macOS unlike `os.release()`.
> [!NOTE]
> It returns the actual operating system version instead of kernel version on macOS unlike `os.release()`.
### `process.takeHeapSnapshot(filePath)`

View File

@@ -20,8 +20,9 @@ app.whenReady().then(() => {
})
```
**Note:** All methods unless specified can only be used after the `ready` event
of the `app` module gets emitted.
> [!NOTE]
> All methods unless specified can only be used after the `ready` event
> of the `app` module gets emitted.
## Using `protocol` with a custom `partition` or `session`
@@ -61,8 +62,9 @@ The `protocol` module has the following methods:
* `customSchemes` [CustomScheme[]](structures/custom-scheme.md)
**Note:** This method can only be used before the `ready` event of the `app`
module gets emitted and can be called only once.
> [!NOTE]
> This method can only be used before the `ready` event of the `app`
> module gets emitted and can be called only once.
Registers the `scheme` as standard, secure, bypasses content security policy for
resources, allows registering ServiceWorker, supports fetch API, streaming

View File

@@ -73,5 +73,6 @@ command line flag is provided `--password-store="basic"`.
is provided `--password-store="kwallet"`.
* `kwallet5` - When the desktop session is `kde5` or if the following command line flag
is provided `--password-store="kwallet5"`.
* `kwallet6` - When the desktop session is `kde6`.
* `kwallet6` - When the desktop session is `kde6` or if the following command line flag
is provided `--password-store="kwallet6"`.
* `unknown` - When the function is called before app has emitted the `ready` event.

View File

@@ -9,8 +9,9 @@ module is emitted.
`screen` is an [EventEmitter][event-emitter].
**Note:** In the renderer / DevTools, `window.screen` is a reserved DOM
property, so writing `let { screen } = require('electron')` will not work.
> [!NOTE]
> In the renderer / DevTools, `window.screen` is a reserved DOM
> property, so writing `let { screen } = require('electron')` will not work.
An example of creating a window that fills the whole screen:
@@ -57,6 +58,14 @@ app.whenReady().then(() => {
})
```
> [!NOTE]
> Screen coordinates used by this module are [`Point`](structures/point.md) structures.
> There are two kinds of coordinates available to the process:
>
> * **Physical screen points** are raw hardware pixels on a display.
> * **Device-independent pixel (DIP) points** are virtualized screen points scaled based on the DPI
> (dots per inch) of the display.
## Events
The `screen` module emits the following events:
@@ -101,7 +110,8 @@ Returns [`Point`](structures/point.md)
The current absolute position of the mouse pointer.
**Note:** The return value is a DIP point, not a screen physical point.
> [!NOTE]
> The return value is a DIP point, not a screen physical point.
### `screen.getPrimaryDisplay()`
@@ -124,7 +134,7 @@ Returns [`Display`](structures/display.md) - The display nearest the specified p
Returns [`Display`](structures/display.md) - The display that most closely
intersects the provided bounds.
### `screen.screenToDipPoint(point)` _Windows_
### `screen.screenToDipPoint(point)` _Windows_ _Linux_
* `point` [Point](structures/point.md)
@@ -133,7 +143,10 @@ Returns [`Point`](structures/point.md)
Converts a screen physical point to a screen DIP point.
The DPI scale is performed relative to the display containing the physical point.
### `screen.dipToScreenPoint(point)` _Windows_
Not currently supported on Wayland - if used there it will return the point passed
in with no changes.
### `screen.dipToScreenPoint(point)` _Windows_ _Linux_
* `point` [Point](structures/point.md)
@@ -142,6 +155,8 @@ Returns [`Point`](structures/point.md)
Converts a screen DIP point to a screen physical point.
The DPI scale is performed relative to the display containing the DIP point.
Not currently supported on Wayland.
### `screen.screenToDipRect(window, rect)` _Windows_
* `window` [BrowserWindow](browser-window.md) | null

View File

@@ -762,7 +762,8 @@ Preconnects the given number of sockets to an origin.
Returns `Promise<void>` - Resolves when all connections are closed.
**Note:** It will terminate / fail all requests currently in flight.
> [!NOTE]
> It will terminate / fail all requests currently in flight.
#### `ses.fetch(input[, init])`
@@ -1305,8 +1306,9 @@ Initiates a download of the resource at `url`.
The API will generate a [DownloadItem](download-item.md) that can be accessed
with the [will-download](#event-will-download) event.
**Note:** This does not perform any security checks that relate to a page's origin,
unlike [`webContents.downloadURL`](web-contents.md#contentsdownloadurlurl-options).
> [!NOTE]
> This does not perform any security checks that relate to a page's origin,
> unlike [`webContents.downloadURL`](web-contents.md#contentsdownloadurlurl-options).
#### `ses.createInterruptedDownload(options)`
@@ -1434,7 +1436,8 @@ The built in spellchecker does not automatically detect what language a user is
spell checker to correctly check their words you must call this API with an array of language codes. You can
get the list of supported language codes with the `ses.availableSpellCheckerLanguages` property.
**Note:** On macOS the OS spellchecker is used and will detect your language automatically. This API is a no-op on macOS.
> [!NOTE]
> On macOS, the OS spellchecker is used and will detect your language automatically. This API is a no-op on macOS.
#### `ses.getSpellCheckerLanguages()`
@@ -1442,7 +1445,8 @@ Returns `string[]` - An array of language codes the spellchecker is enabled for.
will fallback to using `en-US`. By default on launch if this setting is an empty list Electron will try to populate this
setting with the current OS locale. This setting is persisted across restarts.
**Note:** On macOS the OS spellchecker is used and has its own list of languages. On macOS, this API will return whichever languages have been configured by the OS.
> [!NOTE]
> On macOS, the OS spellchecker is used and has its own list of languages. On macOS, this API will return whichever languages have been configured by the OS.
#### `ses.setSpellCheckerDictionaryDownloadURL(url)`
@@ -1460,7 +1464,8 @@ If the files present in `hunspell_dictionaries.zip` are available at `https://ex
then you should call this api with `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`. Please
note the trailing slash. The URL to the dictionaries is formed as `${url}${filename}`.
**Note:** On macOS the OS spellchecker is used and therefore we do not download any dictionary files. This API is a no-op on macOS.
> [!NOTE]
> On macOS, the OS spellchecker is used and therefore we do not download any dictionary files. This API is a no-op on macOS.
#### `ses.listWordsInSpellCheckerDictionary()`
@@ -1474,7 +1479,8 @@ Resolves when the full dictionary is loaded from disk.
Returns `boolean` - Whether the word was successfully written to the custom dictionary. This API
will not work on non-persistent (in-memory) sessions.
**Note:** On macOS and Windows 10 this word will be written to the OS custom dictionary as well
> [!NOTE]
> On macOS and Windows, this word will be written to the OS custom dictionary as well.
#### `ses.removeWordFromSpellCheckerDictionary(word)`
@@ -1483,7 +1489,8 @@ will not work on non-persistent (in-memory) sessions.
Returns `boolean` - Whether the word was successfully removed from the custom dictionary. This API
will not work on non-persistent (in-memory) sessions.
**Note:** On macOS and Windows 10 this word will be removed from the OS custom dictionary as well
> [!NOTE]
> On macOS and Windows, this word will be removed from the OS custom dictionary as well.
#### `ses.loadExtension(path[, options])` _Deprecated_
@@ -1526,11 +1533,13 @@ app.whenReady().then(async () => {
This API does not support loading packed (.crx) extensions.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
> [!NOTE]
> This API cannot be called before the `ready` event of the `app` module
> is emitted.
**Note:** Loading extensions into in-memory (non-persistent) sessions is not
supported and will throw an error.
> [!NOTE]
> Loading extensions into in-memory (non-persistent) sessions is not
> supported and will throw an error.
**Deprecated:** Use the new `ses.extensions.loadExtension` API.
@@ -1540,8 +1549,9 @@ supported and will throw an error.
Unloads an extension.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
> [!NOTE]
> This API cannot be called before the `ready` event of the `app` module
> is emitted.
**Deprecated:** Use the new `ses.extensions.removeExtension` API.
@@ -1551,8 +1561,9 @@ is emitted.
Returns `Extension | null` - The loaded extension with the given ID.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
> [!NOTE]
> This API cannot be called before the `ready` event of the `app` module
> is emitted.
**Deprecated:** Use the new `ses.extensions.getExtension` API.
@@ -1560,8 +1571,9 @@ is emitted.
Returns `Extension[]` - A list of all loaded extensions.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
> [!NOTE]
> This API cannot be called before the `ready` event of the `app` module
> is emitted.
**Deprecated:** Use the new `ses.extensions.getAllExtensions` API.
@@ -1599,9 +1611,11 @@ Clears various different types of data.
This method clears more types of data and is more thorough than the
`clearStorageData` method.
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
> [!NOTE]
> Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
**Note:** Clearing cache data will also clear the shared dictionary cache. This means that any dictionaries used for compression may be reloaded after clearing the cache. If you wish to clear the shared dictionary cache but leave other cached data intact, you may want to use the `clearSharedDictionaryCache` method.
> [!NOTE]
> Clearing cache data will also clear the shared dictionary cache. This means that any dictionaries used for compression may be reloaded after clearing the cache. If you wish to clear the shared dictionary cache but leave other cached data intact, you may want to use the `clearSharedDictionaryCache` method.
For more information, refer to Chromium's [`BrowsingDataRemover` interface][browsing-data-remover].

View File

@@ -13,6 +13,10 @@ For including the share menu as a submenu of other menus, please use the
Process: [Main](../glossary.md#main-process)
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### `new ShareMenu(sharingItem)`
* `sharingItem` SharingItem - The item to share.

View File

@@ -14,7 +14,8 @@ const { shell } = require('electron')
shell.openExternal('https://github.com')
```
**Note:** While the `shell` module can be used in the renderer process, it will not function in a sandboxed renderer.
> [!WARNING]
> While the `shell` module can be used in the renderer process, it will not function in a sandboxed renderer.
## Methods

View File

@@ -6,3 +6,11 @@
* `productId` Integer - The USB product ID.
* `serialNumber` string (optional) - The USB device serial number.
* `guid` string (optional) - Unique identifier for the HID interface. A device may have multiple HID interfaces.
* `collections` Object[] - an array of report formats. See [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/collections) for more.
* `usage` Integer - An integer representing the usage ID component of the HID usage associated with this collection.
* `usagePage` Integer - An integer representing the usage page component of the HID usage associated with this collection.
* `type` Integer - An 8-bit value representing the collection type, which describes a different relationship between the grouped items.
* `children` Object[] - An array of sub-collections which takes the same format as a top-level collection.
* `inputReports` Object[] - An array of inputReport items which represent individual input reports described in this collection.
* `outputReports` Object[] - An array of outputReport items which represent individual output reports described in this collection.
* `featureReports` Object[] - An array of featureReport items which represent individual feature reports described in this collection.

View File

@@ -15,11 +15,13 @@
* `items` JumpListItem[] (optional) - Array of [`JumpListItem`](jump-list-item.md) objects if `type` is `tasks` or
`custom`, otherwise it should be omitted.
**Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
property set then its `type` is assumed to be `tasks`. If the `name` property
is set but the `type` property is omitted then the `type` is assumed to be
`custom`.
> [!NOTE]
> If a `JumpListCategory` object has neither the `type` nor the `name`
> property set then its `type` is assumed to be `tasks`. If the `name` property
> is set but the `type` property is omitted then the `type` is assumed to be
> `custom`.
**Note:** The maximum length of a Jump List item's `description` property is
260 characters. Beyond this limit, the item will not be added to the Jump
List, nor will it be displayed.
> [!NOTE]
> The maximum length of a Jump List item's `description` property is
> 260 characters. Beyond this limit, the item will not be added to the Jump
> List, nor will it be displayed.

View File

@@ -3,6 +3,7 @@
* `x` number
* `y` number
**Note:** Both `x` and `y` must be whole integers, when providing a point object
as input to an Electron API we will automatically round your `x` and `y` values
to the nearest whole integer.
> [!NOTE]
> Both `x` and `y` must be whole integers, when providing a point object
> as input to an Electron API we will automatically round your `x` and `y` values
> to the nearest whole integer.

View File

@@ -4,8 +4,9 @@
> from Chromium at the space indicated by the proxy. By default, this proxy is added
> to each TouchBar at the end of the input. For more information, see the AppKit docs on
> [NSTouchBarItemIdentifierOtherItemsProxy](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy)
>
> Note: Only one instance of this class can be added per TouchBar.
> [!NOTE]
> Only one instance of this class can be added per TouchBar.
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._

View File

@@ -1,5 +1,9 @@
# TouchBar
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
## Class: TouchBar
> Create TouchBar layouts for native macOS applications
@@ -15,12 +19,14 @@ Process: [Main](../glossary.md#main-process)
Creates a new touch bar with the specified items. Use
`BrowserWindow.setTouchBar` to add the `TouchBar` to a window.
**Note:** The TouchBar API is currently experimental and may change or be
removed in future Electron releases.
> [!NOTE]
> The TouchBar API is currently experimental and may change or be
> removed in future Electron releases.
**Tip:** If you don't have a MacBook with Touch Bar, you can use
[Touch Bar Simulator](https://github.com/sindresorhus/touch-bar-simulator)
to test Touch Bar usage in your app.
> [!TIP]
> If you don't have a MacBook with Touch Bar, you can use
> [Touch Bar Simulator](https://github.com/sindresorhus/touch-bar-simulator)
> to test Touch Bar usage in your app.
### Static Properties

View File

@@ -25,6 +25,10 @@ app.whenReady().then(() => {
})
```
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
**Platform Considerations**
**Linux**
@@ -176,7 +180,8 @@ Returns:
Emitted when the mouse is released from clicking the tray icon.
Note: This will not be emitted if you have set a context menu for your Tray using `tray.setContextMenu`, as a result of macOS-level constraints.
> [!NOTE]
> This will not be emitted if you have set a context menu for your Tray using `tray.setContextMenu`, as a result of macOS-level constraints.
#### Event: 'mouse-down' _macOS_

View File

@@ -44,7 +44,8 @@ Process: [Main](../glossary.md#main-process)<br />
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)
**Note:** `utilityProcess.fork` can only be called after the `ready` event has been emitted on `App`.
> [!NOTE]
> `utilityProcess.fork` can only be called after the `ready` event has been emitted on `App`.
## Class: UtilityProcess
@@ -108,7 +109,8 @@ child.on('exit', () => {
})
```
**Note:** You can use the `pid` to determine if the process is currently running.
> [!NOTE]
> You can use the `pid` to determine if the process is currently running.
#### `child.stdout`

View File

@@ -25,6 +25,10 @@ Process: [Main](../glossary.md#main-process)
`View` is an [EventEmitter][event-emitter].
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### `new View()`
Creates a new `View`.
@@ -94,13 +98,15 @@ Examples of valid `color` values:
* 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`.
> [!NOTE]
> Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
#### `view.setBorderRadius(radius)`
* `radius` Integer - Border radius size in pixels.
**Note:** The area cutout of the view's border still captures clicks.
> [!NOTE]
> The area cutout of the view's border still captures clicks.
#### `view.setVisible(visible)`

View File

@@ -32,6 +32,10 @@ Process: [Main](../glossary.md#main-process)
`WebContentsView` is an [EventEmitter][event-emitter].
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### `new WebContentsView([options])`
* `options` Object (optional)

View File

@@ -463,7 +463,8 @@ 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: 'render-process-gone'
@@ -533,14 +534,55 @@ To only prevent the menu shortcuts, use
[`setIgnoreMenuShortcuts`](#contentssetignoremenushortcutsignore):
```js
const { BrowserWindow } = require('electron')
const { app, BrowserWindow } = require('electron')
const win = new BrowserWindow({ width: 800, height: 600 })
app.whenReady().then(() => {
const win = new BrowserWindow({ width: 800, height: 600 })
win.webContents.on('before-input-event', (event, input) => {
// For example, only enable application menu keyboard shortcuts when
// Ctrl/Cmd are down.
win.webContents.setIgnoreMenuShortcuts(!input.control && !input.meta)
win.webContents.on('before-input-event', (event, input) => {
// Enable application menu keyboard shortcuts when Ctrl/Cmd are down.
win.webContents.setIgnoreMenuShortcuts(!input.control && !input.meta)
})
})
```
#### Event: 'before-mouse-event'
Returns:
* `event` Event
* `mouse` [MouseInputEvent](structures/mouse-input-event.md)
Emitted before dispatching mouse events in the page.
Calling `event.preventDefault` will prevent the page mouse events.
```js
const { app, BrowserWindow } = require('electron')
app.whenReady().then(() => {
const win = new BrowserWindow({ width: 800, height: 600 })
win.webContents.on('before-mouse-event', (event, mouse) => {
// Prevent mouseDown events.
if (mouse.type === 'mouseDown') {
console.log(mouse)
/*
{
type: 'mouseDown',
clickCount: 1,
movementX: 0,
movementY: 0,
button: 'left',
x: 632.359375,
y: 480.6875,
globalX: 168.359375,
globalY: 193.6875
}
*/
event.preventDefault()
}
})
})
```
@@ -838,9 +880,10 @@ Emitted when a bluetooth device needs to be selected when a call to
the `deviceId` of the device to be selected. Passing an empty string to
`callback` will cancel the request.
If an event listener is not added for this event, or if `event.preventDefault`
is not called when handling this event, the first available device will be
automatically selected.
If no event listener is added for this event, all bluetooth requests will be cancelled.
If `event.preventDefault` is not called when handling this event, the first available
device will be automatically selected.
Due to the nature of bluetooth, scanning for devices when
`navigator.bluetooth.requestDevice` is called may take time and will cause
@@ -1491,7 +1534,8 @@ increment above or below represents zooming 20% larger or smaller to default
limits of 300% and 50% of original size, respectively. The formula for this is
`scale := 1.2 ^ level`.
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
> [!NOTE]
> The zoom policy at the Chromium level is same-origin, meaning that the
> zoom level for a specific domain propagates across all instances of windows with
> the same domain. Differentiating the window URLs will make zoom work per-window.
@@ -1508,7 +1552,8 @@ Returns `Promise<void>`
Sets the maximum and minimum pinch-to-zoom level.
> **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it, call:
> [!NOTE]
> Visual zoom is disabled by default in Electron. To re-enable it, call:
>
> ```js
> const win = new BrowserWindow()
@@ -2076,7 +2121,9 @@ Disable device emulation enabled by `webContents.enableDeviceEmulation`.
* `inputEvent` [MouseInputEvent](structures/mouse-input-event.md) | [MouseWheelInputEvent](structures/mouse-wheel-input-event.md) | [KeyboardInputEvent](structures/keyboard-input-event.md)
Sends an input `event` to the page.
**Note:** The [`BrowserWindow`](browser-window.md) containing the contents needs to be focused for
> [!NOTE]
> The [`BrowserWindow`](browser-window.md) containing the contents needs to be focused for
`sendInputEvent()` to work.
#### `contents.beginFrameSubscription([onlyDirty ,]callback)`
@@ -2218,7 +2265,9 @@ By default this value is `{ min: 0, max: 0 }` , which would apply no restriction
* `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 }`.
> [!NOTE]
> To reset to an unrestricted port range this value should be set to `{ min: 0, max: 0 }`.
#### `contents.getMediaSourceId(requestWebContents)`
@@ -2364,8 +2413,9 @@ A [`WebContents`](web-contents.md) instance that might own this `WebContents`.
A `WebContents | null` property that represents the of DevTools `WebContents` associated with a given `WebContents`.
**Note:** Users should never store this object because it may become `null`
when the DevTools has been closed.
> [!NOTE]
> Users should never store this object because it may become `null`
> when the DevTools has been closed.
#### `contents.debugger` _Readonly_

View File

@@ -41,7 +41,8 @@ Changes the zoom level to the specified level. The original size is 0 and each
increment above or below represents zooming 20% larger or smaller to default
limits of 300% and 50% of original size, respectively.
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
> [!NOTE]
> The zoom policy at the Chromium level is same-origin, meaning that the
> zoom level for a specific domain propagates across all instances of windows with
> the same domain. Differentiating the window URLs will make zoom work per-window.
@@ -56,13 +57,15 @@ Returns `number` - The current zoom level.
Sets the maximum and minimum pinch-to-zoom level.
> **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it, call:
> [!NOTE]
> Visual zoom is disabled by default in Electron. To re-enable it, call:
>
> ```js
> webFrame.setVisualZoomLevelLimits(1, 3)
> ```
> **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are
> [!NOTE]
> Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are
> controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application
> Menu. To disable shortcuts, manually [define the Menu](./menu.md#examples) and omit zoom roles
> from the definition.
@@ -189,7 +192,9 @@ dispatch errors of isolated worlds to foreign worlds.
* `name` string (optional) - Name for isolated world. Useful in devtools.
Set the security origin, content security policy and name of the isolated world.
Note: If the `csp` is specified, then the `securityOrigin` also has to be specified.
> [!NOTE]
> If the `csp` is specified, then the `securityOrigin` also has to be specified.
### `webFrame.getResourceUsage()`

View File

@@ -30,8 +30,10 @@ rendered.
Unlike an `iframe`, the `webview` runs in a separate process than your
app. It doesn't have the same permissions as your web page and all interactions
between your app and embedded content will be asynchronous. This keeps your app
safe from the embedded content. **Note:** Most methods called on the
webview from the host page require a synchronous call to the main process.
safe from the embedded content.
> [!NOTE]
> Most methods called on the webview from the host page require a synchronous call to the main process.
## Example
@@ -252,7 +254,8 @@ The full list of supported feature strings can be found in the
The `webview` tag has the following methods:
**Note:** The webview element must be loaded before using the methods.
> [!NOTE]
> The webview element must be loaded before using the methods.
**Example**
@@ -679,7 +682,8 @@ increment above or below represents zooming 20% larger or smaller to default
limits of 300% and 50% of original size, respectively. The formula for this is
`scale := 1.2 ^ level`.
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
> [!NOTE]
> The zoom policy at the Chromium level is same-origin, meaning that the
> zoom level for a specific domain propagates across all instances of windows with
> the same domain. Differentiating the window URLs will make zoom work per-window.

View File

@@ -27,6 +27,16 @@ process.on('unhandledRejection', () => {
})
```
### Behavior Changed: `process.exit()` kills utility process synchronously
Calling `process.exit()` in a utility process will now kill the utility process synchronously.
This brings the behavior of `process.exit()` in line with Node.js behavior.
Please refer to the
[Node.js docs](https://nodejs.org/docs/latest-v22.x/api/process.html#processexitcode) and
[PR #45690](https://github.com/electron/electron/pull/45690) to understand the potential
implications of that, e.g., when calling `console.log()` before `process.exit()`.
### Behavior Changed: WebUSB and WebSerial Blocklist Support
[WebUSB](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API) and [Web Serial](https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API) now support the [WebUSB Blocklist](https://wicg.github.io/webusb/#blocklist) and [Web Serial Blocklist](https://wicg.github.io/serial/#blocklist) used by Chromium and outlined in their respective specifications.
@@ -141,7 +151,7 @@ On Linux, the required portal version for file dialogs has been reverted
to 3 from 4. Using the `defaultPath` option of the Dialog API is not
supported when using portal file chooser dialogs unless the portal
backend is version 4 or higher. The `--xdg-portal-required-version`
[command-line switch](/api/command-line-switches.md#--xdg-portal-required-versionversion)
[command-line switch](api/command-line-switches.md#--xdg-portal-required-versionversion)
can be used to force a required version for your application.
See [#44426](https://github.com/electron/electron/pull/44426) for more details.

View File

@@ -155,7 +155,8 @@ $ gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
$ gn gen out/Release --args="import(\`"//electron/build/args/release.gn\`")"
```
**Note:** This will generate a `out/Testing` or `out/Release` build directory under `src/` with the testing or release build depending upon the configuration passed above. You can replace `Testing|Release` with another names, but it should be a subdirectory of `out`.
> [!NOTE]
> This will generate a `out/Testing` or `out/Release` build directory under `src/` with the testing or release build depending upon the configuration passed above. You can replace `Testing|Release` with another names, but it should be a subdirectory of `out`.
Also you shouldn't have to run `gn gen` again—if you want to change the build arguments, you can run `gn args out/Testing` to bring up an editor. To see the list of available build configuration options, run `gn args out/Testing --list`.

View File

@@ -39,8 +39,9 @@ Building Electron is done entirely with command-line scripts and cannot be done
with Visual Studio. You can develop Electron with any editor but support for
building with Visual Studio will come in the future.
**Note:** Even though Visual Studio is not used for building, it's still
**required** because we need the build toolchains it provides.
> [!NOTE]
> Even though Visual Studio is not used for building, it's still
> **required** because we need the build toolchains it provides.
## Exclude source tree from Windows Security

View File

@@ -148,7 +148,8 @@ In your [`shell/common/node_bindings.cc`](https://github.com/electron/electron/b
V(electron_browser_{api_name})
```
> Note: More technical details on how Node links with Electron can be found on [our blog](https://www.electronjs.org/blog/electron-internals-using-node-as-a-library#link-node-with-electron).
> [!NOTE]
> More technical details on how Node links with Electron can be found on [our blog](https://www.electronjs.org/blog/electron-internals-using-node-as-a-library#link-node-with-electron).
## Expose your API to TypeScript

View File

@@ -49,7 +49,8 @@ $ git commit
$ ../../electron/script/git-export-patches -o ../../electron/patches/node
```
> **NOTE**: `git-export-patches` ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.
> [!NOTE]
> `git-export-patches` ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.
Re-exporting patches will sometimes cause shasums in unrelated patches to change. This is generally harmless and can be ignored (but go ahead and add those changes to your PR, it'll stop them from showing up for other people).

View File

@@ -152,6 +152,14 @@ The effect is visible only on (some?) LCD screens. Even if you don't see a diffe
Notice that just setting the background in the CSS does not have the desired effect.
## Class inheritance does not work with Electron built-in modules
Electron classes cannot be subclassed with the [`extends`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends)
keyword (also known as class inheritance). This feature was never implemented in Electron due
to the added complexity it would add to C++/JavaScript interop in Electron's internals.
For more information, see [electron/electron#23](https://github.com/electron/electron/issues/23).
[memory-management]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management
[closures]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures
[storage]: https://developer.mozilla.org/en-US/docs/Web/API/Storage

View File

@@ -78,6 +78,8 @@ See the [Mac App Store Guide][].
## Signing Windows builds
### Using traditional certificates
Before you can code sign your application, you need to acquire a code signing
certificate. Unlike Apple, Microsoft allows developers to purchase those
certificates on the open market. They are usually sold by the same companies
@@ -117,13 +119,13 @@ expose configuration options through a `windowsSign` property. You can either us
to sign files directly - or use the same `windowsSign` configuration across Electron
Forge, [`@electron/packager`][], [`electron-winstaller`][], and [`electron-wix-msi`][].
### Using Electron Forge
#### Using Electron Forge
Electron Forge is the recommended way to sign your app as well as your `Squirrel.Windows`
and `WiX MSI` installers. Detailed instructions on how to configure your application can
be found in the [Electron Forge Code Signing Tutorial](https://www.electronforge.io/guides/code-signing/code-signing-windows).
### Using Electron Packager
#### Using Electron Packager
If you're not using an integrated build pipeline like Forge, you
are likely using [`@electron/packager`][], which includes [`@electron/windows-sign`][].
@@ -146,7 +148,7 @@ packager({
})
```
### Using electron-winstaller (Squirrel.Windows)
#### Using electron-winstaller (Squirrel.Windows)
[`electron-winstaller`][] is a package that can generate Squirrel.Windows installers for your
Electron app. This is the tool used under the hood by Electron Forge's
@@ -178,7 +180,7 @@ try {
For full configuration options, check out the [`electron-winstaller`][] repository!
### Using electron-wix-msi (WiX MSI)
#### Using electron-wix-msi (WiX MSI)
[`electron-wix-msi`][] is a package that can generate MSI installers for your
Electron app. This is the tool used under the hood by Electron Forge's [MSI Maker][maker-msi].
@@ -221,11 +223,32 @@ await msiCreator.compile()
For full configuration options, check out the [`electron-wix-msi`][] repository!
### Using Electron Builder
#### Using Electron Builder
Electron Builder comes with a custom solution for signing your application. You
can find [its documentation here](https://www.electron.build/code-signing).
### Using Azure Trusted Signing
[Azure Trusted Signing][] is Microsoft's modern cloud-based alternative to EV certificates.
It is the cheapest option for code signing on Windows, and it gets rid of SmartScreen warnings.
As of May 2025, Azure Trusted Signing is [available][trusted-signing-availability] to US and
Canada-based organizations with 3+ years of verifiable business history. Microsoft is looking
to make the program more widely available. If you're reading this at a later point, it could
make sense to check if the eligibility criteria have changed.
#### Using Electron Forge
Electron Forge is the recommended way to sign your app as well as your `Squirrel.Windows`
and `WiX MSI` installers. Instructions for Azure Trusted Signing can be found
[here][forge-trusted-signing].
#### Using Electron Builder
The Electron Builder documentation for Azure Trusted Signing can be found
[here][builder-trusted-signing].
### Signing Windows Store applications
See the [Windows Store Guide][].
@@ -243,3 +266,7 @@ See the [Windows Store Guide][].
[windows store guide]: ./windows-store-guide.md
[maker-squirrel]: https://www.electronforge.io/config/makers/squirrel.windows
[maker-msi]: https://www.electronforge.io/config/makers/wix-msi
[azure trusted signing]: https://azure.microsoft.com/en-us/products/trusted-signing
[trusted-signing-availability]: https://techcommunity.microsoft.com/blog/microsoft-security-blog/trusted-signing-public-preview-update/4399713
[forge-trusted-signing]: https://www.electronforge.io/guides/code-signing/code-signing-windows#using-azure-trusted-signing
[builder-trusted-signing]: https://www.electron.build/code-signing-win#using-azure-trusted-signing-beta

View File

@@ -1,6 +1,7 @@
# Debugging in VSCode
This guide goes over how to set up VSCode debugging for both your own Electron project as well as the native Electron codebase.
This guide goes over how to set up VSCode debugging for both your own Electron
project as well as the native Electron codebase.
## Debugging your Electron app
@@ -9,8 +10,8 @@ This guide goes over how to set up VSCode debugging for both your own Electron p
#### 1. Open an Electron project in VSCode.
```sh
$ git clone git@github.com:electron/electron-quick-start.git
$ code electron-quick-start
$ npx create-electron-app@latest my-app
$ code my-app
```
#### 2. Add a file `.vscode/launch.json` with the following configuration:
@@ -37,23 +38,27 @@ $ code electron-quick-start
#### 3. Debugging
Set some breakpoints in `main.js`, and start debugging in the [Debug View](https://code.visualstudio.com/docs/editor/debugging). You should be able to hit the breakpoints.
Here is a pre-configured project that you can download and directly debug in VSCode: https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start
Set some breakpoints in `main.js`, and start debugging in the
[Debug View](https://code.visualstudio.com/docs/editor/debugging). You should
be able to hit the breakpoints.
## Debugging the Electron codebase
If you want to build Electron from source and modify the native Electron codebase, this section will help you in testing your modifications.
If you want to build Electron from source and modify the native Electron codebase,
this section will help you in testing your modifications.
For those unsure where to acquire this code or how to build it, [Electron's Build Tools](https://github.com/electron/build-tools) automates and explains most of this process. If you wish to manually set up the environment, you can instead use these [build instructions](../development/build-instructions-gn.md).
For those unsure where to acquire this code or how to build it,
[Electron's Build Tools](https://github.com/electron/build-tools) automates and
explains most of this process. If you wish to manually set up the environment,
you can instead use these [build instructions](../development/build-instructions-gn.md).
### Windows (C++)
#### 1. Open an Electron project in VSCode.
```sh
$ git clone git@github.com:electron/electron-quick-start.git
$ code electron-quick-start
$ npx create-electron-app@latest my-app
$ code my-app
```
#### 2. Add a file `.vscode/launch.json` with the following configuration:
@@ -86,14 +91,22 @@ $ code electron-quick-start
**Configuration Notes**
* `cppvsdbg` requires the [built-in C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) be enabled.
* `cppvsdbg` requires the
[built-in C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)
be enabled.
* `${workspaceFolder}` is the full path to Chromium's `src` directory.
* `your-executable-location` will be one of the following depending on a few items:
* `Testing`: If you are using the default settings of [Electron's Build-Tools](https://github.com/electron/build-tools) or the default instructions when [building from source](../development/build-instructions-gn.md#building).
* `Testing`: If you are using the default settings of
[Electron's Build-Tools](https://github.com/electron/build-tools) or the default
instructions when [building from source](../development/build-instructions-gn.md#building).
* `Release`: If you built a Release build rather than a Testing build.
* `your-directory-name`: If you modified this during your build process from the default, this will be whatever you specified.
* The `args` array string `"your-electron-project-path"` should be the absolute path to either the directory or `main.js` file of the Electron project you are using for testing. In this example, it should be your path to `electron-quick-start`.
* `your-directory-name`: If you modified this during your build process from
the default, this will be whatever you specified.
* The `args` array string `"your-electron-project-path"` should be the absolute
path to either the directory or `main.js` file of the Electron project you are
using for testing. In this example, it should be your path to `my-app`.
#### 3. Debugging
Set some breakpoints in the .cc files of your choosing in the native Electron C++ code, and start debugging in the [Debug View](https://code.visualstudio.com/docs/editor/debugging).
Set some breakpoints in the .cc files of your choosing in the native Electron C++
code, and start debugging in the [Debug View](https://code.visualstudio.com/docs/editor/debugging).

View File

@@ -133,9 +133,10 @@ function handleKeyPress (event) {
window.addEventListener('keyup', handleKeyPress, true)
```
> Note: the third parameter `true` indicates that the listener will always receive
key presses before other listeners so they can't have `stopPropagation()`
called on them.
> [!NOTE]
> The third parameter `true` indicates that the listener will always receive
> key presses before other listeners so they can't have `stopPropagation()`
> called on them.
#### Intercepting events in the main process

View File

@@ -20,7 +20,8 @@ const win = new BrowserWindow({
The `nodeIntegrationInWorker` can be used independent of `nodeIntegration`, but
`sandbox` must not be set to `true`.
**Note:** This option is not available in [`SharedWorker`s](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker) or [`Service Worker`s](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker) owing to incompatibilities in sandboxing policies.
> [!NOTE]
> This option is not available in [`SharedWorker`s](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker) or [`Service Worker`s](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker) owing to incompatibilities in sandboxing policies.
## Available APIs

File diff suppressed because it is too large Load Diff

View File

@@ -83,4 +83,5 @@ After launching the Electron application, you should see the notification:
![Connection status](../images/connection-status.png)
> Note: If you need to communicate the connection status to the main process, use the [IPC renderer](../api/ipc-renderer.md) API.
> [!NOTE]
> If you need to communicate the connection status to the main process, use the [IPC renderer](../api/ipc-renderer.md) API.

View File

@@ -64,7 +64,8 @@ const contents = win.webContents
console.log(contents)
```
> Note: A renderer process is also created for [web embeds][web-embed] such as the
> [!NOTE]
> A renderer process is also created for [web embeds][web-embed] such as the
> `BrowserView` module. The `webContents` object is also accessible for embedded
> web content.

View File

@@ -14,8 +14,9 @@ dependency, you should be able to access the REPL with the following command:
./node_modules/.bin/electron --interactive
```
**Note:** `electron --interactive` is not available on Windows
(see [electron/electron#5776](https://github.com/electron/electron/pull/5776) for more details).
> [!NOTE]
> `electron --interactive` is not available on Windows
> (see [electron/electron#5776](https://github.com/electron/electron/pull/5776) for more details).
## Renderer process

View File

@@ -5,8 +5,8 @@ for any Snapcraft environment, including the Ubuntu Software Center.
## Background and Requirements
Together with the broader Linux community, Canonical aims to fix many of the
common software installation problems with the [`snapcraft`](https://snapcraft.io/)
Together with the broader Linux community, Canonical aims to address common
software installation issues through the [`snapcraft`](https://snapcraft.io/)
project. Snaps are containerized software packages that include required
dependencies, auto-update, and work on all major Linux distributions without
system modification.
@@ -83,7 +83,14 @@ snap(options)
### Step 1: Create Sample Snapcraft Project
Create your project directory and add the following to `snap/snapcraft.yaml`:
```sh
$ npx create-electron-app@latest my-app
```
### Step 2: Create Sample Snapcraft Project
Create a `snap` directory in your project root and add the following to
`snap/snapcraft.yaml`:
```yaml
name: electron-packager-hello-world
@@ -97,7 +104,7 @@ grade: stable
apps:
electron-packager-hello-world:
command: electron-quick-start/electron-quick-start --no-sandbox
command: my-app/my-app --no-sandbox
extensions: [gnome]
plugs:
- browser-support
@@ -109,13 +116,13 @@ apps:
TMPDIR: $XDG_RUNTIME_DIR
parts:
electron-quick-start:
my-app:
plugin: nil
source: https://github.com/electron/electron-quick-start.git
source: .
override-build: |
npm install electron @electron/packager
npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true
cp -rv ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-quick-start
cp -rv ./my-app-linux-* $SNAPCRAFT_PART_INSTALL/my-app
build-snaps:
- node/14/stable
build-packages:
@@ -125,12 +132,10 @@ parts:
- libnspr4
```
If you want to apply this example to an existing project:
If you want to apply this example to an existing project, replace all instances
of `my-app` with your project's name.
- Replace `source: https://github.com/electron/electron-quick-start.git` with `source: .`.
- Replace all instances of `electron-quick-start` with your project's name.
### Step 2: Build the snap
### Step 3: Build the snap
```sh
$ snapcraft
@@ -139,13 +144,13 @@ $ snapcraft
Snapped electron-packager-hello-world_0.1_amd64.snap
```
### Step 3: Install the snap
### Step 4: Install the snap
```sh
sudo snap install electron-packager-hello-world_0.1_amd64.snap --dangerous
```
### Step 4: Run the snap
### Step 5: Run the snap
```sh
electron-packager-hello-world

View File

@@ -1,6 +1,6 @@
---
title: 'Prerequisites'
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.'
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron.'
slug: tutorial-prerequisites
hide_title: false
---

View File

@@ -1,6 +1,6 @@
---
title: 'Building your First App'
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.'
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron.'
slug: tutorial-first-app
hide_title: false
---

View File

@@ -1,6 +1,6 @@
---
title: 'Using Preload Scripts'
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.'
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron.'
slug: tutorial-preload
hide_title: false
---

View File

@@ -19,12 +19,12 @@ and only allow the capabilities you want to support.
### WebViews
> Important Note:
[we do not recommend you to use WebViews](../api/webview-tag.md#warning),
as this tag undergoes dramatic architectural changes that may affect stability
of your application. Consider switching to alternatives, like `iframe` and
Electron's [`WebContentsView`](../api/web-contents-view.md), or an architecture
that avoids embedded content by design.
> [!IMPORTANT]
> [We do not recommend you to use WebViews](../api/webview-tag.md#warning),
> as this tag undergoes dramatic architectural changes that may affect stability
> of your application. Consider switching to alternatives, like `iframe` and
> Electron's [`WebContentsView`](../api/web-contents-view.md), or an architecture
> that avoids embedded content by design.
[WebViews](../api/webview-tag.md) are based on Chromium's WebViews and are not
explicitly supported by Electron. We do not guarantee that the WebView API will

View File

@@ -25,6 +25,7 @@ auto_filenames = {
"docs/api/extensions-api.md",
"docs/api/extensions.md",
"docs/api/global-shortcut.md",
"docs/api/image-view.md",
"docs/api/in-app-purchase.md",
"docs/api/incoming-message.md",
"docs/api/ipc-main-service-worker.md",

View File

@@ -35,6 +35,7 @@ filenames = {
"shell/browser/relauncher_linux.cc",
"shell/browser/ui/electron_desktop_window_tree_host_linux.cc",
"shell/browser/ui/file_dialog_linux.cc",
"shell/browser/ui/file_dialog_linux_portal.cc",
"shell/browser/ui/gtk/menu_gtk.cc",
"shell/browser/ui/gtk/menu_gtk.h",
"shell/browser/ui/gtk/menu_util.cc",
@@ -478,6 +479,7 @@ filenames = {
"shell/browser/osr/osr_web_contents_view.h",
"shell/browser/plugins/plugin_utils.cc",
"shell/browser/plugins/plugin_utils.h",
"shell/browser/preload_script.cc",
"shell/browser/preload_script.h",
"shell/browser/protocol_registry.cc",
"shell/browser/protocol_registry.h",

View File

@@ -1421,7 +1421,6 @@ libcxx_headers = [
"//third_party/libc++/src/include/__type_traits/is_member_pointer.h",
"//third_party/libc++/src/include/__type_traits/is_nothrow_assignable.h",
"//third_party/libc++/src/include/__type_traits/is_nothrow_constructible.h",
"//third_party/libc++/src/include/__type_traits/is_nothrow_convertible.h",
"//third_party/libc++/src/include/__type_traits/is_nothrow_destructible.h",
"//third_party/libc++/src/include/__type_traits/is_null_pointer.h",
"//third_party/libc++/src/include/__type_traits/is_object.h",

View File

@@ -26,7 +26,12 @@ const keysOfTypeNumberCompileTimeCheck: { [K in IntegerBrowserWindowOptionKeys]
};
// Note `top` / `left` are special cases from the browser which we later convert
// to y / x.
const keysOfTypeNumber = new Set(['top', 'left', ...Object.keys(keysOfTypeNumberCompileTimeCheck)]);
// NOTE(@mlaurencin) `innerWidth` / `innerHeight` are also special cases. The spec
// states that `width` and `height` represent the window content size and are equivalent
// to `innerWidth` / `innerHeight`. However, our implementation currently incorrectly maps
// `width` and `height` to `outerWidth` and `outerHeight`, or the size of the window
// with all border and related window chrome.
const keysOfTypeNumber = new Set(['top', 'left', 'innerWidth', 'innerHeight', ...Object.keys(keysOfTypeNumberCompileTimeCheck)]);
/**
* Note that we only allow "0" and "1" boolean conversion when the type is known

View File

@@ -288,8 +288,12 @@ function parseOptions (optionsIn: ClientRequestConstructorOptions | string): Nod
origin: options.origin,
referrerPolicy: options.referrerPolicy,
cache: options.cache,
allowNonHttpProtocols: Object.hasOwn(options, kAllowNonHttpProtocols)
allowNonHttpProtocols: Object.hasOwn(options, kAllowNonHttpProtocols),
priority: options.priority
};
if ('priorityIncremental' in options) {
urlLoaderOptions.priorityIncremental = options.priorityIncremental;
}
const headers: Record<string, string | string[]> = options.headers || {};
for (const [name, value] of Object.entries(headers)) {
validateHeader(name, value);

View File

@@ -9,7 +9,7 @@
"@electron/docs-parser": "^2.0.0",
"@electron/fiddle-core": "^1.3.4",
"@electron/github-app-auth": "^2.2.1",
"@electron/lint-roller": "^2.4.0",
"@electron/lint-roller": "^3.1.1",
"@electron/typescript-definitions": "^9.1.2",
"@octokit/rest": "^20.0.2",
"@primer/octicons": "^10.0.0",
@@ -40,7 +40,7 @@
"got": "^11.8.5",
"husky": "^8.0.1",
"lint-staged": "^10.2.11",
"markdownlint-cli2": "^0.13.0",
"markdownlint-cli2": "^0.18.0",
"minimist": "^1.2.8",
"null-loader": "^4.0.1",
"pre-flight": "^2.0.0",

View File

@@ -82,7 +82,7 @@ index e04b80cd6a1a215fc87f8fd8d750c3d258c3974f..8fdf1c624794f568bfc77b7b6b0c510b
void EVP_MD_do_all(void (*callback)(const EVP_MD *cipher, const char *name,
diff --git a/include/openssl/digest.h b/include/openssl/digest.h
index 6abab7693ef2cf418e64d4bf5d53e7e0821cb731..ecbf81be6888cf2e95008da054cf4d3d7df6ad49 100644
index b5f76c34efea47fb52f1642c8ca7e8a78c1ae678..b2420a9614453de35e1918d65d42ff95fbf9cf9e 100644
--- a/include/openssl/digest.h
+++ b/include/openssl/digest.h
@@ -48,6 +48,9 @@ OPENSSL_EXPORT const EVP_MD *EVP_blake2b256(void);

View File

@@ -4,7 +4,6 @@ blink_local_frame.patch
can_create_window.patch
disable_hidden.patch
dom_storage_limits.patch
render_widget_host_view_base.patch
render_widget_host_view_mac.patch
webview_cross_drag.patch
gin_enable_disable_v8_platform.patch
@@ -80,7 +79,6 @@ introduce_ozoneplatform_electron_can_call_x11_property.patch
make_gtk_getlibgtk_public.patch
custom_protocols_plzserviceworker.patch
feat_filter_out_non-shareable_windows_in_the_current_application_in.patch
disable_freezing_flags_after_init_in_node.patch
short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch
chore_add_electron_deps_to_gitignores.patch
chore_modify_chromium_handling_of_mouse_events.patch
@@ -120,7 +118,6 @@ build_run_reclient_cfg_generator_after_chrome.patch
fix_getcursorscreenpoint_wrongly_returns_0_0.patch
fix_add_support_for_skipping_first_2_no-op_refreshes_in_thumb_cap.patch
refactor_expose_file_system_access_blocklist.patch
partially_revert_is_newly_created_to_allow_for_browser_initiated.patch
feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch
fix_font_face_resolution_when_renderer_is_blocked.patch
feat_enable_passing_exit_code_on_service_process_crash.patch
@@ -130,7 +127,6 @@ build_allow_electron_mojom_interfaces_to_depend_on_blink.patch
osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch
feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch
chore_partial_revert_of.patch
fix_software_compositing_infinite_loop.patch
fix_adjust_headless_mode_handling_in_native_widget.patch
refactor_unfilter_unresponsive_events.patch
build_disable_thin_lto_mac.patch
@@ -142,8 +138,6 @@ ignore_parse_errors_for_resolveshortcutproperties.patch
feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch
feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch
fix_win32_synchronous_spellcheck.patch
fix_enable_wrap_iter_in_string_view_and_array.patch
fix_linter_error.patch
revert_enable_crel_for_arm32_targets.patch
chore_grandfather_in_electron_views_and_delegates.patch
refactor_patch_electron_permissiontypes_into_blink.patch

View File

@@ -9,7 +9,7 @@ This patch makes three changes to Accelerator::GetShortcutText to improve shortc
2. Ctrl-Shift-= and Ctrl-Plus show up as such
diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc
index 7eb75d87dd3ed03fc6da738a8b397d4d52f5b5ce..8db9f17c2bdcf5378f9a3f3165956c8f1d1c8d61 100644
index 5ad9332dd27ceda7d67cd3f571b12218a4415a40..ffe083836c39fb60b4bff1f9fbdd6cebb7fa9d1d 100644
--- a/ui/base/accelerators/accelerator.cc
+++ b/ui/base/accelerators/accelerator.cc
@@ -12,6 +12,7 @@
@@ -20,7 +20,7 @@ index 7eb75d87dd3ed03fc6da738a8b397d4d52f5b5ce..8db9f17c2bdcf5378f9a3f3165956c8f
#include "base/strings/utf_string_conversions.h"
#include "base/types/cxx23_to_underlying.h"
#include "build/build_config.h"
@@ -160,6 +161,11 @@ std::u16string Accelerator::GetKeyCodeStringForShortcut() const {
@@ -164,6 +165,11 @@ std::u16string Accelerator::GetKeyCodeStringForShortcut() const {
#endif
if (key_string.empty()) {
@@ -32,7 +32,7 @@ index 7eb75d87dd3ed03fc6da738a8b397d4d52f5b5ce..8db9f17c2bdcf5378f9a3f3165956c8f
#if BUILDFLAG(IS_WIN)
// Our fallback is to try translate the key code to a regular character
// unless it is one of digits (VK_0 to VK_9). Some keyboard
@@ -186,6 +192,10 @@ std::u16string Accelerator::GetKeyCodeStringForShortcut() const {
@@ -190,6 +196,10 @@ std::u16string Accelerator::GetKeyCodeStringForShortcut() const {
static_cast<std::u16string::value_type>(base::ToUpperASCII(c));
}
#endif
@@ -43,7 +43,7 @@ index 7eb75d87dd3ed03fc6da738a8b397d4d52f5b5ce..8db9f17c2bdcf5378f9a3f3165956c8f
}
return key_string;
@@ -346,7 +356,7 @@ std::vector<std::u16string> Accelerator::GetLongFormModifiers() const {
@@ -350,7 +360,7 @@ std::vector<std::u16string> Accelerator::GetLongFormModifiers() const {
modifiers.push_back(l10n_util::GetStringUTF16(IDS_APP_CTRL_KEY));
}

View File

@@ -10,12 +10,12 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set.
This should be upstreamed.
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index f78e6732f4a154b6a479bcfcdb237f0679a7fde3..c95b699fe2d37421ae589a14d51c5ffd4465860f 100644
index 5cf9e02f97e1378b0b1a55feb007b7d664fc4a84..d1fdf00a1b65fe0f5510608c165df93cf6c13e38 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -254,6 +254,10 @@ int GpuMain(MainFunctionParams parameters) {
@@ -269,6 +269,10 @@ int GpuMain(MainFunctionParams parameters) {
// to the GpuProcessHost once the GpuServiceImpl has started.
viz::GpuServiceImpl::InstallPreInitializeLogHandler();
viz::GpuLogMessageManager::GetInstance()->InstallPreInitializeLogHandler();
+ auto* client = GetContentClient()->gpu();
+ if (client)
@@ -24,7 +24,7 @@ index f78e6732f4a154b6a479bcfcdb237f0679a7fde3..c95b699fe2d37421ae589a14d51c5ffd
// We are experiencing what appear to be memory-stomp issues in the GPU
// process. These issues seem to be impacting the task executor and listeners
// registered to it. Create the task executor on the heap to guard against
@@ -364,7 +368,6 @@ int GpuMain(MainFunctionParams parameters) {
@@ -378,7 +382,6 @@ int GpuMain(MainFunctionParams parameters) {
#endif
const bool dead_on_arrival = !init_success;

View File

@@ -10,7 +10,7 @@ DidCreateScriptContext is called, not all JS APIs are available in the
context, which can cause some preload scripts to trip.
diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h
index 44da0544b778d6ff4c14b6f4e8463cb8260d2f0d..8ae8939af4141a684b7a6d50a43e1abb354ea028 100644
index db655a7b52eacb74f2a8637db36abd87f6b86792..8014cb08e2090a12ea8b9e92cb8f93c96921d400 100644
--- a/content/public/renderer/render_frame_observer.h
+++ b/content/public/renderer/render_frame_observer.h
@@ -149,6 +149,8 @@ class CONTENT_EXPORT RenderFrameObserver
@@ -23,10 +23,10 @@ index 44da0544b778d6ff4c14b6f4e8463cb8260d2f0d..8ae8939af4141a684b7a6d50a43e1abb
int32_t world_id) {}
virtual void DidClearWindowObject() {}
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index e3f9f9406f51d4d4cb48fd35d33ee3d694933038..6bcbbd6f746e00344e78447ebdaf59edc80a2b79 100644
index 5c8ffb1462a21f5d798656efc872ba09d6c0de99..2129c419a3ac4d989f2316484779debaebf90d7c 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4810,6 +4810,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
@@ -4808,6 +4808,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
observer.DidCreateScriptContext(context, world_id);
}
@@ -40,10 +40,10 @@ index e3f9f9406f51d4d4cb48fd35d33ee3d694933038..6bcbbd6f746e00344e78447ebdaf59ed
int world_id) {
for (auto& observer : observers_)
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index a7383e4a5ccb8ca1de10bc3efb3043f1dbbf2f6f..41075015aa2dd347c9847072dd76f9cea9ad2d94 100644
index 6a9e696762cc0276f10971933363257591d12bfe..3cd045ed24c47465788c40cc68b050be11ed6f97 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -652,6 +652,8 @@ class CONTENT_EXPORT RenderFrameImpl
@@ -653,6 +653,8 @@ class CONTENT_EXPORT RenderFrameImpl
void DidObserveLayoutShift(double score, bool after_input_or_scroll) override;
void DidCreateScriptContext(v8::Local<v8::Context> context,
int world_id) override;
@@ -92,7 +92,7 @@ index e52a535450964b0938b66f7506225fda0cde04a2..841e9b36df4c32040d2b3c71514266fc
int32_t world_id) = 0;
virtual bool AllowScriptExtensions() = 0;
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
index 479dd8a7294ca6f0abb72350cc1a6c61e09c7c27..45226050aea1036f2c3a2fc15cabee893d12b1a7 100644
index 96fc9e0646f943e86e927de2686a8da94625ae6c..30e9721cccd285a347f35e2d7a539547ac41247c 100644
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
@@ -295,6 +295,13 @@ void LocalFrameClientImpl::DidCreateScriptContext(

View File

@@ -10,7 +10,7 @@ usage of BrowserList and Browser as we subclass related methods and use our
WindowList.
diff --git a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc
index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4590c16b0 100644
index afd58dd8c32582c17a3a9508f0755ac894022a40..7034cb00d27e2c6ca06d89ae59365934762a402b 100644
--- a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc
+++ b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc
@@ -48,6 +48,7 @@
@@ -20,8 +20,8 @@ index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4
+#include "electron/shell/browser/electron_browser_context.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/ax_updates_and_events.h"
#include "ui/accessibility/platform/ax_platform_node.h"
@@ -167,7 +168,7 @@ base::Value::Dict BuildTargetDescriptor(content::RenderViewHost* rvh) {
#include "ui/accessibility/platform/ax_platform.h"
@@ -174,7 +175,7 @@ base::Value::Dict BuildTargetDescriptor(content::RenderViewHost* rvh) {
rvh->GetRoutingID(), accessibility_mode);
}
@@ -30,7 +30,7 @@ index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4
base::Value::Dict BuildTargetDescriptor(Browser* browser) {
base::Value::Dict target_data;
target_data.Set(kSessionIdField, browser->session_id().id());
@@ -190,7 +191,7 @@ void HandleAccessibilityRequestCallback(
@@ -198,7 +199,7 @@ void HandleAccessibilityRequestCallback(
auto& browser_accessibility_state =
*content::BrowserAccessibilityState::GetInstance();
base::Value::Dict data;
@@ -39,8 +39,8 @@ index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4
ui::AXMode mode = browser_accessibility_state.GetAccessibilityMode();
bool native = mode.has_mode(ui::AXMode::kNativeAPIs);
bool web = mode.has_mode(ui::AXMode::kWebContents);
@@ -214,7 +215,7 @@ void HandleAccessibilityRequestCallback(
data.Set(kPDFPrinting, pdf_printing);
@@ -259,7 +260,7 @@ void HandleAccessibilityRequestCallback(
data.Set(kIsScreenReaderActive, is_screen_reader_active);
std::string pref_api_type =
- pref->GetString(prefs::kShownAccessibilityApiType);
@@ -48,7 +48,7 @@ index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4
bool pref_api_type_supported = false;
std::vector<ui::AXApiType::Type> supported_api_types =
@@ -282,11 +283,11 @@ void HandleAccessibilityRequestCallback(
@@ -327,11 +328,11 @@ void HandleAccessibilityRequestCallback(
data.Set(kPagesField, std::move(page_list));
base::Value::List browser_list;
@@ -62,7 +62,7 @@ index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4
data.Set(kBrowsersField, std::move(browser_list));
std::string json_string;
@@ -762,7 +763,8 @@ void AccessibilityUIMessageHandler::SetGlobalString(
@@ -805,7 +806,8 @@ void AccessibilityUIMessageHandler::SetGlobalString(
const std::string value = CheckJSValue(data.FindString(kValueField));
if (string_name == kApiTypeField) {
@@ -72,7 +72,7 @@ index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4
pref->SetString(prefs::kShownAccessibilityApiType, value);
}
}
@@ -816,7 +818,8 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree(
@@ -859,7 +861,8 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree(
AXPropertyFilter::ALLOW_EMPTY);
AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY);
@@ -82,7 +82,7 @@ index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4
ui::AXApiType::Type api_type =
ui::AXApiType::From(pref->GetString(prefs::kShownAccessibilityApiType));
std::string accessibility_contents =
@@ -843,6 +846,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
@@ -886,6 +889,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
AXPropertyFilter::ALLOW_EMPTY);
AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY);
@@ -90,7 +90,7 @@ index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4
for (Browser* browser : *BrowserList::GetInstance()) {
if (browser->session_id().id() == session_id) {
base::Value::Dict result = BuildTargetDescriptor(browser);
@@ -855,6 +859,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
@@ -898,6 +902,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
return;
}
}
@@ -98,7 +98,7 @@ index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4
#endif // !BUILDFLAG(IS_ANDROID)
// No browser with the specified |session_id| was found.
base::Value::Dict result;
@@ -898,11 +903,13 @@ void AccessibilityUIMessageHandler::StopRecording(
@@ -941,11 +946,13 @@ void AccessibilityUIMessageHandler::StopRecording(
}
ui::AXApiType::Type AccessibilityUIMessageHandler::GetRecordingApiType() {
@@ -115,7 +115,7 @@ index 09027b5c273a209519a1c9268c604b3cf1ca0d3c..00511a4558dbc907f752b4c602cc97b4
// Check to see if it is in the supported types list.
if (std::find(supported_types.begin(), supported_types.end(), api_type) ==
supported_types.end()) {
@@ -972,8 +979,11 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents(
@@ -1015,8 +1022,11 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents(
// static
void AccessibilityUIMessageHandler::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {

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