Compare commits

...

322 Commits

Author SHA1 Message Date
David Sanders
a8cdd60c88 chore: update @electron/lint-roller to 3.1.1 (#47273) 2025-05-27 16:59:13 -04:00
trop[bot]
6280172ee9 build: migrate to new chromium git auth (#47253)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-05-27 12:50:32 -04:00
trop[bot]
94f6e16871 fix: regression with directory selection in macOS dialogs (#47276)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-05-27 11:18:36 -04:00
trop[bot]
5fde5696d0 fix: titlebar showing in content protected window (#47265)
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:45 +02:00
trop[bot]
73605f97ee chore: debug crash on DevTools SetOwnerWindow (#47261)
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:09 +02:00
Charles Kerr
72d3d359c3 fix: backgroundMaterial on initial activate (35-x-y) (#47236)
fix: backgroundMaterial on initial activate

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-23 21:37:54 -05:00
trop[bot]
0b026d261e refactor: use base::fixed_flat_set in NativeWindowViews::SetAlwaysOnTop() (#47238)
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-23 12:58:32 -05:00
Charles Kerr
0954ac7843 fix: possible crash in shell.readShortcutLink (35-x-y) (#47226)
fix: possible crash in shell.readShortcutLink

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-23 12:45:56 +02:00
Charles Kerr
feab959781 refactor: make NativeWindow::pending_transitions_ a base::queue (35-x-y) (#47235)
refactor: make `NativeWindow::pending_transitions_` a `base::queue` (#47157)

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."
2025-05-23 09:53:19 +02:00
John Kleinschmidt
282903e7b8 build: fix depot tool pathing on Windows (#47194) (#47227)
build: properly set depot_tools pathing for Windows
(cherry picked from commit b2d0074cc6)
2025-05-22 11:57:23 -07:00
trop[bot]
15d6344b6a ci: add problem matcher for patch conflict output (#47223)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-22 11:54:35 -07:00
trop[bot]
fcb576566a ci: add problem matcher for clang output (#47218)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-22 11:53:12 -07:00
trop[bot]
64a07ffc3f fix: remove extra 'suspend'/'resume' handling from powerMonitor (#47190)
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 13:31:19 -05:00
trop[bot]
720684c766 refactor: make NativeWindow::transparent_ const (#47197)
* refactor: use in-class member initialization for NativeWindow::widget_

* refactor: make NativeWindow::transparent_ const

refactor: make NativeWindow::enable_larger_than_screen_ const

* chore: make linter happy after rebase

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-22 11:16:43 -05:00
Charles Kerr
b626829f71 refactor: add gin_helper::Dictionary::ValueOrDefault() (35-x-y) (#47203)
refactor: add `gin_helper::Dictionary::ValueOrDefault()` (#46939)

* feat: add gin_helper::Dictionary::ValueOrDefault()

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

* refactor: use ValueOrDefault() in native_window.cc

* refactor: use ValueOrDefault() in native_window_mac.mm

* refactor: use ValueOrDefault() in native_window_views.cc

* refactor: use ValueOrDefault() in electron_api_native_image.cc
2025-05-22 12:35:57 +02:00
trop[bot]
2fb93ed6cb refactor: prefer base::circular_deque over std::deque (#47191)
* 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:38 -05:00
Robo
45f84be0b8 feat: support dip <-> screen conversion on Linux (#47124)
* feat: support dip <-> screen conversion on Linux

* chore: fix build
2025-05-21 09:58:24 -07:00
Keeley Hammond
2bf22b53f1 chore: cherry-pick 1 changes from 0-M136 (#47069)
* chore: [35-x-y] cherry-pick 1 changes from 0-M136

* 22ac8acf3508 from v8

* chore: update patches
2025-05-21 10:32:26 +02:00
Keeley Hammond
853392e0f0 chore: cherry-pick 2 changes from 2-M136 (#47175)
* chore: [35-x-y] cherry-pick 2 changes from 2-M136

* 295a4a1b14b8 from chromium
* c3568ceda9d8 from chromium

* chore: update patches
2025-05-21 10:27:16 +02:00
trop[bot]
2b96789b23 refactor: make NativeWindow::has_client_frame_ const (#47178)
* 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-20 19:39:15 -05:00
trop[bot]
406f4eded6 build: update_depot_tools on initial install (#47167)
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 20:56:01 +02:00
trop[bot]
535d9fb1c8 fix: prevent gc monitor 2nd pass crash (#47164)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: reito <cnschwarzer@qq.com>
2025-05-20 11:14:42 -05:00
electron-roller[bot]
caf1c1faf2 chore: bump node to v22.15.1 (35-x-y) (#47102)
* 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:48 +02:00
trop[bot]
ed71d0733e refactor: NativeWindows should prefer widget() over GetWidget() for internal use (#47154)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-19 21:40:21 -05:00
trop[bot]
d03a12aef4 perf: don't create unused menuitem icons (#47127)
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 10:46:21 -05:00
trop[bot]
458fa5f421 test: fix desktopCapturer mocha syntax (#47112)
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-15 19:41:15 -05:00
trop[bot]
f872b431fe fix: opening package paths as directory on macOS (#47110)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-05-15 19:39:32 -05:00
trop[bot]
af31ce0135 refactor: decouple NativeWindowViews and GlobalMenuBarX11 (#47117)
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:38:44 -05:00
trop[bot]
f9bcea3bfc feat: add support for --experimental-network-inspection (#47029)
* 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-15 12:24:33 -07:00
trop[bot]
b8e4d3650e feat: enable secondary label for macOS menu (#47041)
* 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-15 12:22:19 -07:00
Michaela Laurencin
24fcd14cdc feat: enable innerWidth and innerHeight for window open (#46749) (#47045)
* 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
2025-05-15 12:21:56 -07:00
trop[bot]
dec69bb61b refactor: use kKeyModifiers in IsAltModifier() (#47091)
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:17:26 -05:00
electron-roller[bot]
9f4e0b9343 chore: bump node to v22.15.0 (35-x-y) (#46740)
* 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

* build: fix GN build failure

* build: fix patch indices

* 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

* 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

* chore: fixup indices

---------

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-13 21:56:52 +09:00
trop[bot]
b8712a35db fix: webview crash on focus (#47035)
* fix: webview crash on focus

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

* fixup! fix: webview crash on focus

chore: fix .patches shear

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-11 21:18:17 -05:00
trop[bot]
db3b0e01c1 fix: white window flicker on window creation (#47052)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-11 13:25:24 -05:00
trop[bot]
f87950a371 fix: restore previous Windows screenshotting (#47034)
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 17:47:36 -05:00
trop[bot]
d341a523e5 fix: use-after-move of bus connection in xdg portal detection (#47025)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-05-09 09:27:44 -04:00
trop[bot]
a2b954c8f3 build: update hasher return value (#47010)
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:33 +02:00
trop[bot]
8696da7de8 test: enable hasShadow tests on Linux (#46999)
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 15:00:07 -05:00
trop[bot]
8e0f91f93f build: move release script to new hasher function (#46994)
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-08 11:09:36 +02:00
Robo
5104001067 feat: support system-context-menu on Linux (#46977)
* feat: support system-context-menu on Linux

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

* chore: backport linux native window controls menu

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-08 18:08:16 +09:00
trop[bot]
102457bbd5 test: test menu rendering accelerators (#46967)
* 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 18:52:46 -05:00
trop[bot]
0630744f5b fix: crash on macOS dialog after window-all-closed (#46953)
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 14:11:49 -05:00
trop[bot]
00d6963afd refactor: pass gfx::ResizeEdge by value (#46961)
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 14:11:02 -05:00
Robo
cd871fd58c fix: xdg portal version detection for file dialogs on linux (#46936)
chore: use dbus thread for portal version detection
2025-05-05 14:34:00 -05:00
trop[bot]
800640ea2d fix: prevent log files being written to current directory on Windows (#46911)
* 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>

* chore: update includes

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

---------

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-05 12:12:56 -04:00
trop[bot]
621c6b4148 fix: revert macOS content protection logic refactor (#46889)
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-01 16:57:26 -07:00
David Sanders
ec4eafecae test: refactor deprecate-helpers.ts to warning-helpers.ts (#46866)
Add a generic expectWarningMessages and start checking warning names
2025-05-01 10:53:22 -04:00
Aman Karmani
d091cb91ba feat: add support for --js-flags=--perf-prof on macOS (#46877)
allows for profiling of macOS electron apps using samply[1],
which can capture cpu usage for an entire process tree, including
both c/c++ frames and interpreted + jit-compiled JS stack frames

[1] https://github.com/mstange/samply
2025-05-01 09:45:38 -05:00
Robo
8275aa98ca fix: display id order validation on certain versions of Windows 10 (#46873)
* fix: display id order validation on certain versions of Windows 10

* chore:clean up monitor patch

---------

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2025-05-01 09:21:29 +09:00
trop[bot]
b27a5f1cde fix: enable some tests that were accidentally disabled (#46845)
* fix: tests that were not run in api-app-spec due to nested it()

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

* fix: tests that were not run in api-browser-window-spec due to nested it()

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

* chore: annotate disabled test

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-04-30 13:41:46 -05:00
trop[bot]
bdde668926 fix: Linux visibleOnAllWorkspaces property (#46861)
* test: do not skip visibleOnAllWorkspaces tests on Windows

That feature is supported on Linux, so move the test from the
"window states (excluding Linux)" section into the
"window states" section.

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

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>

* chore: disable visibleOnAllWorkspaces test on Linux

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

* fix: NativeWindowViews::IsVisibleOnAllWorkspaces

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

* test: enable visibleOnAllWorkspaces tests on Linux

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-04-30 10:50:23 -05:00
trop[bot]
afee4a78f2 fix: run visibleOnAllWorkspaces tests on the right platforms (#46833)
* test: add platform test on visibleOnAllWorkspaces tests

visibleOnAllWorkspaces is not supported on Windows

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

* test: do not skip visibleOnAllWorkspaces tests on Windows

That feature is supported on Linux, so move the test from the
"window states (excluding Linux)" section into the
"window states" section.

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

* fix: nested it() calls in visibleOnAllWorkspaces specs

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

* chore: make the process.platform test simpler

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

* chore: disable visibleOnAllWorkspaces test on Linux

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-29 11:21:05 -04:00
trop[bot]
713165e406 fix: fullscreen fillet / recovery is incorrect (#46847)
* fix: fullscreen fillet / recovery is incorrect

Signed-off-by: ZOY\zoy-l <zoy-l@outlook.com>

Co-authored-by: ZOY\zoy-l <zoy-l@outlook.com>

* fix: maintain frameless consistency on windows 11

Co-authored-by: ZOY\zoy-l <zoy-l@outlook.com>

* fix: maintain frameless consistency on windows 11

Co-authored-by: ZOY\zoy-l <zoy-l@outlook.com>

* chore: modify the comments

Co-authored-by: ZOY\zoy-l <zoy-l@outlook.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: ZOY\zoy-l <zoy-l@outlook.com>
2025-04-28 22:07:15 -05:00
trop[bot]
d224d03e31 fix: enable autoHideMenuBar tests on Linux and Windows (#46829)
* fix: enable autoHideMenuBar tests

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

* docs: mark autoHideMenuBar as supported on Linux, Windows

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-04-28 13:39:59 -05:00
trop[bot]
52a7c752e6 fix: build error with enable_electron_extensions=false (#46840)
Fix build error with enable_electron_extensions=false

In file included from ../../base/allocator/partition_allocator/src/partition_alloc/pointers/raw_ptr_backup_ref_impl.h:13,
                 from ../../base/allocator/partition_allocator/src/partition_alloc/pointers/raw_ptr.h:50,
                 from ../../base/memory/raw_ptr.h:11,
                 from ../../base/memory/weak_ptr.h:82,
                 from ../../electron/shell/browser/usb/electron_usb_delegate.h:14,
                 from ../../electron/shell/browser/usb/electron_usb_delegate.cc:5:
../../base/allocator/partition_allocator/src/partition_alloc/partition_address_space.h:279:3: warning: multi-line comment [-Wcomment]
  279 |   //       \
      |   ^
../../base/allocator/partition_allocator/src/partition_alloc/partition_address_space.h:281:3: warning: multi-line comment [-Wcomment]
  281 |   //         \
      |   ^
In file included from /usr/include/c++/14/memory:78,
                 from ../../electron/shell/browser/usb/electron_usb_delegate.h:8:
/usr/include/c++/14/bits/unique_ptr.h: In instantiation of ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = device::mojom::UsbDeviceInfo]’:
/usr/include/c++/14/bits/unique_ptr.h:399:17:   required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = device::mojom::UsbDeviceInfo; _Dp = std::default_delete<device::mojom::UsbDeviceInfo>]’
  399 |           get_deleter()(std::move(__ptr));
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
../../mojo/public/cpp/bindings/struct_ptr.h:48:3:   required from ‘constexpr void std::destroy_at(_Tp*) [with _Tp = mojo::StructPtr<device::mojom::UsbDeviceInfo>]’
   48 |   ~StructPtr() = default;
      |   ^
/usr/include/c++/14/bits/stl_construct.h:149:22:   required from ‘constexpr void std::_Destroy(_Tp*) [with _Tp = mojo::StructPtr<device::mojom::UsbDeviceInfo>]’
  149 |       std::destroy_at(__pointer);
      |       ~~~~~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_construct.h:163:19:   required from ‘static constexpr void std::_Destroy_aux<<anonymous> >::__destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = mojo::StructPtr<device::mojom::UsbDeviceInfo>*; bool <anonymous> = false]’
  163 |             std::_Destroy(std::__addressof(*__first));
      |             ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_construct.h:193:44:   required from ‘constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = mojo::StructPtr<device::mojom::UsbDeviceInfo>*]’
  193 |         return std::_Destroy_aux<false>::__destroy(__first, __last);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/alloc_traits.h:981:20:   required from ‘constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = mojo::StructPtr<device::mojom::UsbDeviceInfo>*; _Tp = mojo::StructPtr<device::mojom::UsbDeviceInfo>]’
  981 |       std::_Destroy(__first, __last);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:735:15:   required from ‘constexpr std::vector<_Tp, _Alloc>::~vector() [with _Tp = mojo::StructPtr<device::mojom::UsbDeviceInfo>; _Alloc = std::allocator<mojo::StructPtr<device::mojom::UsbDeviceInfo> >]’
  735 |         std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
      |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  736 |                       _M_get_Tp_allocator());
      |                       ~~~~~~~~~~~~~~~~~~~~~~
../../electron/shell/browser/usb/electron_usb_delegate.cc:231:74:   required from here
  231 |     std::move(callback).Run(std::vector<device::mojom::UsbDeviceInfoPtr>());
      |                                                                          ^
/usr/include/c++/14/bits/unique_ptr.h:91:23: error: invalid application of ‘sizeof’ to incomplete type ‘device::mojom::UsbDeviceInfo’
   91 |         static_assert(sizeof(_Tp)>0,
      |                       ^~~~~~~~~~~

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Bruno Pitrus <brunopitrus@hotmail.com>
2025-04-28 13:20:44 -05:00
trop[bot]
40624199eb refactor: use upstream content protection logic on macOS (#46814)
* refactor: use upstream content protection logic on macOS

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

* Update shell/browser/native_window.h

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

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-26 19:40:39 -05:00
trop[bot]
6433847b09 refactor: use absl::InlinedVector in ToV8(ElectronPermissionManager) (#46804)
perf: use a stack-allocated string_view array in ToV8(USBProtectedClasses)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-25 20:09:28 -05:00
trop[bot]
8e5735e499 refactor: remove public method BrowserWindow::GetWeakPtr() (#46797)
refactor: remove public method electron::api::BrowserWindow::GetWeakPtr()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-25 18:10:50 -05:00
trop[bot]
96db57f36f fix: set XDG_CURRENT_DESKTOP env var back to original value before invoking xdg utils (#46789)
fix: set `XDG_CURRENT_DESKTOP` env var back to original value before invoking xdg utils (#45310)

* Fix XDG_CURRENT_DESKTOP before invoking XDGUtil

* apply suggestion

* use existing XDG_CURRENT_DESKTOP const

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Evan Simkowitz <esimkowitz@users.noreply.github.com>
2025-04-25 15:23:04 -05:00
trop[bot]
ffe6656d2f fix: bluetooth crash in select-bluetooth-device event (#46784)
fix: bluetooth crash on bluetooth off

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-25 15:01:12 -05:00
trop[bot]
fbc175aa1f docs: Add ObjC/macOS tutorial (#46786)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
2025-04-25 11:00:21 -05:00
trop[bot]
b123b07d87 fix: vibrancy window border (#46772)
fix: vibrancy window border (#46648)

* fix: vibrancy window border

* Use WidgetDelegate::OnWidgetInitialized instead

Co-authored-by: Calvin <clavin@users.noreply.github.com>
2025-04-25 11:35:32 -04:00
trop[bot]
d605b97f9a fix: missing HandleScope in RemoveFromParentChildWindows (#46774)
fix: missing HandleScope in RemoveFromParentChildWindows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-25 11:30:00 -04:00
trop[bot]
d2134f84e1 fix: crash when renderer process crashes while webview is reloading (#46769)
WebView uses WebContentsViewChildFrame, which doesn't have a Focus impl
and triggers a fatal NOTREACHED.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jinli Wu <wujinli@bytedance.com>
2025-04-25 13:12:54 +02:00
trop[bot]
0f73bba452 fix: crash on reconversion with google IME and editcontext on macOS (#46700)
* fix: crash on reconversion with google IME and editcontext on macOS

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

* chore: update .patches

* Trigger CI

* chore: fix patch indices

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-23 11:00:49 +02:00
trop[bot]
ee54727582 build: don't kill ssh sessions on checkout failure (#46717)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-22 11:31:35 -05:00
trop[bot]
f6f9e23fe2 fix: stop menu minimization if set false (#46715)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>
2025-04-22 09:44:36 -05:00
trop[bot]
6e56fed2cb fix: file dialog filters not working correctly (#46721)
fix: fix file dialog filters not working correctly

If someone sets an `All filter` with `*` at the start of the filters all upcoming filters will be shifted and thus labels won't fit to the extensions they actually filter.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Kolja Lampe <razzeee@gmail.com>
2025-04-22 09:28:23 -05:00
trop[bot]
3437927a78 docs: cleanup docs/tutorial/custom-window-styles.md (#46711)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2025-04-22 10:32:54 +02:00
trop[bot]
1543089e2f perf: avoid triple map lookup in ElectronHidDelegate::GetContextObserver() (#46685)
perf: avoid triple map lookup in ElectronHidDelegate::GetContextObserver()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-19 15:13:36 -05:00
trop[bot]
dc9f6ecd54 fix: do not run microtasks in V8Serializer in browser process (#46684)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-04-19 12:18:42 -05:00
trop[bot]
6d07f541b1 refactor: remove WebContentsPermissionHelper::PermissionTypes::KEYBOARD_LOCK (#46679)
refactor: remove electron::WebContentsPermissionHelper::PermissionTypes::KEYBOARD_LOCK

This was added in 344aba0. In the time when this PR initially went up and
when 344aba0 landed, upstream added blink::PermissionTypes::KEYBOARD_LOCK.
Our duplicate copy can be removed.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-19 10:51:35 -05:00
trop[bot]
0675686451 fix: postMessage crash with invalid transferrable (#46666)
* fix: postMessage crash with invalid transferrable

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

* chore: address review feedback

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

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-17 18:23:26 +02:00
trop[bot]
ee04cb9ebe build: update build tools (#46662)
* build: update build tools

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

* chore: fix core.fscache

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

* chore: fix core.preloadindex

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-17 10:56:35 -04:00
trop[bot]
592d0155f1 feat: expose nativeTheme.shouldUseDarkColorsForSystemIntegratedUI (#46599)
feat: expose shouldUseDarkColorsForSystemIntegratedUI

Closes https://github.com/electron/electron/issues/46429.
Refs https://github.com/electron/electron/pull/19735.

This PR adds a new API `shouldUseDarkColorsForSystemIntegratedUI` to the
`nativeTheme` module. This API returns a boolean indicating whether the
system is using dark colors for system integrated UI elements. This is
useful for applications that want to adapt their UI to match the system
theme, especially for those that use system integrated UI elements like
the shell theme or taskbar appearance.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-16 19:40:51 +02:00
electron-roller[bot]
1d2107ebff chore: bump chromium to 134.0.6998.205 (35-x-y) (#46655)
chore: bump chromium in DEPS to 134.0.6998.205

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-04-16 11:26:39 -05:00
Shelley Vohr
3d535afc28 fix: assert.ok in the renderer process (#46632)
* fix: assert.ok in the renderer process

* fix: patch indices
2025-04-15 17:01:34 -04:00
trop[bot]
88a1448b31 fix: window border on Gnome Wayland (#46644)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-15 20:56:30 +02:00
trop[bot]
b2e695c2e2 fix: paint and flash issues on macOS (#46628)
* fix: paint and flash issues on macOS

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

* Adhere to paintWhenInitiallyHidden

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

* fix: patch indices

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-15 20:33:15 +02:00
Filip Mösner
c438ed4790 docs: webContents.opener can be null (#46579) 2025-04-15 12:56:03 +02:00
trop[bot]
b1fdf2a8c7 build: roll build-images (#46635)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-15 11:30:19 +02:00
Shelley Vohr
48a7d5d45b fix: hard crash on invalid command line switches (#46631) 2025-04-14 23:46:24 -05:00
trop[bot]
f2a27511b1 fix: handle potential missing close event property (#46620)
fix: handle missing close event property

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-14 11:23:57 +02:00
trop[bot]
23035a587e refactor: use default printing path when no user options (#46616)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-11 16:15:38 -04:00
trop[bot]
f66c385080 build: ignore files in .git when running markdownlint-cli2 (#46609)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-04-11 11:21:26 +02:00
trop[bot]
323aca8822 fix: remove obsoleted --inspect-brk logic (#46583)
fix: remove obsoleted --inspect-brk logic

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-10 11:17:48 +02:00
trop[bot]
abef5d6eed fix: NativeWindow.window_id() returns same value for all windows (#46591)
fix: NativeWindow.window_id() returns same value for all windows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-09 16:05:41 -05:00
electron-roller[bot]
c6c4ace8ef chore: bump chromium to 134.0.6998.196 (35-x-y) (#46572)
* chore: bump chromium in DEPS to 134.0.6998.196

* chore: e patches all

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-09 12:31:42 -04:00
trop[bot]
f26645e9ab fix: crash on parent window close and focur/blur (#46581)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-09 11:18:47 -05:00
trop[bot]
ef973971a3 refactor: remove unnecessary const_cast (#46568)
refactor: remove unnecessary const_cast

unnecessary since July 2019 in 50b9c70

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-08 17:12:41 -05:00
trop[bot]
17ef6b8885 refactor: use v8::True(isolate) and v8::False(isolate) (#46570)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-08 17:12:08 -05:00
trop[bot]
a2f3d820cb refactor: simplify some BaseWindow JS getters (#46564)
* refactor: return a std::array<int 2> from BaseWindow::GetMaximumSize()

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

* refactor: return a std::array<int 2> from BaseWindow::GetMinimumSize()

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

* refactor: return a std::array<int 2> from BaseWindow::GetPosition()

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

* refactor: return a std::array<int 2> from BaseWindow::GetSize()

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

* refactor: return a std::array<int 2> from BaseWindow::GetContentSize()

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

* refactor: extract helper method ToArray(const gfx::Size)

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

* refactor: #include correctness

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-04-08 14:46:27 -05:00
trop[bot]
7886cc3cd0 refactor: make api::View methods const, private (#46552)
* refactor: make api::View::GetBounds() const

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

* refactor: make api::View::OnViewBoundsChanged() private

refactor: make api::View::OnViewIsDeleting() private

refactor: make api::View::OnChildViewRemoved() private

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

* refactor: make ChildPair private

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-04-08 08:53:02 -05:00
trop[bot]
cbc150486c refactor: make TrackableObjectBase::weak_map_id_ const (#46556)
refactor: make TrackableObjectBase::weak_map_id_ const

simplify declaration and initialization

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-08 07:08:28 -05:00
trop[bot]
1ebad64192 refactor: use base::flat_set in WebContents::DidUpdateFaviconUrl() (#46531)
* refactor: add gin::Converter<std::span>::ToV8()

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

* feat: add ToV8(const base::flat_set<T>&)

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

* perf: use a flat_set in WebContents::TitleWasSet()

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

* refactor: add gin::Converter<std::array>::ToV8()

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-04-07 16:36:37 +02:00
trop[bot]
1fe77cdcf2 docs: note that titleBarOverlay.symbolColor is supported on Linux (#46535)
docs: note that titleBarOverlay.symbolColor is supported on Linux

this is supported via OpaqueFrameView

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-07 14:11:47 +02:00
trop[bot]
446128bc14 revert: allow NSMenuItems to be disabled (#46521)
Revert "fix: allow NSMenuItems to be disabled (#46307)"

This reverts commit ac616ef41d.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Hailey <hschauman@slack-corp.com>
2025-04-06 23:44:59 -05:00
trop[bot]
e76f986aa9 perf: avoid redundant virtual method call in NativeWindowViews::SetEnabledInternal() (#46526)
perf: avoid redundant virtual method call in NativeWindowViews::SetEnabledInternal()

Why waste time make lot call when few call do trick?

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-06 23:44:37 -05:00
trop[bot]
b44892e27c refactor: instantiate navigation_entries local variable on the stack (#46503)
* refactor: instantiate navigation_entries on the stack instead of the heap

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

* refactor: reserve the full size of navigation_entries

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

* refactor: use emplace_back to simplify the code a little

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-04-05 10:45:07 -05:00
trop[bot]
bd134a7f78 refactor: remove unused electron::api::App::FileIconCallback (#46511)
refactor: remove electron::api::App::FileIconCallback

last use removed in 2018 by 3f15f516

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-05 10:44:15 -05:00
trop[bot]
12cae22e22 fix: destroy parent port backend when JS env exits (#46495)
* fix: destroy parent port backend when JS env exits

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

* fix: close parent port before destroying

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-04-04 13:26:44 -05:00
trop[bot]
23bd5c3d98 docs: Add C++/Win32 tutorial (#46489)
* docs: Add C++/Win32 tutorial

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

* Update docs/tutorial/native-code-and-electron-cpp-win32.md

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

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

* Update docs/tutorial/native-code-and-electron-cpp-win32.md

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

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

* Update docs/tutorial/native-code-and-electron-cpp-win32.md

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

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

* Update docs/tutorial/native-code-and-electron-cpp-win32.md

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

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

* Update docs/tutorial/native-code-and-electron-cpp-win32.md

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

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

* docs: make linter happy

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-04 08:59:11 -05:00
trop[bot]
785193e858 fix: don't copy 'package.json's out of ASAR file (#46478)
* fix: don't copy 'package.json's out of ASAR file

New Node.js module resolution system reads `package.json` from imported
modules by reading from the file natively in C++ without calling into
`fs.readFileSync`. The ASAR FS wrapper code had copied files out into a
temporary folder as a workaround, but it is inefficient and does not
cover all module resolution mechanisms in Node.js.

In this change we expose `overrideReadFileSync` method on the `modules`
binding in Node.js, and use this override to call into ASAR-supporting
`fs.readFileSync`.

Co-authored-by: Fedor Indutny <indutny@signal.org>

* chore: remove erroneous patch

* chore: re-add line ending

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Fedor Indutny <indutny@signal.org>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-03 22:26:44 -07:00
trop[bot]
3e4810484a fix: zlib pointer alignment (#46461)
fix: fix zlib pointer alignment

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-03 20:36:05 -05:00
trop[bot]
e4554f9536 fix: gin_helper::Promise in GPUInfoManager must be destroyed before destroying Node/V8 (#46470)
* fix: gin_helper::Promise in GPUInfoManager must be destroyed before destroying Node/V8

Co-authored-by: Yang Liu <ouyangliu.leo@gmail.com>

* fix: use CleanedUpAtExit to control the lifetime of GPUInfoManager

Co-authored-by: Yang Liu <ouyangliu.leo@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Yang Liu <ouyangliu.leo@gmail.com>
2025-04-03 20:34:52 -05:00
trop[bot]
69a38fa5aa perf: avoid redundant map lookup in HidChooserContext::DeviceChanged() (#46481)
perf: avoid redundant map lookup in HidChooserContext::DeviceChanged()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-03 20:30:36 -05:00
trop[bot]
55e25b437d perf: prefer absl::flat_hash_set over std::set when sorted order is not needed (#46441)
* perf: use an absl::flat_hash_set for UsbChooserContext::ephemeral_devices_

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

* perf: use an absl::flat_hash_set for GlobalMenuBarRegistrarX11::live_windows_

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

* perf: use an absl::flat_hash_set for NativeWindowViews::forwarding_windows_

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

* perf: use an absl::flat_hash_set for OffScreenRenderWidgetHostView::guest_host_views_

perf: use an absl::flat_hash_set for OffScreenRenderWidgetHostView::proxy_views_

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

* perf: use an absl::flat_hash_set for NativeWindow::injected_frames_

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

* perf: use an absl::flat_hash_set for NativeWindow::background_throttling_sources_

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-04-03 20:28:53 -05:00
trop[bot]
6048985cc8 perf: avoid redundant call to virtual methods GetProcess() and GetID() (#46444)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-03 18:41:44 -05:00
trop[bot]
3277481681 fix: NativeWindowViews::GetRestoredState() can return wrong state when maximized (#46464)
fix: NativeWindowViews::GetRestoredState() returning wrong state

Introduced by the af58931 Chromium 131.0.6744.0 roll, specifically
https://github.com/electron/electron/pull/43948/commits/9840662#diff-f9d7ef7

98406626

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-03 17:50:44 -05:00
trop[bot]
3343975488 fix: ensure maximize is emitted when reduce motion is enabled on macOS (#46465)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2025-04-03 11:26:48 -07:00
trop[bot]
71150ffe56 perf: have ErrorThrower lazily lookup the current isolate (#46417)
perf: have ErrorThrower lazy-lookup the current isolate

ErrorThrower's default constructor is marked as "should rarely if ever
be used" because it's expensive to call.

Unfortunately, nearly every instance of ErrorThrower comes as an argument
in gin_helper's JS-->C++ function marshalling where a thrower is
default-constructed and then populated in gin_helper::GetNextArgument()
with an assignment operator to a temporary ErrorThrower constructed
with the gin::Arguments' isolate.

tldr: most of the time we use the slow constructor first, then throw
that work away unused by overwriting with a fast-constructed one.

This refactor avoids that cost by deferring the expensive work to
`ErrorThrower::isolate()`, where it happens only as a fallback iff
isolate_ hasn't been set.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-01 20:53:22 -05:00
trop[bot]
8bca8d2b9d build: make it clearer when cookie auth runs (#46423)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-01 19:39:38 -04:00
trop[bot]
f3d7a9043d perf: cache the return value of IsX11() (#46425)
* perf: cache the return value of IsX11()

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

* fix: mark as nodiscard for those who call, but mark as maybe_unused for Windows

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-04-01 17:55:25 -05:00
trop[bot]
cf559d7c72 fix: leaked gfx::Canvas in AutofillPopupView::OnPaint() (#46413)
* perf: avoid redundant call to popup_bounds_in_view()

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

* refactor: use a std::optional<> for paint_canvas local

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

* fix: fix leaked gfx::Canvas in AutofillPopupView::OnPaint()

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

* refactor: remove redundant get() call when testing smart pointer for nonempty

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

* refactor: remove unnecessary draw_canvas variable

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

* refactor: rename bitmap to offscreen_bitmap for symmetry

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

* refactor: avoid another redundant call to popup_bounds_in_view()

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-04-01 16:45:48 -05:00
trop[bot]
d025ab4995 perf: avoid redundant map lookup in UsbChooserContext::OnDeviceRemoved() (#46419)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-01 16:45:30 -05:00
trop[bot]
a644c7029a fix: rounded corners disappear momentarily on window close (#46408)
fix: Explicitly set rounded corners in borderless mode on Windows 11

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: zoy <zoy-l@outlook.com>
2025-04-01 13:28:37 -05:00
trop[bot]
13488d3c98 fix: UtilityProcess.fork crash before app ready (#46403)
fix: UtilityProcess.fork crash before app ready

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-01 14:09:16 -04:00
trop[bot]
d0658ccc98 perf: avoid unnecessary vector copy in GetMimeTypeToExtensionIdMap() (#46395)
* perf: avoid making an unnecessary copy of the vector

MimeTypesHandler::GetMIMETypeAllowlist() returns a const&, so we can
iterate that directly instead of making a temporary copy of it.

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

* perf: move the call to ExtensionRegistry::Get() outside of the loop

Also, keep the previous behavior of not calling it at all if there
aren't any whitelisted extensions.

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

* perf: avoid redundant map lookup

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

* refactor: const correctness

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

* refactor: cleanup

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-04-01 09:07:45 -05:00
trop[bot]
c95323051a fix: flicker and ghosting in transparent windows on macOS (#46392)
* fix: transparent flicker on MAS

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

* Gate condition on `IsTranslucent` instead

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-04-01 10:35:30 +02:00
trop[bot]
ff0156e67b refactor: use v8::String::Empty() when creating empty strings (#46372)
refactor: use v8::String::Empty() when creating empty strings

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-31 08:56:53 -05:00
trop[bot]
65f9f08187 perf: prefer absl::flat_hash_set over std::unordered_set (#46374)
* perf: use absl::flat_hash_set in SpellCheckClient::SpellCheckText()

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

* perf: use absl::flat_hash_set in MessagePort::DisentanglePorts()

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-03-31 08:25:16 -05:00
trop[bot]
15d2a7dc4c perf: improve temporaries in WebWorkerObserver::WorkerScriptReadyForEvaluation() (#46377)
refactor: small refactor to WebWorkerObserver::WorkerScriptReadyForEvaluation()

- replace a std::vector<std::string> local with a compile-time array
  of std::string_view
- remove .c_str() pessimization when making v8 Strings from string_views

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-31 07:33:00 -05:00
trop[bot]
073df4e738 perf: avoid 3x call to GetID() in RegisterPendingSiteInstance() (#46358)
perf: avoid 3x call to GetID() in RegisterPendingSiteInstance()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-29 10:59:47 -05:00
trop[bot]
c3127249e4 perf: avoid double map lookup in HidChooserContext::DeviceRemoved() (#46361)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-29 08:30:44 -05:00
trop[bot]
a842911215 perf: avoid a double-map lookup in NotificationPresenter::RemoveNotification() (#46356)
perf: avoid a double-map lokup in NotificationPresenter::RemoveNotification()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-29 08:12:04 -05:00
trop[bot]
b51d9976d0 perf: avoid redundant map lookups in GetStorageMask() (#46345)
* perf: avoid a redundant map lookuop in GetStorageMask()

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

* perf: avoid a redundant map lookup in GetDataTypeMask()

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-03-28 10:57:59 -05:00
trop[bot]
46d9bd8b4a fix: allow NSMenuItems to be disabled (#46341)
* fix: disable NSMenu autoenable feature to allow disabling of NSMenuItems

Co-authored-by: Hailey Schauman <hschauman@slack-corp.com>

* style: fix linter issues and update comments

Co-authored-by: Hailey Schauman <hschauman@slack-corp.com>

* chore: remove unneeded comment

Co-authored-by: Hailey <hschauman@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Hailey Schauman <hschauman@slack-corp.com>
2025-03-28 00:02:46 -05:00
trop[bot]
f527b982b5 build: validate Chromium cookie authentication (#46327)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-27 17:45:12 -07:00
Robo
60427961a2 fix: emit context-menu event in Windows draggable regions (#46334)
fix: emit `context-menu` event in Windows draggable regions (#46032)

fix: emit context-menu event in Windows draggable regions

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-27 19:21:17 -05:00
trop[bot]
929cba26c2 perf: avoid double map lookup in WebFrameMain::UpdateRenderFrameHost() (#46329)
perf: avoid double map lookup in WebFrameMain::UpdateRenderFrameHost()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-27 18:12:11 -05:00
trop[bot]
94926b734c perf: avoid a triple-redundant map lookup in ViewsDelegate::GetAppbarAutohideEdges() (#46333)
perf: avoid a triple-redundant map lookup in ViewsDelegate::GetAppbarAutohideEdges()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-27 18:10:38 -05:00
trop[bot]
dc4233fd40 build: roll build-images SHAs (#46319)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-27 14:36:53 +01:00
electron-roller[bot]
ac20d29095 chore: bump chromium to 134.0.6998.179 (35-x-y) (#46313)
* chore: bump chromium in DEPS to 134.0.6998.179

* chore: remove patches/chromium/cherry-pick-b8f80176b163.patch

it is present in this chromium roll

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-27 10:08:50 +01:00
trop[bot]
2b4716253d fix: crash when drag-dropping some files (#46311)
* fix: crash when drag-dropping some files

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

* fix: extra destination context scope

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-03-26 22:23:24 -05:00
Keeley Hammond
39cbd0c27c chore: reconcile Chrome roll patches (#46314)
chore: reconcile chrome roll patches
2025-03-26 19:46:31 -07:00
trop[bot]
cd5da1b933 perf: avoid redundant map lookup in WebContents::DevToolsIndexPath() (#46296)
perf: avoid double map lookup in WebContents::DevToolsIndexPath()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-26 20:03:50 -05:00
trop[bot]
3023f14bdd perf: avoid std::map temporaries in WebContents::DevToolsRequestFileSystems() (#46308)
* perf: move the GetDevToolsWebContents() call outside of the loop

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

* perf: remove std::map temporary in WebContents::DevToolsRequestFileSystems()

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

* refactor: remove unused GetAddedFileSystemPaths()

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

* perf: remove std::vector temporary in WebContents::DevToolsRequestFileSystems()

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-03-26 19:25:59 -05:00
trop[bot]
fe445869ca fix: set userAgent on navigationHistory.restore() (#46300)
fix: set userAgent on navigationHistory restore

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-26 19:11:39 -05:00
electron-roller[bot]
f9164968d6 chore: bump chromium to 134.0.6998.178 (35-x-y) (#46287)
chore: bump chromium in DEPS to 134.0.6998.178

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-03-26 18:35:21 -05:00
trop[bot]
e0014f507f perf: avoid redundant map lookup in AddComponentResourceEntries() (#46288)
* perf: avoid double map lookup in ElectronComponentExtensionResourceManager::AddComponentResourceEntries()

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

* perf: move the path key when calling try_emplace()

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-03-26 18:04:15 -05:00
Pedro Pontes
44afb48112 chore: cherry-pick 1 changes from 3-M134 (#46303)
chore: [35-x-y] cherry-pick 1 changes from 3-M134

* b8f80176b163 from chromium
2025-03-26 15:50:38 -07:00
trop[bot]
6e112a8410 fix: build failure when printing is disabled (#46285)
fix: ftbfs when printing is disabled

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-26 12:48:46 +01:00
trop[bot]
c6c67208d2 refactor: add ElectronBrowserContext::GetDefaultBrowserContext() (#46085)
* refactor: add ElectronBrowserContext::DestroyAllContexts()

Simpler semantics than previous implementation; also hides the
"default context must be destroyed last" implementation detail.

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

* refactor: add ElectronBrowserContext::GetDefaultBrowserContext()

clearer semantics than everyone calling From("", false)

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

* fixup! refactor: add ElectronBrowserContext::DestroyAllContexts()

fix: collision with 998de7a

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-26 11:31:31 +01:00
trop[bot]
a3ba653bee perf: avoid redundant map lookup in WebFrameMain constructor (#46275)
perf: avoid double map lookup in WebFrameMain constructor

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-25 22:06:22 -04:00
trop[bot]
7a950f09ae build: fixup windows source cache for release (#46272)
* build: fixup windows source cache for release

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

* build: fixup ffmpeg gn gen

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

* build: add build-tools depot_tools to PATH

There are some cases where it is still expected that depot_tools be in the path

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

* put back regular gn gen for ffmpeg

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

* build: add retry to moving source cache

This resolves the error: `Move-Item : The process cannot access the file because it is being used by another process.`

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-03-25 17:45:38 -07:00
trop[bot]
ac22aa932f perf: avoid std::map temporaries in IsDevToolsFileSystemAdded() (#46265)
* refactor: extract-method GetAddedFileSystems()

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

* refactor: use GetAddedFileSystems() in GetAddedFileSystemPaths()

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

* refactor: use GetAddedFileSystems() in IsDevToolsFileSystemAdded()

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-03-25 14:09:55 -05:00
trop[bot]
d38c2d507e perf: avoid redundant map lookups in GlobalShortcut (#46262)
* perf: avoid redundant map lookup in GlobalShortcut::OnKeyPressed()

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

* perf: avoid redundant map lookup in GlobalShortcut::ExecuteCommand()

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-03-25 13:08:54 -05:00
trop[bot]
7d27b2c542 fix: webContents.printToPDF() with cross-process subframes (#46257)
fix: webContents.printToPDF() with cross-process subframes

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-25 11:35:15 -05:00
trop[bot]
8a120b6b58 fix: oob string read when parsing node_options (#46248)
* fix: oob string read when parsing node_options

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

* chore: re-enable test

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

* fix: missing linux server env for tests

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-03-25 11:44:55 -04:00
trop[bot]
11c1e70384 perf: don't wait for thumbnails if they were not requested on macOS (#46249)
When using the SCK thumbnail capturer, the first refresh has the list of
sources, and the second refresh has the thumbnails. If thumbnails are
not needed, only wait for the first refresh.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Beutner <beutner.john@gmail.com>
2025-03-25 09:08:21 -05:00
trop[bot]
0d9b7d8121 fix: NODE_OPTIONS parsing for child processes on macOS (#46244) 2025-03-25 08:46:54 +01:00
trop[bot]
09ec28b150 fix: handle OnDelegatedSourceListDismissed asynchronously (#46234)
This fixes a crash with the PipeWire capturer caused by a Chromium
change introduced in
https://chromium-review.googlesource.com/c/chromium/src/+/5783826.

DesktopMediaListBase now calls Refresh(true) after dispatching
DesktopMediaListObserver::OnDelegatedSourceListDismissed, so it's
important not to call DesktopCapturer::HandleFailure (which deallocates
the DesktopMediaList) synchronously from OnDelegatedSourceListDismissed.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Beutner <beutner.john@gmail.com>
2025-03-24 17:23:12 -04:00
trop[bot]
a82f92e1d8 build: Use windows src cache (#46186)
* build: use source cache on windows

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

* build: fixup release builds

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-03-24 14:16:44 -04:00
trop[bot]
a2a3f7cf1c fix: ensure TraverseParent bails on resource path exit (#46213)
fix: ensure TraverseParent bails on resource path exit

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-24 12:43:44 -04:00
trop[bot]
262beabdc6 fix: Wayland resizing border (#46224)
* fix: Wayland resizing border

Closes https://github.com/electron/electron/issues/44543
Refs CL:5180720

Fixes an issue where the resizing border didn't work as expected on Wayland windows.

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

* fix: border insets when fullscreen

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-03-24 10:54:56 -05:00
trop[bot]
37f876e3b5 refactor: remove unused weak_factory_ in electron_management_api_delegate.cc (#46220)
refactor: remove unused weak_factory_

Appears to have been added in 3745b76da but never used

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-24 10:53:57 -05:00
trop[bot]
628288f074 refactor: remove unused method ProxyingWebSocket::web_request_api() (#46215)
Appears to have been added in c608d6d7 but never used

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-24 14:47:04 +01:00
trop[bot]
230ecf7e32 refactor: remove unused field ServiceWorkerMain::weak_factory_ (#46204)
refactor: remove unused field ServiceWorkerMain::weak_factory_

Added in a467d06, appears to have never been used

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-23 14:18:00 -05:00
trop[bot]
538cf9ade7 refactor: remove unused method ElectronBrowserContext::GetWeakPtr() (#46198)
* refactor: use forward declaration of MediaDeviceIDSalt in electron_browser_context.h

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

* refactor: remove unused #include from browser_context.h

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

* refactor: remove unused ElectronBrowserContext::GetWeakPtr()

last use removed in Aug 2020 by bac2f46

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-03-22 16:13:37 -05:00
Robo
b13526ecd0 fix: system-context-menu should only fire in draggable regions (35-x-y) (#46178) 2025-03-22 11:11:22 -05:00
electron-roller[bot]
56f17662a5 chore: bump chromium to 134.0.6998.165 (35-x-y) (#46196)
chore: bump chromium in DEPS to 134.0.6998.165

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-03-22 10:43:18 -05:00
trop[bot]
69b80e02e7 refactor: use = default to define trivial destructors (#46191)
refactor: use '= default' to define trivial destructors

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-22 10:14:41 -05:00
trop[bot]
a1d8676e9c refactor: reduce coupling in electron::api::Protocol (#46183)
* refactor: decouple api::Protocol from ElectronBrowserContext

now they do not know about each other

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

* refactor: make electron::api::ProtocolError private

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

* refactor: remove unused isolate arg in Protocol constructor

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

* refactor: use =default for trivial destructor

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-03-21 11:08:59 -05:00
Charles Kerr
998de7aa6c refactor: Add ElectronBrowserContext::BrowserContexts() (35-x-y backport) (#46161)
refactor: Add `ElectronBrowserContext::BrowserContexts()`

* refactor: add ElectronBrowserContext::BrowserContexts()

* refactor: use ElectronBrowserContext::BrowserContexts() in ElectronBrowserMainParts::PostMainMessageLoopRun()

* refactor: use ElectronBrowserContext::BrowserContexts() in ElectronExtensionsBrowserClient::IsValidContext()

* refactor: use ElectronBrowserContext::BrowserContexts() in ElectronExtensionsBrowserClient::BroadcastEventToRenderers()

* refactor: move PartitionKey, BrowserContextMap private

* refactor: add ElectronBrowserContext::IsValidContext()

decouple ElectronExtensionsBrowserClient from the internals of ElectronBrowserContext
2025-03-21 11:50:16 -04:00
electron-roller[bot]
e3d95bb8a4 chore: bump chromium to 134.0.6998.117 (35-x-y) (#46157)
* chore: bump chromium in DEPS to 134.0.6998.117

* 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-03-21 10:20:21 -04:00
trop[bot]
b257f3c660 feat: add ffmpeg.dll to delay load configuration (#46172)
feat: set ffmpeg.dll as a delay-loaded DLL

Updated the /DELAYLOAD linker config in BUILD.gn to set ffmpeg.dll
as a delay-loaded DLL. This reduces startup overhead and prevents unnecessary
loading when ffmpeg-related functionality is not used (e.g., the browser process
was unnecessarily loading it).

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Zonglong Liu <83216456+mai-121@users.noreply.github.com>
2025-03-21 07:49:17 -05:00
trop[bot]
0b37f8cced refactor: make URLPipeLoader private (#46167)
Move the URLPipeLoader class into an anonymous namespace in
electron_url_loader_factory.cc.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-20 22:22:35 -05:00
trop[bot]
4b40bfeb01 build: combine pipewire patches (#46144)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-20 22:12:40 -05:00
trop[bot]
a29490a4e8 fix: webContents.print() crash on Linux (#46147)
fix: webContents.print() crash on Linux

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-20 19:31:46 -05:00
trop[bot]
56b79a3a91 fix: APNS token ids are lowercase ASCII (#46148)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-20 19:31:20 -05:00
trop[bot]
4137488761 refactor: use base::NumberToString() (#46154)
base::NumberToString() is slightly more efficient than
absl::StrFormat("%u").

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-20 18:20:17 -05:00
trop[bot]
a6fe725dab test: fix app.dock for corrected type (#46116)
test: fix app.dock for corrected type

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-20 13:45:47 -05:00
trop[bot]
5f48031c24 build: fail for out of date patches on forks (#46124)
* build: fail for out of date patches on forks

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

* chore: e patches all

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-20 09:58:12 +01:00
trop[bot]
344b0ae3ad docs: use optional chaining for app.dock (#46139)
docs: use optional chaining for app.dock

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-03-19 18:50:05 -05:00
trop[bot]
c2ba6b7a28 build: move set chromium cookie before build tools step (#46098)
build: move set cookie before build tools

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: alice <alice@makenotion.com>
2025-03-19 15:37:43 +01:00
trop[bot]
f3c4f0ecf6 docs: fix types of app.dock (#46102)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-03-18 13:24:40 +01:00
trop[bot]
7d207c7a3b refactor: use GetDefaultStoragePartition() instead of GetStoragePartition(nullptr) (#46084)
refactor: use GetDefaultStoragePartition()

Use GetDefaultStorageParition() instead of GetStoragePartition(nullptr)

- It improves code uniformity, since we use get-default everywhere else
- It's more readable
- It's marginally faster, since GetStoragePartition() has more steps

Added in 49b0a1bf4a

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-18 13:21:03 +01:00
trop[bot]
4b184a89d1 fix: warning in file picker UI (#46074)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-17 10:53:23 +01:00
trop[bot]
73a99ea189 build: fix compound bash conditional in patchup (#46059)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-16 11:16:10 +01:00
trop[bot]
ae55fce5df fix: take Snapped status into account when showing a window (#46040)
* fix: take Snapped status into account when showing a window

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

* fixup! fix: take Snapped status into account when showing a window

fix: bad trop

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-16 11:15:58 +01:00
trop[bot]
7388188015 perf: avoid redundant map lookup in ElectronBrowserContext::From() (#46061)
perf: avoid redundant map lookup in ElectronBrowserContext::FromPath()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-15 13:46:55 -05:00
trop[bot]
65a7dddd4a fix: ElectronBrowserContext raw_ptr bug + remove dead code (#46053)
refactor: remove unused ElectronBrowserContext::extension_system()

Last use removed on Jul 21, 2020 by 2fb14f5 in PR #24575

This fixes a raw_ptr warning by letting us remove the raw_ptr field
`ElectronBrowserContext::extension_system_`.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-15 11:39:34 -05:00
trop[bot]
6bbe996f62 refactor: replace base::StringPrintf() calls with absl::StrFormat() (#46049)
The former is now a pass-through for the latter and is slated for removal

Xref: https://issues.chromium.org/issues/40241565

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

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-15 11:23:10 -05:00
trop[bot]
3ad43182eb refactor: remove unused system header includes (#46042)
* chore: remove unused #include <string>

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

* chore: remove unused #include <optional>

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

* chore: remove unused #include <vector>

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

* chore: remove unused #include <string_view>

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

* chore: remove unused #include <memory>

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

* chore: remove unused #include <utility>

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

* chore: remove unused #include <tuple>

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

* chore: remove unused #include <unordered_set>

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

* chore: remove unused #include <functional>

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

* chore: iwyu <set>

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

* chore: iwyu <map>

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-03-15 00:33:33 -05:00
Charles Kerr
11bdd8cf44 chore: remove redundant patch (#46046)
* chore: remove patches that are already upstreamed

* chore: e patches all
2025-03-14 17:04:22 -05:00
trop[bot]
75cf1b08c3 fix: prevent title change for within page navigation (#46035)
* fix: prevent title change for on page navigation

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

* add back and forward testing

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

* update Chromium comment

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

* remove errant script tag

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>
2025-03-14 09:54:35 -05:00
trop[bot]
c91ddf2609 fix: don't crash Web Workers on unhandled rejections (#46020)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-14 09:58:24 +01:00
trop[bot]
02783dd1e0 fix: package import existence verification (#46022)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-14 09:58:01 +01:00
trop[bot]
11fad1b737 refactor: make a variadic gin_helper::internal::InvokeFactory() (#46028)
refactor: make a variadic gin_helper::internal::InvokeFactory()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-13 23:41:12 -05:00
electron-roller[bot]
de6105dc50 chore: bump chromium to 134.0.6998.88 (35-x-y) (#45972)
chore: bump chromium in DEPS to 134.0.6998.88

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-03-13 16:28:00 -05:00
trop[bot]
385b84ad87 refactor: use private inheritance from mojo::MessageReceiver (#45993)
* refactor: make UtilityProcessWrapper inherit privately from mojo::MessageReceiver

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

* refactor: make ParentPort inherit privately from mojo::MessageReceiver

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

* refactor: make MessagePort inherit privately from mojo::MessageReceiver

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-03-12 23:19:17 -05:00
trop[bot]
7a9b9cdf0b build: roll sysroots to pick up glibc fix (#45983)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-12 11:39:31 +01:00
trop[bot]
de4458ff5c test: fix timing issue in utilityProcess test fixtures (#45975)
* fix: potential timing issue in utilityProcess test

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

* fix: potential timing issue in utilityProcess esm test

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-03-11 23:06:52 +01:00
trop[bot]
dda60cd4ed docs: Add 'Native Code and Electron' (#45967)
* docs: Add 'Native Code and Electron'

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

* docs: Add node-gyp requirements

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

* Update docs/tutorial/native-code-and-electron.md

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

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

* Cross-platform clean command

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

* Mention napi-rs

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

* Apply suggestions from code review

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

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

* Fix lint, fix more comments

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

* Apply suggestions from code review

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

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
2025-03-10 16:45:29 -05:00
trop[bot]
a2aacd7f25 fix: remove redundant MediaCaptureDevicesDispatcher::GetInstance() call (#45962)
fix: remove redundant MediaCaptureDevicesDispatcher::GetInstance() call

This appears to be a copy-paste error introduced in 465dee2c

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-10 14:50:09 -05:00
trop[bot]
702fdac1c4 fix: race condition in utilityProcess tests (#45955)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-10 14:49:29 -05:00
trop[bot]
0b24418ca7 refactor: eliminate duplicate code in spec/api-process-spec.ts (#45951)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2025-03-10 12:24:55 -05:00
trop[bot]
3da65aa53e perf: prefer base::SplitStringPiece() over base::SplitString() (#45946)
* perf: use base::SplitStringPiece() in SetNodeOptions()

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

* perf: use base::SplitStringPiece() in StringToAccelerator()

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

* refactor: StringToAccelerator() now takes a std::string_view

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-03-10 09:49:53 -05:00
Samuel Attard
079b2bbf97 chore: cherry-pick 521faebc8a7c from chromium (#45943) 2025-03-09 16:31:08 -07:00
Samuel Attard
5b15c348e9 chore: cherry-pick 9dacf5694dfd from chromium (#45938) 2025-03-09 16:29:58 -07:00
trop[bot]
10da0d694e fix: javascript heap OOM is not raised (#45911)
fix: javascript heap oom is not raised in node::OOMErrorHandler

node::OOMErrorHandler terminates the process directly without raising an
oom exception. To fix it, set an oom handler into node from electron.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Yang Liu <ouyangliu.leo@gmail.com>
2025-03-07 17:50:23 +01:00
trop[bot]
463031b771 fix: resolve font list in default prefernce values (#45918)
* fix: resolve font list in default prefernce values

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

* chore: fix unsafe buffer usage

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

* docs: add code comment

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-03-07 16:24:09 +01:00
trop[bot]
53d7bd6abd chore: emphasize documentation style guide (#45909)
docs: emphasize documentation style guide

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
2025-03-06 16:13:49 -05:00
trop[bot]
6eb4932c68 fix: setContentProtection(true) after hide on Windows (#45889)
fix: content protection after hide on Windows

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

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-03-05 06:13:36 +01:00
trop[bot]
179fde9278 fix: correct electron gin embedder indices (#45879)
fix: correct gin embedder indices.

Move electron extra embedders to the end of the enum so they do not
interfere with chromium embedders indices.
Also use kEmbedderBlinkTag directly in its index calculation without
adding extra indices from other tags.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Marek Haranczyk <marek@openfin.co>
2025-03-04 13:55:17 +01:00
Shelley Vohr
107b3f8580 fix: rework and improve legacyMainResolve patch (#45878)
fix: rework and improve legacyMainResolve patch
2025-03-03 15:14:51 -08:00
trop[bot]
d98d95b04f docs: update timelines for E36 (#45849)
Update electron-timelines.md

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
2025-02-28 12:24:03 +01:00
Charles Kerr
5874ec779c docs: update breaking-changes.md for 35.0.0 (#45847) 2025-02-28 11:24:09 +01:00
electron-roller[bot]
8505f7a73d chore: bump chromium to 134.0.6998.44 (35-x-y) (#45845)
chore: bump chromium in DEPS to 134.0.6998.44

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-02-27 22:00:12 -06:00
electron-roller[bot]
fc288849db chore: bump chromium to 134.0.6998.35 (35-x-y) (#45835)
* chore: bump chromium in DEPS to 134.0.6998.35

* Add UseCounter for potential PNA 2.0 breakage

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

(cherry picked from commit 1d9a4bf22a)

* chore: update patches

* fix: duplicate crdtp symbols

(cherry picked from commit 161931bc5b)

* chore: fixup build_option_to_use_custom_inspector_protocol_path.patch

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-27 20:03:44 -05:00
trop[bot]
b6d61577aa fix: context-menu event emitted in draggable regions (#45841)
* fix: context-menu event emitted in draggable regions

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

* fix: only trigger on mouse release

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-02-27 16:07:54 -06:00
Charles Kerr
260933601e chore: remove patch that's already upstreamed (#45838)
* chore: remove check_for_unit_to_activate_before_notifying_about_success.patch

This is already in 134.0.6998.23, we do not need to cherry-pick it

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

* chore: e patches all
2025-02-27 14:22:27 -06:00
trop[bot]
18007f843e feat: support global shortcuts via GlobalShortcutsPortal feature with ozone/wayland (#45297) 2025-02-27 11:33:12 +01:00
trop[bot]
4417f74a5b refactor: simplify Invoker::IsOK() (#45818)
* refactor: simplify Invoker::IsOK()

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

* refactor: might as well make it [[nodiscard]] as well

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-02-27 00:46:32 -06:00
trop[bot]
8a200e0427 refactor: remove unused gin_helper::WrappableBase::GetWrapper(v8::Isolate*) (#45808)
refactor: remove unused EventEmitter::GetWrapper(v8::Isolate*)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-25 22:51:45 -06:00
trop[bot]
7a0abfd667 fix: re-enable MacWebContentsOcclusion feature flag (#45801)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2025-02-25 11:19:59 -08:00
trop[bot]
255e4e22e4 build: re-enable unsafe buffer checks (#45797)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-25 12:36:46 -05:00
trop[bot]
c32fcdfede feat: remove osr framerate limit when use shared texture (#45781)
feat: remove framerate limit, if use shared texture osr.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: reito <cnschwarzer@qq.com>
2025-02-25 08:12:25 +01:00
trop[bot]
a9c535d900 refactor: remove unused v8::Isolate* arg from GlobalShortcut constructor (#45795)
refactor: remove unused isolate arg from GlobalShortcut constructor

has not been used since f1a0d5e811 (#22755)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-25 00:06:07 -06:00
trop[bot]
aa584714cd refactor: do not use AdaptCallbackForRepeating() in electron_api_url_loader.cc (#45784)
refactor: do not use AdaptCallbackForRepeating in electron_api_url_loader.cc

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-24 14:42:28 -06:00
electron-roller[bot]
24bc99cc2f chore: bump chromium to 134.0.6998.23 (35-x-y) (#45523)
* chore: bump chromium in DEPS to 134.0.6998.3

* chore: bump chromium in DEPS to 134.0.6998.15

* chore: bump chromium in DEPS to 134.0.6998.23

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-24 15:16:32 -05:00
trop[bot]
248104ece6 fix: drag and drop icons on Windows (#45777)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-02-24 18:38:42 +01:00
Charles Kerr
0a543f389d fix: crash loading about:blank in subframes (35-x-y) (#45758)
* fix: crash loading `about:blank` in subframes (#45694)

fix: crash loading about:blank in subframes

* chore: e patches all

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-23 11:42:51 +01:00
trop[bot]
768daef27b refactor: use base's map utills in WebFrameMain (#45761)
refactor: use base::FindPtrOrNull() in WebFrameMain::FromFrameTreeNodeId()

refactor: use base::FindPtrOrNull() in WebFrameMain::FromFrameToken()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-22 09:46:16 -06:00
trop[bot]
8e32d80512 fix: re-enable synchronous spellcheck on Windows (#45763)
* fix: re-enable synchronous spellcheck on Windows

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

* revert: fix: empty suggestions with windows platform checker

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-21 20:46:13 -06:00
Charles Kerr
4c81971213 refactor: use C++20's contains() method (35-x-y) (#45768)
refactor: use C++20's contains() method (#45742)

* chore: use std::map<>::contains() instead of count() or find()

* chore: use std::map<>::contains() instead of base::Contains()
2025-02-21 20:45:54 -06:00
trop[bot]
2da02ec9bc docs: clarify navigationhistory offsets (#45766)
* docs: clarify navigationhistory offsets

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

* "relative offset"

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>
2025-02-21 18:13:38 -06:00
trop[bot]
05b57a2f07 fix: crash on getUserMedia with invalid chromeMediaSourceId (#45755)
* fix: crash on getUserMedia with invalid chromeMediaSourceId

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

* test: add a test

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-21 22:19:03 +01:00
trop[bot]
4cb9c44d97 build: skip chromium git cookie on forks (#45738)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-21 11:52:17 -05:00
trop[bot]
51babe4592 refactor: bluetooth in serial chooser when exclusively wireless serial ports are expected (#45743)
* refactor: bluetooth in serial chooser when exclusively wireless serial ports are expected

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

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

* chore: review feedback

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-02-21 10:30:34 -06:00
trop[bot]
4015b8c48e refactor: use base::as_byte_span() in EncodeToken(). (#45752)
This matches the change in upstream's serial_chooser_context.cc.

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

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-21 10:25:34 -06:00
trop[bot]
671178cfdb refactor: use base::as_bytes() in WriteAsciiChunk() (#45748)
refactor: use base::as_bytes() in WriteAsciiChunk()

this avoids a reinterpret_cast and a static_cast

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-21 10:25:03 -06:00
trop[bot]
3a65cfe339 feat: allow setting roundedCorners on Windows (#45740)
* feat: allow setting roundedCorners on Windows

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

* Update docs/api/structures/base-window-options.md

Co-authored-by: Will Anderson <will@itsananderson.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-02-21 10:15:02 -06:00
trop[bot]
8934eb1af5 refactor: use base::as_string_view() (#45745)
Use `base::as_string_view()` as a safer alternative to `reinterpret_cast`
in a couple of places.

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

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-21 10:14:05 -06:00
trop[bot]
02b85f1e6d fix: crash parsing CLSID in shell.readShortcutLink() (#45348)
* fix: crash parsing CLSID in shell.readShortcutLink

Co-authored-by: David Lönnhager <david.l@mullvad.net>

* fix: ignore clsid if it could not be set

Co-authored-by: David Lönnhager <david.l@mullvad.net>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Lönnhager <david.l@mullvad.net>
2025-02-20 20:21:35 -05:00
Alice Zhao
5a641e02ee feat: add excludeUrls and modify urls in WebRequestFilter for better URL filtering (#45678)
* feat: add excludeUrls and modify urls in WebRequestFilter for better URL filtering (#44692)

* feat: add excludeUrls to web request filter

* refactor: add deprecated field

* test: update tests

* lint: newline

* docs: improve API doc

* fix: add is filter defined property to match all urls

* refactor: remove includeUrls

* refactor: remove typescript binding

* refactor: all_url

* refactor: remove isDefined methods

* refactor: remove comment

* fix: logic

* docs: add to breaking changes

* docs: remove unneeded section
2025-02-20 15:54:58 -05:00
electron-roller[bot]
d291fa6ced chore: bump node to v22.14.0 (35-x-y) (#45641)
* chore: bump node in DEPS to v22.14.0

* src: move more crypto impl detail to ncrypto dep

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

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

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

* module: add findPackageJSON util

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

* module: mark evaluation rejection in require(esm) as handled

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

* chore: fixup patch indices

* deps: move inspector_protocol to deps

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

* fixup! src: move more crypto impl detail to ncrypto dep

* fixup! deps: move inspector_protocol to deps

* fixup! src: move more crypto impl detail to ncrypto dep

* crypto: fix checkPrime crash with large buffers

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

* tls: fix error stack conversion in cryptoErrorListToException()

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

* module: add findPackageJSON util

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

Our revert of native legacyMainResolve makes this very difficult to make
work, so disable for now.

* lib: add typescript support to STDIN eval

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

* chore: fix patch

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-20 08:56:51 +01:00
trop[bot]
f29559e46c fix: possible timing issue in utility-process spec (#45727)
This fixture has been calling process.exit() immediately after writing
to stdout and stderr, which the Node.js docs say is risky behavior:

> Calling process.exit() will force the process to exit as quickly as
> possible even if there are still asynchronous operations pending that
> have not yet completed fully, including I/O operations to
> process.stdout and process.stderr.

This fixture's been around for years without problems (AFAIK).
The writes are very small ('hello\n' and 'world') and finish quickly.
But recently I've been testing on a very slow CI machine. There, I see
this spec flaking when it expects stderr to be 'world' but it gets ''.

This PR changes the fixture to wait for stdout & stderr to flush
before calling process.exit().

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-20 08:55:02 +01:00
trop[bot]
3ad2989862 chore: skip flaky contentTracing test (#45714)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-20 08:20:54 +01:00
trop[bot]
8ea1f5b604 refactor: track downloads by guid (#45718)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-20 08:17:18 +01:00
trop[bot]
b63be7b5c7 fix: extension web workers net request failing (#45708)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2025-02-19 22:59:24 -05:00
trop[bot]
11d1f063bd build: remove appveyor bake (#45682)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-19 15:56:58 -05:00
trop[bot]
eb456ec5cd chore: disable 'should lock the keyboard' test on macOS (#45689)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-19 15:21:38 -05:00
trop[bot]
c92a02ea17 chore: bump chromium to 134.0.6998.10 (35-x-y) (#45585)
* chore: bump chromium to 134.0.6992.0

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

* chore: add BrowserProcessImpl::CreateGlobalFeaturesForTesting() stub

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

Remove GlobalFeatures from TestingBrowserProcess::Init

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

* chore: bump chromium to 134.0.6994.0

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

* 6208630: Mac sandbox: don't use protobuf for policy serialization | https://chromium-review.googlesource.com/c/chromium/src/+/6208630

Co-authored-by: alice <alice@makenotion.com>

* Remove HasUnsupportedFeature Mojo interface

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

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

* 6217444: Remove scoped_gdi_object.h type aliases. | https://chromium-review.googlesource.com/c/chromium/src/+/6217444

Co-authored-by: alice <alice@makenotion.com>

* chore: bump chromium to 134.0.6998.10

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

* 6221378: Revert [OBC] Exclude Aliasing Cookies in FilterCookiesWithOptions() | https://chromium-review.googlesource.com/c/chromium/src/+/6221378

Co-authored-by: alice <alice@makenotion.com>

* Update ExtensionPrefs::GetDisableReasons to return DisableReasonSet

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

change copied from 6218840 extensions/shell/browser/shell_extension_loader.cc

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

* 6218402: Typemap ui.gfx.DXGIHandle <=> gfx::DXGIHandle | https://chromium-review.googlesource.com/c/chromium/src/+/6218402

Co-authored-by: alice <alice@makenotion.com>

* chore: disable flaky contentTracing test

not new to this roll; it is happening in main as well

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

* fixup! chore: disable flaky contentTracing test

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

* chore: update patches

* chore: disable flaky content tracing tests on Linux (#45612)

(cherry picked from commit a1e4550c9e)

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: alice <alice@makenotion.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-19 12:09:35 +01:00
trop[bot]
74c71dbb2d fix: dangling speculative frames (#45686)
* fix: dangling speculative frames

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

* harden lifecycle state checks

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

* feedback

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

* add const

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-18 21:04:36 -05:00
trop[bot]
497849bf66 chore: deprecate systemPreferences.isAeroGlassEnabled() (#45554)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2025-02-18 16:29:41 -05:00
trop[bot]
277a80da98 fix: asan build on macOS (#45569)
* fix: asan build on macOS

Co-authored-by: deepak1556 <hop2deep@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: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-18 16:23:20 -05:00
trop[bot]
fc6a602929 fix: osr stutter fix backport for electron. (#45660)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: reito <cnschwarzer@qq.com>
2025-02-18 20:59:04 +01:00
trop[bot]
bdab736f08 fix: win.closeFilePreview recreates panel when called twice (#45664)
* fix: close quick look during tests on macOS

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

* use longer delay 🤷

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

* fix: sharedPreviewPanel being recreated on close

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

* test: ensure preview panel gets closed

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-18 09:59:55 +01:00
trop[bot]
3c6e75e22d build: run source cache clean daily (#45656)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-18 09:56:45 +01:00
trop[bot]
9a7f27d845 feat: Restore webContents navigation history and page state (#45583)
* feat: Working navigationHistory.restore with just title/url

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

* feat: Restore page state, too

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

* chore: Docs, lint, tests

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

* Implement feedback

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

* More magic

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

* Make _awaitNextLoad truly private

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

* Implement API group feedback

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

* One more round of feedback

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
2025-02-17 11:23:18 +01:00
trop[bot]
b2b59a6c0b fix: pointer lock permission after focus loss and regain (#45628)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-17 11:22:57 +01:00
trop[bot]
b6884b5c50 fix: osr crash on window close (#45630)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-17 11:21:36 +01:00
trop[bot]
fa0da6f19f fix: support for v8.setHeapSnapshotNearHeapLimit api (#45632)
* fix: support for v8.setHeapSnapshotNearHeapLimit api

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

* docs: add support

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-02-17 13:23:38 +09:00
trop[bot]
cf85d2d7c1 build: make sure chromium cookie is set everywhere (#45637)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-14 15:49:40 -05:00
electron-roller[bot]
bc163a5ea8 chore: bump node to v22.13.1 (35-x-y) (#45216)
* chore: bump node in DEPS to v22.13.0

* chore: bump node in DEPS to v22.13.1

* src: move evp stuff to ncrypto

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

* crypto: add Date fields for validTo and validFrom

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

* module: fix discrepancy between .ts and .js

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

* esm: do not interpret "main" as a URL

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

* src: modernize likely/unlikely hints

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

* chore: update patch indices

* crypto: add validFromDate and validToDate fields to X509Certificate

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

* chore: fixup perfetto patch

* fix: clang warning in simdjson

* src: add receiver to fast api callback methods

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

* chore: fixup revert patch

* fixup! esm: do not interpret "main" as a URL

* fixup! crypto: add Date fields for validTo and validFrom

* fix: move ArrayBuffer test patch

* src: fixup Error.stackTraceLimit during snapshot building

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

* fix: bad rebase

* chore: fixup amaro

* chore: address feedback from review

* src: revert filesystem::path changes

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

* chore: fixup GN build file

* https://github.com/nodejs/node/pull/55529
* https://github.com/nodejs/node/pull/55798
* https://github.com/nodejs/node/pull/55530

* module: simplify --inspect-brk handling

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

* src: fix outdated js2c.cc references

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

* crypto: include openssl/rand.h explicitly

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

* build: use variable for crypto dep path

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

* crypto: fix RSA_PKCS1_PADDING error message

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

* build: use variable for simdutf path

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

* test,crypto: make crypto tests work with BoringSSL

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

* fix: suppress clang -Wdeprecated-declarations in libuv

https://github.com/libuv/libuv/pull/4486

* deps: update libuv to 1.49.1

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

* test: make test-node-output-v8-warning more flexible

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

* [v22.x] Revert "v8: enable maglev on supported architectures"

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

* fix: potential WIN32_LEAN_AND_MEAN redefinition

https://github.com/c-ares/c-ares/pull/869

* deps: update nghttp2 to 1.64.0

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

* src: provide workaround for container-overflow

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

* build: use variable for simdutf path

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

* chore: fixup patch indices

* fixup! module: simplify --inspect-brk handling

* lib: fix fs.readdir recursive async

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

* lib: avoid excluding symlinks in recursive fs.readdir with filetypes

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

This doesn't currently play well with ASAR - this should be fixed in a follow up

* test: disable CJS permission test for config.main

This has diverged as a result of our revert of
src,lb: reducing C++ calls of esm legacy main resolve

* fixup! lib: fix fs.readdir recursive async

* deps: update libuv to 1.49.1

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

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-14 15:53:34 +01:00
Charles Kerr
b52917c380 refactor: use node::tracing::Agent() directly (35-x-y) (#45619)
* refactor: use node::tracing::Agent()

* chore: e patches all

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-14 11:02:19 +01:00
trop[bot]
cd1186a116 chore: change node test timeout from 20m to 30m (#45623)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-14 10:59:41 +01:00
trop[bot]
f1176be749 build: remove PDF edited saved files patch (#45614)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-14 10:57:43 +01:00
trop[bot]
aacbdaf4ec fix: avoid IPC for renderer webFrame.getZoom... APIs (#45557)
* fix: avoid IPC for renderer `webFrame.getZoom...` APIs

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

* Remove `DoGetZoomLevel` IPC

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

* Fix synchronous behavior & nullptr deref

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

* Use local root

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-02-13 12:53:59 +01:00
trop[bot]
5b90ce2290 refactor: follow upstream's suggestions on when to use EmptyGURL() (#45521)
- Prefer GURL() when we want to return a non-reference empty URL.

- In ServiceWorkerMain::GetStorageKey(), use a reference instead
  of instantiating a new temporary GURL.

From url/gurl.h:

> // Returns a reference to a singleton empty GURL. This object is for
> // callers who return references but don't have anything to return in
> // some cases. If you just want an empty URL for normal use, prefer
> // GURL().

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-13 11:30:40 +01:00
trop[bot]
8fb9fd97df build: set chromium cookie on depot tools requests (#45599)
* build: set chromium cookie on depot tools requests

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

* build: correct secrets syntax

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

* build: handle windows cmd

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2025-02-13 09:47:04 +01:00
trop[bot]
107c0c6c6e docs: fix grammar in preload tutorial summary (#45558)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Josh Jancourtz <66430238+jcolpal@users.noreply.github.com>
2025-02-12 11:26:37 +01:00
trop[bot]
bca80f19e0 test: disable unexpectedly quit dialog on macOS (#45588)
* test: disable unexpectedly quit dialog on macOS

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

* test: take screenshot before keyboard lock test

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

* Revert "test: take screenshot before keyboard lock test"

This reverts commit 3ba5c6984f.

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-12 09:52:50 +01:00
trop[bot]
66eb15d093 build: make gen-libc++-filenames.js produce the same results on Windows (#45576)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Will Anderson <will@itsananderson.com>
2025-02-11 11:08:08 -05:00
trop[bot]
a1b846c9e5 build: try removing embedder exception patch (#45464)
* build: try removing embedder exception patch

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

* fixup .patches after trop

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-11 12:56:12 +01:00
trop[bot]
71d3a86d32 fix: fix mksnapshot gen/v8 path (#45546)
* fix: fix mksnapshot gen/v8 path

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

* build: use 7z compression

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

* build: unzip mksnapshot on Windows and update zip

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

* chore: escape backslashes

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

* chore: try another attempt

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

* chore: remove rmdir for now

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-02-11 11:37:11 +01:00
trop[bot]
452d891be5 test: make sure test window is on top for focus tests (#45552)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-11 10:02:12 +01:00
trop[bot]
fc697735c4 fix: window maximizing with Mica (#45525)
* fix: window maximizing with Mica

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

* Fix rounded corners after restore

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-02-10 15:38:47 -05:00
trop[bot]
acfe4766d2 chore: bump chromium 134.0.6990.0 (#45524)
* chore: update feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch

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

Partially upstreamed by @codebytere

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

* chore: e patches all

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-02-10 10:35:19 -05:00
trop[bot]
763d978765 docs: transactions-updated event type (#45542)
fix: `transactions-updated` event type

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-02-10 10:22:21 -05:00
trop[bot]
2bce515091 docs: fix powerMonitor event types (#45543)
* fix: powerMonitor event types

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

* fix: thermal-state-change missing Returns

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-10 10:21:56 -05:00
trop[bot]
e15ba780c4 build: make sure there is at least 35GB free for source cache (#45514) 2025-02-10 09:48:10 +01:00
trop[bot]
713d32fccc chore: bump chromium 134.0.6989.0 (#45519)
* chore: bump chromium to 134.0.6989.0

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

* chore: update patches/chromium/cherry-pick-dd8e2822e507.patch

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

* chore: e patches all

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-02-07 14:56:53 -05:00
electron-roller[bot]
3b421ef77f chore: bump chromium to 134.0.6998.3 (35-x-y) (#45460)
* chore: bump chromium in DEPS to 134.0.6998.1

* chore: bump chromium in DEPS to 134.0.6998.5

* chore: bump chromium in DEPS to 134.0.6998.3

* chore: bump chromium to 134.0.6988.0 (main) (#45334)

* chore: bump chromium in DEPS to 134.0.6976.0

* chore: update mas_avoid_private_macos_api_usage.patch.patch
https://chromium-review.googlesource.com/c/chromium/src/+/6171046
process_info_mac.cc -> process_info_mac.mm

* chore: update build_do_not_depend_on_packed_resource_integrity.patch
https://chromium-review.googlesource.com/c/chromium/src/+/6196857

* chore: update feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch
https://chromium-review.googlesource.com/c/chromium/src/+/6182296
https://chromium-review.googlesource.com/c/chromium/src/+/6183404
https://chromium-review.googlesource.com/c/chromium/src/+/6187853

A lot changed in the upstream implementation. There's a good chance I got
this wrong as threading has changed and moved some variables into globals.

* chore: remove build_remove_vr_directx_helpers_dependency.patch
https://chromium-review.googlesource.com/c/chromium/src/+/6186102
This landed upstream

* chore: e patches all

* chore: update net::CookieInclusionStatus::ExclusionReason enum
https://chromium-review.googlesource.com/c/chromium/src/+/6183252
https://chromium-review.googlesource.com/c/chromium/src/+/6185544

* chore: update content::WebAuthenticationDelegate import
https://chromium-review.googlesource.com/c/chromium/src/+/6189769

* Revert "chore: disable focus handling test due to win32/ia32 regression"

This reverts commit 1a57ba5d59.

* chore: bump chromium in DEPS to 134.0.6978.0

* chore: bump chromium in DEPS to 134.0.6980.0

* chore: bump chromium in DEPS to 134.0.6982.0

* chore: bump chromium in DEPS to 134.0.6984.0

* 6196281: Allow direct embedder IsPdfInternalPluginAllowedOrigin() interaction
https://chromium-review.googlesource.com/c/chromium/src/+/6196281

* 6196283: Delete PdfInternalPluginDelegate
https://chromium-review.googlesource.com/c/chromium/src/+/6196283

* chore: update patches

* chore: bump chromium in DEPS to 134.0.6986.0

* chore: update patches

* 6205762: Support option to use window.showSaveFilePicker() in PDF attachment code
https://chromium-review.googlesource.com/c/chromium/src/+/6205762

See also:
* https://issues.chromium.org/issues/373852607
* 5939153: [PDF] Add PdfUseShowSaveFilePicker feature flag | https://chromium-review.googlesource.com/c/chromium/src/+/5939153
* 6205761: Delete spurious Ink-specific code in pdf_viewer.ts | https://chromium-review.googlesource.com/c/chromium/src/+/6205761

* 6209609: Remove WebVector: Automatic changes
https://chromium-review.googlesource.com/c/chromium/src/+/6209609

* 6205488: UI: make QT5 optional
https://chromium-review.googlesource.com/c/chromium/src/+/6205488

* 6178281: Rename pak files from branding strings
https://chromium-review.googlesource.com/c/chromium/src/+/6178281

* fixup! 6209609: Remove WebVector: Automatic changes https://chromium-review.googlesource.com/c/chromium/src/+/6209609

* 6193249: Switch from safe_browsing::EventResult to enterprise_connectors:EventResult
https://chromium-review.googlesource.com/c/chromium/src/+/6193249

* 6197457: Remove Pause/ResumeReadingBodyFromNet IPCs
https://chromium-review.googlesource.com/c/chromium/src/+/6197457

* 6191230: Record total time spent on a picture in picture window
https://chromium-review.googlesource.com/c/chromium/src/+/6191230

* chore: bump chromium in DEPS to 134.0.6988.0

* chore: update patches

* 6215440: Remove base/ranges/.
https://chromium-review.googlesource.com/c/chromium/src/+/6215440

* Disable unsafe buffers error

Not sure what changed, but we're now seeing unsafe buffer errors in Chromium code, at least when using reclient. Will update this comment if we find out the cause.

* 6187853: SelectFileDialogLinuxPortal: Use dbus_xdg::Request and DbusType
https://chromium-review.googlesource.com/c/chromium/src/+/6187853

* fix `setDisplayMediaRequestHandler` test

Given how this test is written, I would expect this assertion to be false. It seems the oppositue was true before, but that was also acknowledged to be suprising. Seems that the underlying implementation is now fixed and works as expected.

* fixup! 6187853: SelectFileDialogLinuxPortal: Use dbus_xdg::Request and DbusType https://chromium-review.googlesource.com/c/chromium/src/+/6187853

* chore: udpate patches

* Multiple PRS: https://chromium-review.googlesource.com/c/chromium/src/+/6185544 | https://chromium-review.googlesource.com/c/chromium/src/+/6183252

* fix: cast enum class to numeric type

* fix: add 1 to MAX_EXCLUSION_REASON because enum values are zero-based, and we want the total count of reasons.

* Reapply "chore: disable focus handling test due to win32/ia32 regression"

This reverts commit 760b1a519b.

* refactor: use ExclusionReasonBitset::kValueCount for size

---------

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: clavin <clavin@electronjs.org>
Co-authored-by: alice <alice@makenotion.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
(cherry picked from commit 213165a467)

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-02-07 11:14:12 -05:00
trop[bot]
9d9d1afb2e refactor: only pass v8::Context to gin_helper::MicrotasksScope constructor (#45503)
refactor: forward v8::Context to v8::MicrotasksScope constructor

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2025-02-07 10:03:31 +01:00
trop[bot]
984b8f9b1b fix: RenderFrameHost nullptr dereference (#45508)
* fix: add nullptr tests before using render_frame_

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

* refactor: extract-method HasRenderFrame()

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-02-07 10:03:01 +01:00
Keeley Hammond
cb7eb6fe3d fix: Update widget visibility in NativeWindowMac::ShowInactive (#45502)
When using `views::WebView` on macOS `NativeWidgetMacNSWindowHost`
contains a layer and compositor responsible for drawing web contents.
To trigger drawing `NativeWidgetMacNSWindowHost::OnVisibilityChanged`
needs to be called and `[NSWindow orderFrontRegardless]` does not trigger
`[NSWindow orderWindow:relativeTo:]` which can change
`NativeWidgetMacNSWindowHost` visiblity with stack:
```
views::NativeWidgetMacNSWindowHost::OnVisibilityChanged(bool)
remote_cocoa::NativeWidgetNSWindowBridge::OnVisibilityChanged()
-[ViewsNSWindowDelegate onWindowOrderChanged:]
-[NativeWidgetMacNSWindow orderWindow:relativeTo:]
```
`views::Widget` has method for showing inactive window:
`views::Widget::ShowInactive` which triggers
`NativeWidgetMacNSWindowHost::OnVisibilityChanged` with stack:
```
views::NativeWidgetMacNSWindowHost::OnVisibilityChanged(bool)
remote_cocoa::NativeWidgetNSWindowBridge::SetVisibilityState(remote_cocoa::mojom::WindowVisibilityState)
views::NativeWidgetMacNSWindowHost::SetVisibilityState(remote_cocoa::mojom::WindowVisibilityState)
views::NativeWidgetMac::Show(ui::mojom::WindowShowState, gfx::Rect const&)
views::Widget::ShowInactive() + 168
```
However this call seems to be insufficient to bring window to front,
therefore `[NSWindow orderFrontRegardless]` still needs to be called.
Calling `views::Widget::ShowInactive` ensures that all logic related to
showing Chromium widget will be properly executed, but onfortunately it
does not call `[NSWindow orderWindow:relativeTo:]` which is used to
disabling headless mode by the `ElectronNSWindow`, therefore we need to
trigger it manually through exposed `[ElectronNSWindow disableHeadlessMode]`.

Fixes: #45415

Co-authored-by: Michał Pichliński <michal.pichlinski@here.io>
2025-02-06 18:40:59 -08:00
Samuel Attard
f1d8e03ef8 chore: cherry-pick dd8e2822e507 from chromium (#45496) 2025-02-06 14:55:54 -08:00
trop[bot]
637313c2f3 test: dump Electron process PID to path if environment variable set (#45494)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-02-06 13:14:38 -06:00
trop[bot]
20941efeb5 fix: handle exclude aliasing in InclusionStatusToString() (#45475) 2025-02-06 13:51:59 +01:00
trop[bot]
7373bde546 fix: WCO not working with some window configurations (#45477) 2025-02-06 13:51:39 +01:00
trop[bot]
acfc32f534 build: always use python3 in script/lib/get-version.js (#45444)
build: always use python3 in script/lib/get-version.js

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-02-05 21:02:29 -05:00
trop[bot]
eaa28375d9 docs: style fixes (#45482)
* docs: fix code field

Co-authored-by: max54nj <contact@max54nj.de>

* docs: add missing space

Co-authored-by: max54nj <contact@max54nj.de>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: max54nj <contact@max54nj.de>
2025-02-05 21:02:05 -05:00
trop[bot]
f40fc49461 feat: view.getVisible() (#45409)
* feat: view.getVisible()

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

* test: visible apis

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

* docs: clarify getVisible

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-05 15:50:00 -05:00
Sam Maddock
a07de0099c feat: service worker preload scripts for improved extensions support … (#45408)
feat: service worker preload scripts for improved extensions support (#44411)

* feat: preload scripts for service workers

* feat: service worker IPC

* test: service worker preload scripts and ipc
2025-02-05 14:18:24 -05:00
trop[bot]
46c9ed61da feat: route deprecated sync clipboard read through permission checks (#45471)
* feat: route deprecated clipboard commands through permission checks

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

* docs: address review feedback

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

* fix: enable checks for child windows

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-02-05 14:10:43 -05:00
Keeley Hammond
51170c3652 build: migrate Windows release builds to GHA (#45465)
* build: migrate Windows release builds to GHA (#45137)

* build: migrate release builds to GHA

* build: alter CI jobs release script

* build: use windows builders for win-publish (#45340)

* build: remove generate-sas-token (#45347)

* build: add win toolchain for release builds (#45380)

* build: add win toolchain for release builds

* build: fix installed_software.json script

* chore: run pwsh script within src

* build: fixup uploader arch
2025-02-04 13:51:49 -08:00
trop[bot]
5be655585d docs: document deletion of databases directory (#45450)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-02-04 08:27:46 -06:00
trop[bot]
04e37266c4 docs: mention C++20 requirement in breaking changes document (#45445)
* docs: mention C++20 requirement in breaking changes document

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

* chore: fix linter issue

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-02-03 16:29:28 -05:00
Shelley Vohr
b0b7c8f540 build: remove outdated Node.js serdes patch (#45430) 2025-02-03 15:17:56 -05:00
electron-roller[bot]
49078100f4 chore: bump chromium to 133.0.6943.35 (35-x-y) (#45217)
* chore: bump chromium in DEPS to 133.0.6943.16

* chore: bump chromium in DEPS to 133.0.6943.27

* chore: bump chromium in DEPS to 133.0.6943.35

* chore: bump chromium to 134.0.6968.0

cherry picked from 75eac86506

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-03 15:10:57 -05:00
trop[bot]
599030ea08 fix: default path not working on KDE Linux (#45420)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-03 20:09:05 +01:00
trop[bot]
07bdef0370 fix: incorrect WCO tooltip in RTL (#45425)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-03 14:05:00 -05:00
Sam Maddock
cc6164fe27 feat: ServiceWorkerMain (#45341) 2025-01-31 12:40:19 -05:00
trop[bot]
59e4794ff5 build: fix slack-github-action for backports (#45403)
build: fix slack-github-action for backports

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-31 09:53:50 -05:00
trop[bot]
fa03b92f7e feat: contextBridge.executeInMainWorld (#45330)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2025-01-31 09:50:44 -05:00
trop[bot]
9d696ceffe feat: redesign preload APIs (#45329)
* feat: redesign preload APIs

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>

* docs: remove service-worker mentions for now

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>

* fix lint

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>

* remove service-worker ipc code

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>

* add filename

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>

* fix: web preferences preload not included

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>

* fix: missing common init

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>

* fix: preload bundle script error

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2025-01-31 09:46:17 -05:00
trop[bot]
e9b3e4cc91 fix: multiple directory selection on Linux (#45394)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-31 09:38:44 +01:00
trop[bot]
895bc51272 build: fixup concurrent builds on protected branches (#45383)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-01-30 10:36:24 +01:00
Keeley Hammond
ef1ad85082 fix: crash in gin::wrappable::secondweakcallback (#45378)
fix: crash in gin::wrappable::secondweakcallback (#45368)
2025-01-29 15:04:08 -08:00
trop[bot]
e99328a45e docs: reference security guide in ipcRenderer.on docs (#45371)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-01-29 15:44:07 -05:00
trop[bot]
04f5fe6a1c build: add NSPrefersDisplaySafeAreaCompatibilityMode = false to Info.plist (#45357)
build: add NSPrefersDisplaySafeAreaCompatibilityMode = false to Info.plist

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2025-01-29 19:55:03 +01:00
trop[bot]
08b6bb1712 build: use Python311 exe (#45364)
build: yse Python311 exe

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2025-01-28 20:43:17 -08:00
trop[bot]
813efbcdf7 docs: fix broken code in drag and drop example (#45336)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-01-27 13:05:42 -05:00
trop[bot]
d34fa2e301 docs: Add note about directly exposing Electron APIs in preload (#45324)
* docs: Add note about directly exposing Electron APIs in preload

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

* Implement feedback

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
2025-01-23 16:29:48 -08:00
trop[bot]
724744af16 chore: better logging if Node initialization fails (#45317)
feat: better logging if Node initialization fails

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-01-23 12:16:18 -06:00
trop[bot]
91bb748eaa refactor: remove InspectableWebContentsViewMac in favor of the Views version (#45238)
* refactor: remove InspectableWebContentsViewMac in favor of the Views version

* cherry-pick: refactor: remove InspectableWebContentsViewMac in favor of the Views version (#41326)

commit e67ab9a93d

Confilcts not resolved, except removal of the files removed
by the original commit.

* resolved conflicts and build issues after cherry-pick

* cherry-picked: fix: add method allowing to disable headless mode in native widget

https://github.com/electron/electron/pull/42996
fixing
https://github.com/electron/electron/issues/42995

* fix: displaying select popup in window created as fullscreen window

`constrainFrameRect:toScreen:` is not being call for windows created
with `fullscreen: true` therefore `headless` mode was not being removed
and `RenderWidgetHostNSViewBridge::DisplayPopupMenu` ignored displaying
popup.

Issue could be fixed by placing additional removal of `headless` mode
in the `toggleFullScreen:`, but `orderWindow:relativeTo:` is called
both for a regular and a fullscreen window, therefore there will be
a single place fixing both cases.

Because `electron::NativeWindowMac` lifetime may be shorter than
`ElectronNSWindow` on which macOS may execute `orderWindow:relativeTo:`
we need to clear `shell_` when `NativeWindow` is being closed.

Fixes #43010.

* fix: Content visibility when using `vibrancy`

We need to put `NSVisualEffectView` before `ViewsCompositorSuperview`
otherwise when using `vibrancy` in `BrowserWindow` `NSVisualEffectView`
will hide content displayed by the compositor.

Fixes #43003
Fixes #42336

In fact main issues reported in these tickets were not present after
cherry-picking original refactor switching to `views::WebView`, so
text could be selected and click event was properly generated. However
both issues testcases were using `vibrancy` and actual content was
invisible, because it was covered by the `NSVisualEffectView`.

* fix: EXCEPTION_ACCESS_VIOLATION crash on BrowserWindow.destroy()

Restored postponed deletion of the `NativeWindow`.

Restoration caused `DCHECK(new_parent_ui_layer->GetCompositor());` failure
in `BrowserCompositorMac::SetParentUiLayer` after the spec test:
`chrome extensions chrome.webRequest does not take precedence over Electron webRequest - http`
with stack:
```
7   Electron Framework 0x000000011fe07830 content::BrowserCompositorMac::SetParentUiLayer(ui::Layer*) + 628
8   Electron Framework 0x000000011fe0c154 content::RenderWidgetHostViewMac::SetParentUiLayer(ui::Layer*) + 220
9   Electron Framework 0x000000011fe226a8 content::WebContentsViewMac::CreateViewForWidget(content::RenderWidgetHost*) + 600
10  Electron Framework 0x000000011fd37e4c content::WebContentsImpl::CreateRenderWidgetHostViewForRenderManager(content::RenderViewHost*) + 164
11  Electron Framework 0x000000011fb32278 content::RenderFrameHostManager::CreateSpeculativeRenderFrame(content::SiteInstanceImpl*, bool, scoped_refptr<content::BrowsingContextState> const&) + 816
12  Electron Framework 0x000000011fb2ab8c content::RenderFrameHostManager::CreateSpeculativeRenderFrameHost(content::SiteInstanceImpl*, content::SiteInstanceImpl*, bool) + 1308
13  Electron Framework 0x000000011fb28598 content::RenderFrameHostManager::GetFrameHostForNavigation(content::NavigationRequest*, content::BrowsingContextGroupSwap*, std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>*) + 1796
14  Electron Framework 0x000000011fa78660 content::NavigationRequest::SelectFrameHostForOnRequestFailedInternal(bool, bool, std::__Cr::optional<std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>> const&) + 280
15  Electron Framework 0x000000011fa6a994 content::NavigationRequest::OnRequestFailedInternal(network::URLLoaderCompletionStatus const&, bool, std::__Cr::optional<std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>> const&, bo
+ 1008
16  Electron Framework 0x000000011fa7772c content::NavigationRequest::OnRequestFailed(network::URLLoaderCompletionStatus const&) + 72
17  Electron Framework 0x000000011f8554ac content::NavigationURLLoaderImpl::NotifyRequestFailed(network::URLLoaderCompletionStatus const&) + 248
```
This was probably the reason of removing `NativeWindow` immediately
in order to cleanup `views_host_` in `WebContentsViewMac` to prevent
using layer without compositor in `WebContentsViewMac::CreateViewForWidget`.

`[ElectronNSWindowDelegate windowWillClose:]` is deleting window host
and the compositor used by the `NativeWindow` therefore detach `NativeWindow`
contents from parent. This will clear `views_host_` and prevent failing
mentioned `DCHECK`.

Fixes #42975

* chore: Applied review suggestions

Co-authored-by: Michał Pichliński <michal.pichlinski@here.io>

* refactor: directly cleanup shell

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Michał Pichliński <michal.pichlinski@here.io>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-01-23 11:54:15 +01:00
trop[bot]
d77c2d75ed fix: potential crash in chrome.tabs.update() (#45302)
fix: potential crash in chrome.tabs.update()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-23 11:53:40 +01:00
trop[bot]
f4c3eb4391 refactor: in StopTracing(), use string literals instead of optional<string> (#45292)
refactor: simplify StopTracing() a little by using a string_view instead of an optional<string>

We have compile-time string literals that we're passing to a method
that takes a string_view argument, so we don't need all this extra
optional<string> scaffolding

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-01-22 09:43:38 -06:00
trop[bot]
9aca9e9fb6 docs: add DocCardList component for index doc (#45296)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
2025-01-22 10:53:19 +01:00
trop[bot]
e0fa647601 refactor: simplify ParseUserScript() (#45288)
refactor: simplify ParseUserScript()

local variable user_script no longer needed after #43205

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-01-22 10:11:16 +01:00
trop[bot]
6b0fd02c0a fix: webContents.print() with OOP printing (#45285)
* fix: webContents.print() with OOP printing

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

* Update patches/chromium/printing.patch

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-01-21 15:13:29 -05:00
trop[bot]
1017ac821f chore: align clipboard blink::web_pref::WebPreferences with upstream (#45280)
chore: align clipboard blink::web_pref::WebPreferences with upstream

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-21 09:39:04 -08:00
trop[bot]
91b53b633a fix: getAsFileSystemHandle failure when drag-dropping two directories (#45256)
fix: drag-dropping two directories

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-20 14:01:15 -06:00
trop[bot]
8da9572592 fix: two possible FSA crashes (#45261)
* 5786874: Change Observer: Fix crash when navigating to new page

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

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

* 5794141: Change Observer: Fix Get*PermissionGrant crash

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

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-01-20 18:20:55 +01:00
trop[bot]
291bbff5d8 build: fix clang-format duplicate message (#45265)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-20 18:20:47 +01:00
trop[bot]
d704a3fc5b fix: page scaling in silent mode printing (#45262)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-20 10:37:54 -06:00
trop[bot]
fb70b81ee6 fix: broken OOP window.print() on macOS/Linux (#45259)
fix: broken OOP printing on macOS/Linux

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-20 10:37:35 -06:00
trop[bot]
97fa059e1f docs: remove quickstart (#45209)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Anny Yang <yangannyx@gmail.com>
2025-01-17 10:36:58 +01:00
Felix Rieseberg
8a64cdc0b1 docs: Why Electron? (#45191) (#45222)
* docs: Why Electron?

* Apply suggestions from code review




* Update docs/why-electron.md

---------

Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2025-01-16 14:06:57 -05:00
675 changed files with 18815 additions and 9435 deletions

View File

@@ -2,7 +2,7 @@ version: '3'
services:
buildtools:
image: ghcr.io/electron/devcontainer:77262e58c37631ab082482f42c33cdf68c6c394b
image: ghcr.io/electron/devcontainer:424eedbf277ad9749ffa9219068aa72ed4a5e373
volumes:
- ..:/workspaces/gclient/src/electron:cached

View File

@@ -13,7 +13,7 @@ Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.
- [ ] PR description included and stakeholders cc'd
- [ ] `npm test` passes
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
- [ ] relevant documentation, tutorials, templates and examples are changed or added
- [ ] relevant API documentation, tutorials, and examples are updated and follow the [documentation style guide](https://github.com/electron/electron/blob/main/docs/development/style-guide.md)
- [ ] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).
#### Release Notes

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: |
@@ -108,7 +111,9 @@ runs:
if [ "${{ inputs.target-platform }}" = "win" ]; then
cd out/Default
powershell Compress-Archive -update mksnapshot_args mksnapshot.zip
powershell Compress-Archive -update gen/v8/embedded.S mksnapshot.zip
powershell mkdir mktmp\\gen\\v8
powershell Copy-Item gen\\v8\\embedded.S mktmp\\gen\\v8
powershell Compress-Archive -update -Path mktmp\\gen mksnapshot.zip
else
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
fi
@@ -143,6 +148,25 @@ runs:
run: |
cd src
e build --target electron:node_headers
- name: Create installed_software.json ${{ inputs.step-suffix }}
shell: powershell
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
cd src
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- name: Profile Windows Toolchain ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
cd src
python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- name: Add msdia140.dll to Path ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
# Needed for msdia140.dll on 64-bit windows
cd src
export PATH="$PATH:$(pwd)/third_party/llvm-build/Release+Asserts/bin"
- name: Generate & Zip Symbols ${{ inputs.step-suffix }}
shell: bash
run: |
@@ -178,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

@@ -9,6 +9,8 @@ inputs:
description: 'Whether to persist the cache to the shared drive'
required: false
default: 'true'
target-platform:
description: 'Target platform, should be linux, win, macos'
runs:
using: "composite"
steps:
@@ -18,38 +20,34 @@ runs:
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
- name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies
- name: Set Chromium Git Helper
uses: ./src/electron/.github/actions/set-chromium-git-helper
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Get Depot Tools
shell: bash
run: |
if [[ ! -d depot_tools ]]; then
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
touch .disable_auto_update
fi
- name: Add Depot Tools to PATH
shell: bash
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Generate DEPS Hash
shell: bash
run: |
node src/electron/script/generate-deps-hash.js
echo "DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)" >> $GITHUB_ENV
DEPSHASH="v1-src-cache-$(cat src/electron/.depshash)"
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
echo "CACHE_FILE=$DEPSHASH.tar" >> $GITHUB_ENV
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: Generate SAS Key
if: ${{ inputs.generate-sas-token == 'true' }}
shell: bash
run: |
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
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@1bd1e32a3bdc45362d1e726936510720a7c30a57
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: |
sas-token
key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
path: sas-token
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
enableCrossOsArchive: true
- name: Check If Cache Exists
id: check-cache
shell: bash
@@ -58,7 +56,7 @@ runs:
echo "Not using cache this time..."
echo "cache_exists=false" >> $GITHUB_OUTPUT
else
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
cache_path=$CACHE_DRIVE/$CACHE_FILE
echo "Using cache key: $DEPSHASH"
echo "Checking for cache in: $cache_path"
if [ ! -f "$cache_path" ] || [ `du $cache_path | cut -f1` = "0" ]; then
@@ -73,15 +71,18 @@ runs:
if: steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true'
shell: bash
run: |
# if there is less than 20 GB free space then creating the cache might fail so exit early
freespace=`df -m /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
freespace_human=`df -h /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
if [ $freespace -le 20000 ]; then
# 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: Add patch conflict problem matcher
shell: bash
run: echo "::add-matcher::src/electron/.github/problem-matchers/patch-conflict.json"
- name: Gclient Sync
if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash
@@ -97,7 +98,7 @@ runs:
fi
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags -vv
if [ "${{ inputs.is-release }}" != "true" && -n "${{ env.PATCH_UP_APP_CREDS }}" ]; then
if [[ "${{ inputs.is-release }}" != "true" ]]; then
# Re-export all the patches to check if there were changes.
python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
cd src/electron
@@ -126,9 +127,15 @@ runs:
cat ../../patches/update-patches.patch
exit 1
fi
else
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
@@ -163,14 +170,14 @@ runs:
shell: bash
run: |
echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')"
tar -cf $DEPSHASH.tar src
echo "Compressed src to $(du -sh $DEPSHASH.tar | cut -f1 -d' ')"
cp ./$DEPSHASH.tar /mnt/cross-instance-cache/
tar -cf $CACHE_FILE src
echo "Compressed src to $(du -sh $CACHE_FILE | cut -f1 -d' ')"
cp ./$CACHE_FILE $CACHE_DRIVE/
- name: Persist Src Cache
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
shell: bash
run: |
final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
final_cache_path=$CACHE_DRIVE/$CACHE_FILE
echo "Using cache key: $DEPSHASH"
echo "Checking path: $final_cache_path"
if [ ! -f "$final_cache_path" ]; then
@@ -179,3 +186,11 @@ runs:
else
echo "Cache key persisted in $final_cache_path"
fi
- name: Wait for active SSH sessions
shell: bash
if: always() && !cancelled()
run: |
while [ -f /var/.ssh-lock ]
do
sleep 60
done

40
.github/actions/cipd-install/action.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: 'CIPD install'
description: 'Installs the specified CIPD package'
inputs:
cipd-root-prefix-path:
description: 'Path to prepend to installation directory'
default: ''
dependency:
description: 'Name of dependency to install'
deps-file:
description: 'Location of DEPS file that defines the dependency'
installation-dir:
description: 'Location to install dependency'
target-platform:
description: 'Target platform, should be linux, win, macos'
package:
description: 'Package to install'
runs:
using: "composite"
steps:
- name: Delete wrong ${{ inputs.dependency }}
shell: bash
run : |
rm -rf ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }}
- name: Create ensure file for ${{ inputs.dependency }}
shell: bash
run: |
echo '${{ inputs.package }}' `e d gclient getdep --deps-file=${{ inputs.deps-file }} -r '${{ inputs.installation-dir }}:${{ inputs.package }}'` > ${{ inputs.dependency }}_ensure_file
cat ${{ inputs.dependency }}_ensure_file
- name: CIPD installation of ${{ inputs.dependency }} (macOS)
if: ${{ inputs.target-platform == 'macos' }}
shell: bash
run: |
echo "ensuring ${{ inputs.dependency }} on macOS"
e d cipd ensure --root ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }} -ensure-file ${{ inputs.dependency }}_ensure_file
- name: CIPD installation of ${{ inputs.dependency }} (Windows)
if: ${{ inputs.target-platform == 'win' }}
shell: powershell
run: |
echo "ensuring ${{ inputs.dependency }} on Windows"
e d cipd ensure --root ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }} -ensure-file ${{ inputs.dependency }}_ensure_file

View File

@@ -1,61 +0,0 @@
name: 'Fix Sync macOS'
description: 'Checks out Electron and stores it in the AKS Cache'
runs:
using: "composite"
steps:
- name: Fix Sync
shell: bash
# This step is required to correct for differences between "gclient sync"
# on Linux and the expected state on macOS. This requires:
# 1. Fixing Clang Install (wrong binary)
# 2. Fixing esbuild (wrong binary)
# 3. Fixing rustc (wrong binary)
# 4. Fixing gn (wrong binary)
# 5. Fix reclient (wrong binary)
# 6. Fixing dsymutil (wrong binary)
# 7. Ensuring we are using the correct ninja and adding it to PATH
# 8. Fixing angle (wrong remote)
run : |
SEDOPTION="-i ''"
rm -rf src/third_party/llvm-build
python3 src/tools/clang/scripts/update.py
echo 'infra/3pp/tools/esbuild/${platform}' `gclient getdep --deps-file=src/third_party/devtools-frontend/src/DEPS -r 'third_party/esbuild:infra/3pp/tools/esbuild/${platform}'` > esbuild_ensure_file
# Remove extra output from calling gclient getdep which always calls update_depot_tools
sed -i '' "s/Updating depot_tools... //g" esbuild_ensure_file
cipd ensure --root src/third_party/devtools-frontend/src/third_party/esbuild -ensure-file esbuild_ensure_file
rm -rf src/third_party/rust-toolchain
python3 src/tools/rust/update_rust.py
# Prevent calling gclient getdep which always calls update_depot_tools
echo 'gn/gn/mac-${arch}' `gclient getdep --deps-file=src/DEPS -r 'src/buildtools/mac:gn/gn/mac-${arch}'` > gn_ensure_file
sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
cipd ensure --root src/buildtools/mac -ensure-file gn_ensure_file
# Prevent calling gclient getdep which always calls update_depot_tools
echo 'infra/rbe/client/${platform}' `gclient getdep --deps-file=src/DEPS -r 'src/buildtools/reclient:infra/rbe/client/${platform}'` > gn_ensure_file
sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
cipd ensure --root src/buildtools/reclient -ensure-file gn_ensure_file
python3 src/buildtools/reclient_cfgs/configure_reclient_cfgs.py --rbe_instance "projects/rbe-chrome-untrusted/instances/default_instance" --reproxy_cfg_template reproxy.cfg.template --rewrapper_cfg_project "" --skip_remoteexec_cfg_fetch
if [ "${{ env.TARGET_ARCH }}" == "arm64" ]; then
DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1
else
DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.x64.sha1
fi
python3 src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang -s $DSYM_SHA_FILE -o src/tools/clang/dsymutil/bin/dsymutil
echo 'infra/3pp/tools/ninja/${platform}' `gclient getdep --deps-file=src/DEPS -r 'src/third_party/ninja:infra/3pp/tools/ninja/${platform}'` > ninja_ensure_file
sed $SEDOPTION "s/Updating depot_tools... //g" ninja_ensure_file
cipd ensure --root src/third_party/ninja -ensure-file ninja_ensure_file
echo "$(pwd)/src/third_party/ninja" >> $GITHUB_PATH
cd src/third_party/angle
rm -f .git/objects/info/alternates
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
cp .git/config .git/config.backup
git remote remove origin
mv .git/config.backup .git/config
git fetch

120
.github/actions/fix-sync/action.yml vendored Normal file
View File

@@ -0,0 +1,120 @@
name: 'Fix Sync'
description: 'Ensures proper binaries are in place'
# This action is required to correct for differences between "gclient sync"
# on Linux and the expected state on macOS/windows. This requires:
# 1. Fixing Clang Install (wrong binary)
# 2. Fixing esbuild (wrong binary)
# 3. Fixing rustc (wrong binary)
# 4. Fixing gn (wrong binary)
# 5. Fix reclient (wrong binary)
# 6. Fixing dsymutil (wrong binary)
# 7. Ensuring we are using the correct ninja and adding it to PATH
# 8. Fixing angle (wrong remote)
# 9. Install windows toolchain on Windows
# 10. Fix node binary on Windows
# 11. Fix rc binary on Windows
inputs:
target-platform:
description: 'Target platform, should be linux, win, macos'
runs:
using: "composite"
steps:
- name: Fix clang
shell: bash
run : |
rm -rf src/third_party/llvm-build
python3 src/tools/clang/scripts/update.py
- name: Fix esbuild
uses: ./src/electron/.github/actions/cipd-install
with:
cipd-root-prefix-path: src/third_party/devtools-frontend/src/
dependency: esbuild
deps-file: src/third_party/devtools-frontend/src/DEPS
installation-dir: third_party/esbuild
target-platform: ${{ inputs.target-platform }}
package: infra/3pp/tools/esbuild/${platform}
- name: Fix rustc
shell: bash
run : |
rm -rf src/third_party/rust-toolchain
python3 src/tools/rust/update_rust.py
- name: Fix gn (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/cipd-install
with:
dependency: gn
deps-file: src/DEPS
installation-dir: src/buildtools/mac
target-platform: ${{ inputs.target-platform }}
package: gn/gn/mac-${arch}
- name: Fix gn (Windows)
if: ${{ inputs.target-platform == 'win' }}
uses: ./src/electron/.github/actions/cipd-install
with:
dependency: gn
deps-file: src/DEPS
installation-dir: src/buildtools/win
target-platform: ${{ inputs.target-platform }}
package: gn/gn/windows-amd64
- name: Fix reclient
uses: ./src/electron/.github/actions/cipd-install
with:
dependency: reclient
deps-file: src/DEPS
installation-dir: src/buildtools/reclient
target-platform: ${{ inputs.target-platform }}
package: infra/rbe/client/${platform}
- name: Configure reclient configs
shell: bash
run : |
python3 src/buildtools/reclient_cfgs/configure_reclient_cfgs.py --rbe_instance "projects/rbe-chrome-untrusted/instances/default_instance" --reproxy_cfg_template reproxy.cfg.template --rewrapper_cfg_project "" --skip_remoteexec_cfg_fetch
- name: Fix dsymutil (macOS)
if: ${{ inputs.target-platform == 'macos' }}
shell: bash
run : |
# Fix dsymutil
if [ "${{ inputs.target-platform }}" = "macos" ]; then
if [ "${{ env.TARGET_ARCH }}" == "arm64" ]; then
DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1
else
DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.x64.sha1
fi
python3 src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang -s $DSYM_SHA_FILE -o src/tools/clang/dsymutil/bin/dsymutil
fi
- name: Fix ninja
uses: ./src/electron/.github/actions/cipd-install
with:
dependency: ninja
deps-file: src/DEPS
installation-dir: src/third_party/ninja
target-platform: ${{ inputs.target-platform }}
package: infra/3pp/tools/ninja/${platform}
- name: Set ninja in path
shell: bash
run : |
echo "$(pwd)/src/third_party/ninja" >> $GITHUB_PATH
- name: Fixup angle git
shell: bash
run : |
cd src/third_party/angle
rm -f .git/objects/info/alternates
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
cp .git/config .git/config.backup
git remote remove origin
mv .git/config.backup .git/config
git fetch
- name: Get Windows toolchain
if: ${{ inputs.target-platform == 'win' }}
shell: powershell
run: e d vpython3 src\build\vs_toolchain.py update --force
- name: Download nodejs
if: ${{ inputs.target-platform == 'win' }}
shell: powershell
run: |
$nodedeps = e d gclient getdep --deps-file=src/DEPS -r src/third_party/node/win | ConvertFrom-JSON
python3 src\third_party\depot_tools\download_from_google_storage.py --no_resume --no_auth --bucket chromium-nodejs -o src\third_party\node\win\node.exe $nodedeps.object_name
- name: Install rc
if: ${{ inputs.target-platform == 'win' }}
shell: bash
run: |
python3 src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang/rc -s src/build/toolchain/win/rc/win/rc.exe.sha1

View File

@@ -10,11 +10,21 @@ runs:
git config --global core.filemode false
git config --global core.autocrlf false
git config --global branch.autosetuprebase always
git config --global core.fscache true
git config --global core.preloadindex true
fi
export BUILD_TOOLS_SHA=8246e57791b0af4ae5975eb96f09855f9269b1cd
export BUILD_TOOLS_SHA=6e8526315ea3b4828882497e532b8340e64e053c
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:\Python37\python.exe" "C:\Python37\python3.exe"
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
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

@@ -1,12 +1,20 @@
name: 'Restore Cache AKS'
description: 'Restores Electron src cache via AKS'
inputs:
target-platform:
description: 'Target platform, should be linux, win, macos'
runs:
using: "composite"
steps:
- name: Restore and Ensure Src Cache
shell: bash
run: |
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
if [ "${{ inputs.target-platform }}" = "win" ]; then
cache_path=/mnt/win-cache/$DEPSHASH.tar
else
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
fi
echo "Using cache key: $DEPSHASH"
echo "Checking for cache in: $cache_path"
if [ ! -f "$cache_path" ]; then

View File

@@ -1,22 +1,25 @@
name: 'Restore Cache AZCopy'
description: 'Restores Electron src cache via AZCopy'
inputs:
target-platform:
description: 'Target platform, should be linux, win, macos'
runs:
using: "composite"
steps:
- name: Obtain SAS Key
continue-on-error: true
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: |
sas-token
key: sas-key-${{ github.run_number }}-1
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@1bd1e32a3bdc45362d1e726936510720a7c30a57
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: |
sas-token
key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
path: sas-token
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
enableCrossOsArchive: true
- name: Download Src Cache from AKS
# The cache will always exist here as a result of the checkout job
# Either it was uploaded to Azure in the checkout job for this commit
@@ -26,21 +29,30 @@ runs:
timeout_minutes: 30
max_attempts: 3
retry_on: error
shell: bash
command: |
sas_token=$(cat sas-token)
if [ -z $sas-token ]; then
echo "SAS Token not found; exiting src cache download early..."
exit 1
else
if [ "${{ inputs.target-platform }}" = "win" ]; then
azcopy copy --log-level=ERROR \
"https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_WIN_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
else
azcopy copy --log-level=ERROR \
"https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
fi
fi
azcopy copy --log-level=ERROR \
"https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
env:
AZURE_AKS_CACHE_STORAGE_ACCOUNT: f723719aa87a34622b5f7f3
AZURE_AKS_CACHE_SHARE_NAME: pvc-f6a4089f-b082-4bee-a3f9-c3e1c0c02d8f
AZURE_AKS_WIN_CACHE_SHARE_NAME: pvc-71dec4f2-0d44-4fd1-a2c3-add049d70bdf
- name: Clean SAS Key
shell: bash
run: rm -f sas-token
- name: Unzip and Ensure Src Cache
if: ${{ inputs.target-platform == 'macos' }}
shell: bash
run: |
echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)"
@@ -68,4 +80,45 @@ runs:
fi
echo "Wiping Electron Directory"
rm -rf src/electron
rm -rf src/electron
- name: Unzip and Ensure Src Cache (Windows)
if: ${{ inputs.target-platform == 'win' }}
shell: powershell
run: |
$src_cache = "$env:DEPSHASH.tar"
$cache_size = $(Get-Item $src_cache).length
Write-Host "Downloaded cache is $cache_size"
if ($cache_size -eq 0) {
Write-Host "Cache is empty - exiting"
exit 1
}
$TEMP_DIR=New-Item -ItemType Directory -Path temp-cache
$TEMP_DIR_PATH = $TEMP_DIR.FullName
C:\ProgramData\Chocolatey\bin\7z.exe -y x $src_cache -o"$TEMP_DIR_PATH"
- name: Move Src Cache (Windows)
if: ${{ inputs.target-platform == 'win' }}
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
shell: powershell
command: |
if (Test-Path "temp-cache\src") {
Write-Host "Relocating Cache"
Remove-Item -Recurse -Force src
Move-Item temp-cache\src src
Write-Host "Deleting zip file"
Remove-Item -Force $src_cache
}
if (-Not (Test-Path "src\third_party\blink")) {
Write-Host "Cache was not correctly restored - exiting"
exit 1
}
Write-Host "Wiping Electron Directory"
Remove-Item -Recurse -Force src\electron

View File

@@ -0,0 +1,41 @@
name: 'Set Chromium Git Helper'
description: 'Sets Chromium Git Helper to allow for a higher request limit'
runs:
using: "composite"
steps:
- name: Save the chromium git credentials to a file
shell: bash
run: |
if [[ -z "${{ env.CHROMIUM_GIT_AUTH }}" ]]; then
echo "CHROMIUM_GIT_AUTH is not set - cannot authenticate."
exit 0
fi
if [[ "${{ runner.os }}" != "Windows" ]]; then
cd $HOME
fi
echo "${{ env.CHROMIUM_GIT_AUTH }}" > .chromium_git_auth
- name: Set the chromium git helper to use auth from a file
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
if [[ ! -f "/c/actions-runner/_work/electron/electron/.chromium_git_auth" ]]; then
echo "File /c/actions-runner/_work/electron/electron/.chromium_git_auth does not exist - cannot authenticate."
exit 0
fi
else
if [[ ! -f "$HOME/.chromium_git_auth" ]]; then
echo "File $HOME/.chromium_git_auth does not exist - cannot authenticate."
exit 0
fi
fi
if [[ -z "${{ env.CHROMIUM_GIT_USER }}" ]]; then
echo "CHROMIUM_GIT_USER is not set - cannot authenticate."
exit 0
fi
git config --global credential.https://chromium.googlesource.com.username "${{ env.CHROMIUM_GIT_USER }}"
if [[ "${{ runner.os }}" == "Windows" ]]; then
git config --global credential.https://chromium.googlesource.com.helper '!f() { test "$1" = get && echo "password=$(cat /c/actions-runner/_work/electron/electron/.chromium_git_auth)"; }; f'
else
git config --global credential.https://chromium.googlesource.com.helper '!f() { test "$1" = get && echo "password=$(cat $HOME/.chromium_git_auth)"; }; f'
fi

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,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@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
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 }}"

View File

@@ -6,7 +6,7 @@ on:
build-image-sha:
type: string
description: 'SHA for electron/build image'
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
required: true
skip-macos:
type: boolean
@@ -64,7 +64,7 @@ jobs:
id: set-output
run: |
if [ -z "${{ inputs.build-image-sha }}" ]; then
echo "build-image-sha=bc2f48b2415a670de18d13605b1cf0eb5fdbaae1" >> "$GITHUB_OUTPUT"
echo "build-image-sha=424eedbf277ad9749ffa9219068aa72ed4a5e373" >> "$GITHUB_OUTPUT"
else
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
fi
@@ -100,6 +100,8 @@ jobs:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
outputs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
@@ -114,6 +116,7 @@ jobs:
uses: ./src/electron/.github/actions/checkout
with:
generate-sas-token: 'true'
target-platform: macos
checkout-linux:
needs: setup
@@ -126,6 +129,8 @@ jobs:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
outputs:
@@ -148,8 +153,11 @@ jobs:
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /mnt/win-cache:/mnt/win-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
TARGET_OS: 'win'
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
@@ -164,6 +172,9 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
with:
generate-sas-token: 'true'
target-platform: win
# GN Check Jobs
macos-gn-check:
@@ -194,7 +205,7 @@ jobs:
target-platform: win
target-archs: x64 x86 arm64
check-runs-on: electron-arc-linux-amd64-8core
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
gn-build-type: testing
secrets: inherit
@@ -322,7 +333,7 @@ jobs:
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: setup
needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-windows-amd64-16core
@@ -341,7 +352,7 @@ jobs:
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: setup
needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-windows-amd64-16core
@@ -360,7 +371,7 @@ jobs:
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: setup
needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-windows-amd64-16core

View File

@@ -1,8 +1,12 @@
name: Clean Source Cache
description: |
This workflow cleans up the source cache on the cross-instance cache volume
to free up space. It runs daily at midnight and clears files older than 15 days.
on:
schedule:
- cron: "0 0 * * SUN" # Run at midnight every Sunday
- cron: "0 0 * * *"
jobs:
clean-src-cache:
@@ -12,10 +16,14 @@ jobs:
options: --user root
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /mnt/win-cache:/mnt/win-cache
steps:
- name: Cleanup Source Cache
shell: bash
run: |
df -h /mnt/cross-instance-cache
find /mnt/cross-instance-cache -type f -mtime +30 -delete
find /mnt/cross-instance-cache -type f -mtime +15 -delete
df -h /mnt/cross-instance-cache
df -h /mnt/win-cache
find /mnt/win-cache -type f -mtime +15 -delete
df -h /mnt/win-cache

View File

@@ -6,7 +6,7 @@ on:
build-image-sha:
type: string
description: 'SHA for electron/build image'
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
upload-to-storage:
description: 'Uploads to Azure storage'
required: false
@@ -27,6 +27,8 @@ jobs:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps:
- name: Checkout Electron

View File

@@ -6,7 +6,7 @@ on:
build-image-sha:
type: string
description: 'SHA for electron/build image'
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
required: true
upload-to-storage:
description: 'Uploads to Azure storage'
@@ -28,6 +28,8 @@ jobs:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
steps:
- name: Checkout Electron
@@ -39,6 +41,7 @@ jobs:
uses: ./src/electron/.github/actions/checkout
with:
generate-sas-token: 'true'
target-platform: macos
publish-x64-darwin:
uses: ./.github/workflows/pipeline-segment-electron-build.yml

View File

@@ -56,8 +56,8 @@ on:
default: false
concurrency:
group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
jobs:
build:

View File

@@ -56,8 +56,8 @@ on:
default: false
concurrency:
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
permissions:
contents: read

View File

@@ -9,8 +9,12 @@ on:
type: string
concurrency:
group: electron-lint-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-lint-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
jobs:
lint:
@@ -27,6 +31,8 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies
- name: Set Chromium Git Helper
uses: ./src/electron/.github/actions/set-chromium-git-helper
- name: Setup third_party Depot Tools
shell: bash
run: |

View File

@@ -13,7 +13,7 @@ on:
required: true
target-arch:
type: string
description: 'Arch to build for, can be x64, arm64 or arm'
description: 'Arch to build for, can be x64, arm64, ia32 or arm'
required: true
target-variant:
type: string
@@ -61,10 +61,12 @@ on:
concurrency:
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }}
@@ -102,7 +104,7 @@ jobs:
if: ${{ inputs.target-platform == 'macos' }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: 20.11.x
node-version: 20.19.x
cache: yarn
cache-dependency-path: src/electron/yarn.lock
- name: Install Dependencies
@@ -125,24 +127,10 @@ jobs:
GN_EXTRA_ARGS='is_asan=true'
fi
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
- name: Get Depot Tools
timeout-minutes: 5
run: |
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
SEDOPTION="-i"
if [ "`uname`" = "Darwin" ]; then
SEDOPTION="-i ''"
fi
# remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
sed $SEDOPTION '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
touch .disable_auto_update
- name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Set Chromium Git Helper
uses: ./src/electron/.github/actions/set-chromium-git-helper
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Generate DEPS Hash
run: |
node src/electron/script/generate-deps-hash.js
@@ -150,24 +138,26 @@ jobs:
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
- name: Restore src cache via AZCopy
if: ${{ inputs.target-platform == 'macos' }}
if: ${{ inputs.target-platform != 'linux' }}
uses: ./src/electron/.github/actions/restore-cache-azcopy
with:
target-platform: ${{ inputs.target-platform }}
- name: Restore src cache via AKS
if: ${{ inputs.target-platform == 'linux' }}
uses: ./src/electron/.github/actions/restore-cache-aks
- name: Checkout src via gclient sync
if: ${{ inputs.target-platform == 'win' }}
uses: ./src/electron/.github/actions/checkout
with:
use-cache: 'false'
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Fix Sync
if: ${{ inputs.target-platform != 'linux' }}
uses: ./src/electron/.github/actions/fix-sync
with:
target-platform: ${{ inputs.target-platform }}
env:
ELECTRON_DEPOT_TOOLS_DISABLE_LOG: true
- name: Init Build Tools
run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
@@ -180,9 +170,6 @@ jobs:
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
- name: Fix Sync (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/fix-sync-macos
- name: Setup Number of Ninja Processes
run: |
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform != 'macos' && '300' || '200' }}" >> $GITHUB_ENV

View File

@@ -65,7 +65,9 @@ jobs:
sudo rm -rf $TMPDIR/del-target
- name: Check disk space after freeing up space
if: ${{ inputs.target-platform == 'macos' }}
run: df -h
run: df -h
- name: Set Chromium Git Helper
uses: ./src/electron/.github/actions/set-chromium-git-helper
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Enable windows toolchain
@@ -81,9 +83,13 @@ jobs:
- name: Restore src cache via AZCopy
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/restore-cache-azcopy
with:
target-platform: ${{ inputs.target-platform }}
- name: Restore src cache via AKS
if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'win' }}
uses: ./src/electron/.github/actions/restore-cache-aks
with:
target-platform: ${{ inputs.target-platform }}
- name: Run Electron Only Hooks
run: |
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient

View File

@@ -27,8 +27,8 @@ on:
default: false
concurrency:
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
permissions:
contents: read
@@ -36,6 +36,8 @@ permissions:
pull-requests: read
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
ELECTRON_OUT_DIR: Default
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
@@ -74,11 +76,12 @@ jobs:
echo "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Python311" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
- name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'win' }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: 20.11.x
node-version: 20.19.x
- name: Add TCC permissions on macOS
if: ${{ inputs.target-platform == 'macos' }}
run: |
@@ -112,6 +115,9 @@ jobs:
configure_sys_tccdb "$values"
fi
done
- name: Turn off the unexpectedly quit dialog on macOS
if: ${{ inputs.target-platform == 'macos' }}
run: defaults write com.apple.CrashReporter DialogType server
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
@@ -120,12 +126,16 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies
- name: Set Chromium Git Helper
uses: ./src/electron/.github/actions/set-chromium-git-helper
- name: Get Depot Tools
timeout-minutes: 5
run: |
git config --global core.filemode false
git config --global core.autocrlf false
git config --global branch.autosetuprebase always
git config --global core.fscache true
git config --global core.preloadindex true
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools

View File

@@ -27,10 +27,12 @@ on:
default: testing
concurrency:
group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
ELECTRON_OUT_DIR: Default
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
@@ -38,7 +40,7 @@ jobs:
node-tests:
name: Run Node.js Tests
runs-on: electron-arc-linux-amd64-8core
timeout-minutes: 20
timeout-minutes: 30
env:
TARGET_ARCH: ${{ inputs.target-arch }}
BUILD_TYPE: linux
@@ -50,6 +52,8 @@ jobs:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set Chromium Git Helper
uses: ./src/electron/.github/actions/set-chromium-git-helper
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
@@ -57,15 +61,6 @@ jobs:
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
- name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies
- name: Get Depot Tools
timeout-minutes: 5
run: |
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
touch .disable_auto_update
- name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Download Generated Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
@@ -99,7 +94,7 @@ jobs:
nan-tests:
name: Run Nan Tests
runs-on: electron-arc-linux-amd64-4core
timeout-minutes: 20
timeout-minutes: 30
env:
TARGET_ARCH: ${{ inputs.target-arch }}
BUILD_TYPE: linux
@@ -111,6 +106,8 @@ jobs:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set Chromium Git Helper
uses: ./src/electron/.github/actions/set-chromium-git-helper
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
@@ -118,15 +115,6 @@ jobs:
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
- name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies
- name: Get Depot Tools
timeout-minutes: 5
run: |
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
touch .disable_auto_update
- name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Download Generated Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:

View File

@@ -15,12 +15,12 @@ jobs:
- name: Trigger Slack workflow
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
{
"url": "${{ github.event.pull_request.html_url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
pull-request-labeled-deprecation-review-complete:
name: deprecation-review/complete label added
if: github.event.label.name == 'deprecation-review/complete ✅'

View File

@@ -1,78 +0,0 @@
name: Update AppVeyor Image
# Run chron daily Mon-Fri
on:
workflow_dispatch:
schedule:
- cron: '0 8 * * 1-5' # runs 8:00 every business day (see https://crontab.guru)
permissions: {}
jobs:
bake-appveyor-image:
name: Bake AppVeyor Image
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with:
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20.11.x
- name: Yarn install
run: |
node script/yarn.js install --frozen-lockfile
- name: Set Repo for Commit
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Check AppVeyor Image
env:
APPVEYOR_TOKEN: ${{ secrets.APPVEYOR_TOKEN }}
run: |
node ./script/prepare-appveyor
if [ -f ./image_version.txt ]; then
echo "APPVEYOR_IMAGE_VERSION="$(cat image_version.txt)"" >> $GITHUB_ENV
rm image_version.txt
fi
- name: (Optionally) Update Appveyor Image
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: mikefarah/yq@4839dbbf80445070a31c7a9c1055da527db2d5ee # v4.44.6
with:
cmd: |
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml"
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor-woa.yml" > "appveyor-woa2.yml"
- name: (Optionally) Generate Commit Diff
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
diff -w -B appveyor.yml appveyor2.yml > appveyor.diff || true
patch -f appveyor.yml < appveyor.diff
rm appveyor2.yml appveyor.diff
git add appveyor.yml
- name: (Optionally) Generate Commit Diff for WOA
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
diff -w -B appveyor-woa.yml appveyor-woa2.yml > appveyor-woa.diff || true
patch -f appveyor-woa.yml < appveyor-woa.diff
rm appveyor-woa2.yml appveyor-woa.diff
git add appveyor-woa.yml
- name: (Optionally) Commit to Branch
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: dsanders11/github-app-commit-action@43de6da2f4d927e997c0784c7a0b61bd19ad6aac # v1.5.0
with:
message: 'build: update appveyor image to latest version'
ref: bump-appveyor-image
token: ${{ steps.generate-token.outputs.token }}
- name: (Optionally) Create Pull Request
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
printf "This PR updates appveyor.yml to the latest baked image, ${{ env.APPVEYOR_IMAGE_VERSION }}.\n\nNotes: none" | gh pr create --head bump-appveyor-image --label no-backport --label semver/none --title 'build: update appveyor image to latest version' --body-file=-
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

90
.github/workflows/windows-publish.yml vendored Normal file
View File

@@ -0,0 +1,90 @@
name: Publish Windows
on:
workflow_dispatch:
inputs:
build-image-sha:
type: string
description: 'SHA for electron/build image'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
required: true
upload-to-storage:
description: 'Uploads to Azure storage'
required: false
default: '1'
type: string
run-windows-publish:
description: 'Run the publish jobs vs just the build jobs'
type: boolean
default: false
jobs:
checkout-windows:
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
volumes:
- /mnt/win-cache:/mnt/win-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
TARGET_OS: 'win'
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
outputs:
build-image-sha: ${{ inputs.build-image-sha }}
steps:
- name: Checkout Electron
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with:
path: src/electron
fetch-depth: 0
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
with:
generate-sas-token: 'true'
target-platform: win
publish-x64-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: x64
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-arm64-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: arm64
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-x86-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: x86
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit

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

@@ -224,11 +224,21 @@ webpack_build("electron_utility_bundle") {
out_file = "$target_gen_dir/js2c/utility_init.js"
}
webpack_build("electron_preload_realm_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.preload_realm_bundle_deps
config_file = "//electron/build/webpack/webpack.config.preload_realm.js"
out_file = "$target_gen_dir/js2c/preload_realm_bundle.js"
}
action("electron_js2c") {
deps = [
":electron_browser_bundle",
":electron_isolated_renderer_bundle",
":electron_node_bundle",
":electron_preload_realm_bundle",
":electron_renderer_bundle",
":electron_sandboxed_renderer_bundle",
":electron_utility_bundle",
@@ -240,6 +250,7 @@ action("electron_js2c") {
"$target_gen_dir/js2c/browser_init.js",
"$target_gen_dir/js2c/isolated_bundle.js",
"$target_gen_dir/js2c/node_init.js",
"$target_gen_dir/js2c/preload_realm_bundle.js",
"$target_gen_dir/js2c/renderer_init.js",
"$target_gen_dir/js2c/sandbox_bundle.js",
"$target_gen_dir/js2c/utility_init.js",
@@ -430,6 +441,7 @@ source_set("electron_lib") {
"chromium_src:chrome_spellchecker",
"shell/common:mojo",
"shell/common:plugin",
"shell/common:web_contents_utility",
"shell/services/node/public/mojom",
"//base:base_static",
"//base/allocator:buildflags",
@@ -658,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",
]
@@ -1234,7 +1248,7 @@ if (is_mac) {
"//components/crash/core/app:run_as_crashpad_handler",
]
ldflags = []
ldflags = [ "/DELAYLOAD:ffmpeg.dll" ]
libs = [
"comctl32.lib",

4
DEPS
View File

@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'133.0.6920.0',
'134.0.6998.205',
'node_version':
'v22.9.0',
'v22.15.1',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':

View File

@@ -1,107 +0,0 @@
# The config is used to bake appveyor images, not for running CI jobs.
# The config expects the following environment variables to be set:
# - "APPVEYOR_BAKE_IMAGE" e.g. 'electron-99.0.4767.0'. Name of the image to be baked.
# Typically named after the Chromium version on which the image is built.
# This can be set dynamically in the prepare-appveyor script.
version: 1.0.{build}
build_cloud: electronhq-16-core
image: base-bake-image
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
PYTHONIOENCODING: UTF-8
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# init:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - appveyor version
# - ps: $ErrorActionPreference = 'Stop'
# - ps: 'Write-Host "OS Build: $((Get-CimInstance Win32_OperatingSystem).BuildNumber)"'
# clone_folder: '%USERPROFILE%\image-bake-scripts'
# clone_script:
# - ps: Invoke-WebRequest "https://github.com/appveyor/build-images/archive/1f90d94e74c8243c909a09b994e527584dfcb838.zip" -OutFile "$env:temp\scripts.zip"
# - ps: Expand-Archive -Path "$env:temp\scripts.zip" -DestinationPath "$env:temp\scripts" -Force
# - ps: Copy-Item -Path "$env:temp\scripts\build-images-1f90d94e74c8243c909a09b994e527584dfcb838\scripts\Windows\*" -Destination $env:APPVEYOR_BUILD_FOLDER -Recurse
build_script:
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# - ps: .\init_server.ps1
# - ps: .\extend_system_volume.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - appveyor version
# - ps: .\install_path_utils.ps1
# - ps: .\install_powershell_core.ps1
# - ps: .\install_powershell_get.ps1
# - ps: .\install_7zip.ps1
# - ps: .\install_chocolatey.ps1
# - ps: .\install_webpi.ps1
# - ps: .\install_nuget.ps1
# - ps: .\install_pstools.ps1
# - ps: .\install_git.ps1
# - ps: .\install_git_lfs.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# END LINES FOR COMPLETELY NEW IMAGE
- git config --global core.longpaths true
- ps: >-
if (-not (Test-Path -Path C:\projects\src)) {
New-Item -Path C:\projects\src -ItemType Directory
}
- cd C:\projects\
- git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/electron/electron.git C:\projects\src\electron
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- update_depot_tools.bat
# Uncomment the following line if windows deps change
- src\electron\script\setup-win-for-dev.bat
- >-
gclient config
--name "src\electron"
--unmanaged
%GCLIENT_EXTRA_ARGS%
"https://github.com/electron/electron"
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: Copy-Item -path .\.depshash -destination ..\.depshash
- ps: cd ..\..
- gclient sync --with_branch_heads --with_tags --nohooks
- ps: regsvr32 /s "C:\Program Files\Microsoft Visual Studio\2022\Community\DIA SDK\bin\amd64\msdia140.dll"
- ps: set vs2022_install="C:\Program Files\Microsoft Visual Studio\2022\Community"
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - cd %USERPROFILE%\image-bake-scripts
# - appveyor version
# - ps: .\optimize_dotnet_runtime.ps1
# - ps: .\disable_windows_background_services.ps1
# - ps: .\enforce_windows_firewall.ps1
# - ps: .\cleanup_windows.ps1
# END LINES FOR COMPLETELY NEW IMAGE
on_image_bake:
- ps: >-
echo "Baking image: $env:APPVEYOR_BAKE_IMAGE at dir $PWD"
- ps: Remove-Item -Recurse -Force C:\projects\depot_tools
- ps: Remove-Item -Recurse -Force C:\projects\src\electron
# Uncomment these lines and set APPVEYOR_RDP_PASSWORD in project settings to enable RDP after bake is done
# # on_finish:
# - ps: >-
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

View File

@@ -1,352 +0,0 @@
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor.yml
# IF APPLICABLE!!!!
#
#
# The config expects the following environment variables to be set:
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
# if you pass a custom value for 'target_cpu'.
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
# Is used in some publishing scripts, but does NOT affect the Electron binary.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
# Otherwise the release will be uploaded to the GitHub Releases.
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
#
# The publishing scripts expect access tokens to be defined as env vars,
# but those are not covered here.
#
# AppVeyor docs on variables:
# https://www.appveyor.com/docs/environment-variables/
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-133.0.6878.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_7393122652: 3ba76c5c20
PYTHONIOENCODING: UTF-8
matrix:
- job_name: Build Arm on X64 Windows
- job_name: Test On Windows On Arm Hardware 1
job_depends_on: Build Arm on X64 Windows
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
shard: 1
- job_name: Test On Windows On Arm Hardware 2
job_depends_on: Build Arm on X64 Windows
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
shard: 2
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
- matrix:
only:
- job_name: Build Arm on X64 Windows
build_script:
# TODO: Remove --ignore-engines once WOA image is up to node 20
- ps: |
node script/yarn.js install --frozen-lockfile --ignore-engines
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- ps: >-
if (Test-Path -Path "$pwd\depot_tools") {
Remove-Item -Recurse -Force $pwd\depot_tools
}
- ps: >-
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: |
Set-Content -Path $pwd\depot_tools\build_telemetry.cfg -Value '{"user": "info@electronjs.org", "status": "opt-out", "countdown": 10, "version": 1}'
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npx yarn --ignore-engines
- mkdir third_party
- ps: >-
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
- ps: >-
& $env:RECLIENT_HELPER login
- ps: >-
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
- ps: >-
$env:RBE_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_credentials_helper_args = "print"
- ps: >-
if ($env:ELECTRON_RBE_JWT -eq '') {
$env:RBE_fail_early_min_action_count = "0"
$env:RBE_fail_early_min_fallback_ratio = "0"
}
- cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
# Patches are applied in the image bake. Check depshash to see if patches have changed.
- ps: $env:RUN_GCLIENT_SYNC="false"
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: cd ..\..
- ps: >-
if ($depshash_baked -ne $depshash) {
$env:RUN_GCLIENT_SYNC="true"
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common:mojo
- gn check out/Default //electron/shell/common:plugin
- autoninja -j 300 -C out/Default electron:electron_app
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
- autoninja -C out/Default electron:electron_dist_zip
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- autoninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- autoninja -C out/Default electron:hunspell_dictionaries_zip
- autoninja -C out/Default electron:electron_chromedriver_zip
- autoninja -C out/Default electron:node_headers
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- 7z a nan.zip third_party\nan
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
}
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- ps: |
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
if ($LASTEXITCODE -ne 0) {
throw "Zip contains files not listed in the manifest $manifest_file"
}
- ps: |
cd C:\projects\src
$missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
} else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip','nan.zip'
foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif (
$artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} elseif (
$artifact_name -eq 'nan.zip') {
$artifact_file = $artifact_name
} else {
$artifact_file = "out\Default\$artifact_name"
}
if (-not(Test-Path $artifact_file)) {
Write-warning "$artifact_name is missing and cannot be added to artifacts"
$missing_artifacts = $true
}
}
}
if ($missing_artifacts) {
throw "Build failed due to missing artifacts"
}
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
}
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist nan.zip (appveyor-retry appveyor PushArtifact nan.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
- matrix:
only:
- job_name: Test On Windows On Arm Hardware 1
- job_name: Test On Windows On Arm Hardware 2
environment:
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: C:\projects\src\electron\junit
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
DD_ENV: ci
DD_SERVICE: electron
DD_CIVISIBILITY_LOGS_ENABLED: true
DD_GIT_REPOSITORY_URL: "https://github.com/electron/electron.git"
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile --ignore-engines
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- ps: Invoke-WebRequest -Uri "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_win-x64" -OutFile "C:\projects\src\electron\datadog-ci.exe"
- cd ..
- mkdir out\Default
- cd ..
- ps: |
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib', 'nan.zip')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build Arm on X64 Windows") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
7z x -y -osrc pdb.zip
}
}
- ps: |
$out_default_zips = @('dist.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
- ps: 7z x -y -osrc nan.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: |
cd src
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- set npm_config_nodedir=%cd%\out\Default\gen\node_headers
- set npm_config_arch=arm64
- cd electron
# Explicitly set npm_config_arch because the .env doesn't persist
- ps: >-
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- ps: $env:tests_files=node script\split-tests $env:shard 2
- echo "Running shard %shard% specs %tests_files%"
- echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion --files %tests_files%
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\junit\test-results-main.xml ( appveyor-retry appveyor PushArtifact electron\junit\test-results-main.xml )
- ps: |
if ($env:DD_API_KEY) {
$env:DD_GIT_COMMIT_SHA = $env:APPVEYOR_REPO_COMMIT
$env:DD_GIT_BRANCH = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
$env:DD_TAGS = "os.architecture:$env:TARGET_ARCH,os.family:windows,os.platform:win32"
if (Test-Path -Path "C:\projects\src\electron\junit\test-results-main.xml") {
C:\projects\src\electron\datadog-ci.exe junit upload --verbose C:\projects\src\electron\junit\test-results-main.xml
}
}

View File

@@ -1,350 +0,0 @@
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor-woa.yml
# IF APPLICABLE!!!!
#
#
# The config expects the following environment variables to be set:
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
# if you pass a custom value for 'target_cpu'.
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
# Is used in some publishing scripts, but does NOT affect the Electron binary.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
# Otherwise the release will be uploaded to the GitHub Releases.
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
#
# The publishing scripts expect access tokens to be defined as env vars,
# but those are not covered here.
#
# AppVeyor docs on variables:
# https://www.appveyor.com/docs/environment-variables/
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-133.0.6878.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_7393122652: 3ba76c5c20
PYTHONIOENCODING: UTF-8
matrix:
- job_name: Build
- job_name: Test 1
job_depends_on: Build
shard: 1
- job_name: Test 2
job_depends_on: Build
shard: 2
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
- matrix:
only:
- job_name: Build
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- ps: >-
if (Test-Path -Path "$pwd\depot_tools") {
Remove-Item -Recurse -Force $pwd\depot_tools
}
- ps: >-
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: |
Set-Content -Path $pwd\depot_tools\build_telemetry.cfg -Value '{"user": "info@electronjs.org", "status": "opt-out", "countdown": 10, "version": 1}'
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npx yarn --ignore-engines
- mkdir third_party
- ps: >-
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
- ps: >-
& $env:RECLIENT_HELPER login
- ps: >-
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
- ps: >-
$env:RBE_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_credentials_helper_args = "print"
- ps: >-
if ($env:ELECTRON_RBE_JWT -eq '') {
$env:RBE_fail_early_min_action_count = "0"
$env:RBE_fail_early_min_fallback_ratio = "0"
}
- cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
# Patches are applied in the image bake. Check depshash to see if patches have changed.
- ps: $env:RUN_GCLIENT_SYNC="false"
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: cd ..\..
- ps: >-
if ($depshash_baked -ne $depshash) {
$env:RUN_GCLIENT_SYNC="true"
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common:mojo
- gn check out/Default //electron/shell/common:plugin
- autoninja -j 300 -C out/Default electron:electron_app
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
- autoninja -C out/Default electron:electron_dist_zip
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- autoninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- autoninja -C out/Default electron:hunspell_dictionaries_zip
- autoninja -C out/Default electron:electron_chromedriver_zip
- autoninja -C out/Default electron:node_headers
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
}
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- ps: |
if ($env:TARGET_ARCH -eq 'ia32') {
$env:MANIFEST_ARCH = "x86"
} else {
$env:MANIFEST_ARCH = $env:TARGET_ARCH
}
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:MANIFEST_ARCH.manifest"
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
if ($LASTEXITCODE -ne 0) {
throw "Zip contains files not listed in the manifest $manifest_file"
}
- ps: |
cd C:\projects\src
$missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
} else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif (
$artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} else {
$artifact_file = "out\Default\$artifact_name"
}
if (-not(Test-Path $artifact_file)) {
Write-warning "$artifact_name is missing and cannot be added to artifacts"
$missing_artifacts = $true
}
}
}
if ($missing_artifacts) {
throw "Build failed due to missing artifacts"
}
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
}
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
- matrix:
only:
- job_name: Test 1
- job_name: Test 2
environment:
DD_ENV: ci
DD_SERVICE: electron
DD_CIVISIBILITY_LOGS_ENABLED: true
DD_GIT_REPOSITORY_URL: "https://github.com/electron/electron.git"
ELECTRON_TEST_RESULTS_DIR: C:\projects\src\electron\junit
init:
- ps: |
if ($env:RUN_TESTS -ne 'true') {
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
}
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- npm install -g @datadog/datadog-ci
- cd ..
- mkdir out\Default
- cd ..
- ps: |
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
7z x -y -osrc pdb.zip
}
}
- ps: |
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: |
cd src
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- cd electron
# Explicitly set npm_config_arch because the .env doesn't persist
- ps: >-
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- ps: $env:tests_files=node script\split-tests $env:shard 2
- echo "Running shard %shard% specs %tests_files%"
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging --files %tests_files%
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
- echo "About to verify mksnapshot"
- echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
- echo "Done verifying mksnapshot"
- echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
- echo "Done verifying chromedriver"
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\junit\test-results-main.xml ( appveyor-retry appveyor PushArtifact electron\junit\test-results-main.xml )
- ps: |
if ($env:RUN_TESTS -eq 'true' -And $env:DD_API_KEY) {
$env:DD_GIT_COMMIT_SHA = $env:APPVEYOR_REPO_COMMIT
$env:DD_GIT_BRANCH = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
$env:DD_TAGS = "os.architecture:$env:TARGET_ARCH,os.family:windows,os.platform:win32"
if (Test-Path -Path "C:\projects\src\electron\junit\test-results-main.xml") {
C:\Users\appveyor\AppData\Roaming\npm\datadog-ci.ps1 junit upload --verbose C:\projects\src\electron\junit\test-results-main.xml
}
}

View File

@@ -14,8 +14,8 @@ v8_enable_snapshot_native_code_counters = false
v8_enable_javascript_promise_hooks = true
enable_cdm_host_verification = false
proprietary_codecs = true
ffmpeg_branding = "Chrome"
proprietary_codecs = true
enable_printing = true
@@ -48,7 +48,8 @@ enable_cet_shadow_stack = false
is_cfi = false
# TODO: fix this once sysroots have been updated.
use_qt = false
use_qt5 = false
use_qt6 = false
# Disables the builtins PGO for V8
v8_builtins_profiling_log_file = ""
@@ -65,11 +66,6 @@ v8_enable_private_mapping_fork_optimization = true
# Expose public V8 symbols for native modules.
v8_expose_public_symbols = true
# Disables unsafe-buffers-usage plugin due to incompatibilities with our reclient implementation
# Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5426599
# Ref: https://github.com/electron/electron/commit/8e20f16ea35eeaeb149ae63bad3703d782665f6a
clang_unsafe_buffers_paths = ""
# Disable snapshotting a page when printing for its content to be analyzed for
# sensitive content by enterprise users.
enterprise_cloud_content_analysis = false
@@ -78,5 +74,4 @@ enterprise_cloud_content_analysis = false
# https://issues.chromium.org/issues/40943039
content_enable_legacy_ipc = true
# Electron has its own unsafe-buffers enforcement directories.
clang_unsafe_buffers_paths = "//electron/electron_unsafe_buffers_paths.txt"

View File

@@ -1,7 +1,7 @@
import("all.gn")
import("//electron/build/args/all.gn")
is_component_build = false
is_component_ffmpeg = true
is_official_build = true
proprietary_codecs = false
ffmpeg_branding = "Chromium"
enable_dsyms = false
proprietary_codecs = false

View File

@@ -1,14 +1,7 @@
import("all.gn")
import("//electron/build/args/all.gn")
is_component_build = false
is_official_build = true
# This may be guarded behind is_chrome_branded alongside
# proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
# explicitly override here to build OpenH264 encoder/FFmpeg decoder.
# The initialization of the decoder depends on whether ffmpeg has
# been built with H.264 support.
rtc_use_h264 = proprietary_codecs
# By default, Electron builds ffmpeg with proprietary codecs enabled. In order
# to facilitate users who don't want to ship proprietary codecs in ffmpeg, or
# who have an LGPL requirement to ship ffmpeg as a dynamically linked library,

View File

@@ -1,14 +1,7 @@
import("all.gn")
import("//electron/build/args/all.gn")
is_debug = false
is_component_build = false
is_component_ffmpeg = true
is_official_build = false
dcheck_always_on = true
symbol_level = 1
# This may be guarded behind is_chrome_branded alongside
# proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
# explicitly override here to build OpenH264 encoder/FFmpeg decoder.
# The initialization of the decoder depends on whether ffmpeg has
# been built with H.264 support.
rtc_use_h264 = proprietary_codecs

View File

@@ -0,0 +1,6 @@
module.exports = require('./webpack.config.base')({
target: 'preload_realm',
alwaysHasNode: false,
wrapInitWithProfilingTimeout: true,
wrapInitWithTryCatch: true
});

View File

@@ -34,8 +34,6 @@ static_library("chrome") {
"//chrome/browser/devtools/features.h",
"//chrome/browser/devtools/visual_logging.cc",
"//chrome/browser/devtools/visual_logging.h",
"//chrome/browser/extensions/global_shortcut_listener.cc",
"//chrome/browser/extensions/global_shortcut_listener.h",
"//chrome/browser/file_system_access/file_system_access_features.cc",
"//chrome/browser/file_system_access/file_system_access_features.h",
"//chrome/browser/icon_loader.cc",
@@ -70,6 +68,8 @@ static_library("chrome") {
"//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker_observer.h",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager_uma_helper.cc",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager_uma_helper.h",
"//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.cc",
"//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.h",
"//chrome/browser/platform_util.cc",
@@ -146,6 +146,8 @@ static_library("chrome") {
"//chrome/browser/ui/webui/accessibility/accessibility_ui.h",
"//extensions/browser/app_window/size_constraints.cc",
"//extensions/browser/app_window/size_constraints.h",
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.cc",
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.h",
"//ui/views/native_window_tracker.h",
]
@@ -176,7 +178,6 @@ static_library("chrome") {
}
public_deps = [
"//chrome/browser:dev_ui_browser_resources",
"//chrome/browser/resources/accessibility:resources",
"//chrome/browser/ui/color:color_headers",
"//chrome/browser/ui/color:mixers",
@@ -198,6 +199,7 @@ static_library("chrome") {
"//chrome/browser/ui/webui/tab_search:mojo_bindings",
"//chrome/browser/web_applications/mojom:mojom_web_apps_enum",
"//components/enterprise/buildflags",
"//components/enterprise/common/proto:browser_events_proto",
"//components/enterprise/common/proto:connectors_proto",
"//components/enterprise/obfuscation/core:enterprise_obfuscation",
"//components/safe_browsing/core/browser/db:safebrowsing_proto",
@@ -219,9 +221,9 @@ static_library("chrome") {
if (is_linux) {
sources += [
"//chrome/browser/extensions/global_shortcut_listener_linux.cc",
"//chrome/browser/extensions/global_shortcut_listener_linux.h",
"//chrome/browser/icon_loader_auralinux.cc",
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.cc",
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.h",
]
sources += [
"//chrome/browser/ui/views/status_icons/concat_menu_model.cc",

View File

@@ -21,7 +21,6 @@ an issue:
### Getting started
* [Introduction](tutorial/introduction.md)
* [Quick Start](tutorial/quick-start.md)
* [Process Model](tutorial/process-model.md)
### Learning the basics
@@ -128,6 +127,7 @@ These individual tutorials expand on topics discussed in the guide above.
* [pushNotifications](api/push-notifications.md)
* [safeStorage](api/safe-storage.md)
* [screen](api/screen.md)
* [ServiceWorkerMain](api/service-worker-main.md)
* [session](api/session.md)
* [ShareMenu](api/share-menu.md)
* [systemPreferences](api/system-preferences.md)

View File

@@ -1559,8 +1559,8 @@ command line arguments that Chromium uses.
### `app.dock` _macOS_ _Readonly_
A [`Dock`](./dock.md) `| undefined` object that allows you to perform actions on your app icon in the user's
dock on macOS.
A `Dock | undefined` property ([`Dock`](./dock.md) on macOS, `undefined` on all other
platforms) that allows you to perform actions on your app icon in the user's dock.
### `app.isPackaged` _Readonly_

View File

@@ -342,12 +342,12 @@ Emitted when the window has closed a sheet.
Emitted when the native new tab button is clicked.
#### Event: 'system-context-menu' _Windows_
#### Event: 'system-context-menu' _Windows_ _Linux_
Returns:
* `event` Event
* `point` [Point](structures/point.md) - The screen coordinates the context menu was triggered at
* `point` [Point](structures/point.md) - The screen coordinates where the context menu was triggered.
Emitted when the system context menu is triggered on the window, this is
normally only triggered when the user right clicks on the non-client area
@@ -356,6 +356,8 @@ 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-linux).
### Static Methods
The `BaseWindow` class has the following static methods:
@@ -396,7 +398,7 @@ A `View` property for the content view of the window.
A `string` (optional) property that is equal to the `tabbingIdentifier` passed to the `BrowserWindow` constructor or `undefined` if none was set.
#### `win.autoHideMenuBar`
#### `win.autoHideMenuBar` _Linux_ _Windows_
A `boolean` property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single `Alt` key.

View File

@@ -421,12 +421,12 @@ Emitted when the window has closed a sheet.
Emitted when the native new tab button is clicked.
#### Event: 'system-context-menu' _Windows_
#### Event: 'system-context-menu' _Windows_ _Linux_
Returns:
* `event` Event
* `point` [Point](structures/point.md) - The screen coordinates the context menu was triggered at
* `point` [Point](structures/point.md) - The screen coordinates where the context menu was triggered.
Emitted when the system context menu is triggered on the window, this is
normally only triggered when the user right clicks on the non-client area
@@ -435,6 +435,8 @@ 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-linux).
### Static Methods
The `BrowserWindow` class has the following static methods:
@@ -497,7 +499,7 @@ A `Integer` property representing the unique ID of the window. Each ID is unique
A `string` (optional) property that is equal to the `tabbingIdentifier` passed to the `BrowserWindow` constructor or `undefined` if none was set.
#### `win.autoHideMenuBar`
#### `win.autoHideMenuBar` _Linux_ _Windows_
A `boolean` property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single `Alt` key.

View File

@@ -254,7 +254,7 @@ Electron supports some of the [CLI flags][node-cli] supported by Node.js.
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
### `--inspect-brk\[=\[host:]port]`
### `--inspect-brk[=[host:]port]`
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
@@ -266,13 +266,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 +288,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.
@@ -313,6 +317,12 @@ Set the default value of the `verbatim` parameter in the Node.js [`dns.lookup()`
The default is `verbatim` and `dns.setDefaultResultOrder()` have higher priority than `--dns-result-order`.
### `--diagnostic-dir=directory`
Set the directory to which all Node.js diagnostic output files are written. Defaults to current working directory.
Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https://nodejs.org/docs/latest/api/v8.html#v8setheapsnapshotnearheaplimitlimit).
[app]: app.md
[append-switch]: command-line.md#commandlineappendswitchswitch-value
[debugging-main-process]: ../tutorial/debugging-main-process.md

View File

@@ -20,45 +20,87 @@ document.
#### `commandLine.appendSwitch(switch[, value])`
* `switch` string - A command-line switch, without the leading `--`
* `value` string (optional) - A value for the given switch
* `switch` string - A command-line switch, without the leading `--`.
* `value` string (optional) - A value for the given switch.
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.
```js
const { app } = require('electron')
app.commandLine.appendSwitch('remote-debugging-port', '8315')
```
#### `commandLine.appendArgument(value)`
* `value` string - The argument to append to the command line
* `value` string - The argument to append to the command line.
Append an argument to Chromium's command line. The argument will be quoted
correctly. Switches will precede arguments regardless of appending order.
If you're appending an argument like `--switch=value`, consider using `appendSwitch('switch', 'value')` instead.
```js
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.
#### `commandLine.hasSwitch(switch)`
* `switch` string - A command-line switch
* `switch` string - A command-line switch.
Returns `boolean` - Whether the command-line switch is present.
```js
const { app } = require('electron')
app.commandLine.appendSwitch('remote-debugging-port', '8315')
const hasPort = app.commandLine.hasSwitch('remote-debugging-port')
console.log(hasPort) // true
```
#### `commandLine.getSwitchValue(switch)`
* `switch` string - A command-line switch
* `switch` string - A command-line switch.
Returns `string` - The command-line switch value.
This function is meant to obtain Chromium command line switches. It is not
meant to be used for application-specific command line arguments. For the
latter, please use `process.argv`.
```js
const { app } = require('electron')
app.commandLine.appendSwitch('remote-debugging-port', '8315')
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.
#### `commandLine.removeSwitch(switch)`
* `switch` string - A command-line switch
* `switch` string - A command-line switch.
Removes the specified switch from Chromium's command line.
```js
const { app } = require('electron')
app.commandLine.appendSwitch('remote-debugging-port', '8315')
console.log(app.commandLine.hasSwitch('remote-debugging-port')) // true
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.

View File

@@ -61,6 +61,20 @@ The `contextBridge` module has the following methods:
* `apiKey` string - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
* `api` any - Your API, more information on what this API can be and how it works is available below.
### `contextBridge.executeInMainWorld(executionScript)` _Experimental_
<!-- TODO(samuelmaddock): add generics to map the `args` types to the `func` params -->
* `executionScript` Object
* `func` (...args: any[]) => any - A JavaScript function to execute. This function will be serialized which means
that any bound parameters and execution context will be lost.
* `args` any[] (optional) - An array of arguments to pass to the provided function. These
arguments will be copied between worlds in accordance with
[the table of supported types.](#parameter--error--return-type-support)
Returns `any` - A copy of the resulting value from executing the function in the main world.
[Refer to the table](#parameter--error--return-type-support) on how values are copied between worlds.
## Usage
### API

View File

@@ -9,7 +9,7 @@ The following example shows how to bounce your icon on the dock.
```js
const { app } = require('electron')
app.dock.bounce()
app.dock?.bounce()
```
### Instance Methods

View File

@@ -12,9 +12,17 @@ shortcuts.
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')
// Enable usage of Portal's globalShortcuts. This is essential for cases when
// the app runs in a Wayland session.
app.commandLine.appendSwitch('enable-features', 'GlobalShortcutsPortal')
app.whenReady().then(() => {
// Register a 'CommandOrControl+X' shortcut listener.
const ret = globalShortcut.register('CommandOrControl+X', () => {

View File

@@ -10,13 +10,13 @@ The `inAppPurchase` module emits the following events:
### Event: 'transactions-updated'
Emitted when one or more transactions have been updated.
Returns:
* `event` Event
* `transactions` Transaction[] - Array of [`Transaction`](structures/transaction.md) objects.
Emitted when one or more transactions have been updated.
## Methods
The `inAppPurchase` module has the following methods:

View File

@@ -0,0 +1,75 @@
## Class: IpcMainServiceWorker
> Communicate asynchronously from the main process to service workers.
Process: [Main](../glossary.md#main-process)
> [!NOTE]
> This API is a subtle variation of [`IpcMain`](ipc-main.md)—targeted for
> communicating with service workers. For communicating with web frames,
> consult the `IpcMain` documentation.
<!-- TODO(samuelmaddock): refactor doc gen to allow generics to reduce duplication -->
### Instance Methods
#### `ipcMainServiceWorker.on(channel, listener)`
* `channel` string
* `listener` Function
* `event` [IpcMainServiceWorkerEvent][ipc-main-service-worker-event]
* `...args` any[]
Listens to `channel`, when a new message arrives `listener` would be called with
`listener(event, args...)`.
#### `ipcMainServiceWorker.once(channel, listener)`
* `channel` string
* `listener` Function
* `event` [IpcMainServiceWorkerEvent][ipc-main-service-worker-event]
* `...args` any[]
Adds a one time `listener` function for the event. This `listener` is invoked
only the next time a message is sent to `channel`, after which it is removed.
#### `ipcMainServiceWorker.removeListener(channel, listener)`
* `channel` string
* `listener` Function
* `...args` any[]
Removes the specified `listener` from the listener array for the specified
`channel`.
#### `ipcMainServiceWorker.removeAllListeners([channel])`
* `channel` string (optional)
Removes listeners of the specified `channel`.
#### `ipcMainServiceWorker.handle(channel, listener)`
* `channel` string
* `listener` Function\<Promise\<any\> | any\>
* `event` [IpcMainServiceWorkerInvokeEvent][ipc-main-service-worker-invoke-event]
* `...args` any[]
#### `ipcMainServiceWorker.handleOnce(channel, listener)`
* `channel` string
* `listener` Function\<Promise\<any\> | any\>
* `event` [IpcMainServiceWorkerInvokeEvent][ipc-main-service-worker-invoke-event]
* `...args` any[]
Handles a single `invoke`able IPC message, then removes the listener. See
`ipcMainServiceWorker.handle(channel, listener)`.
#### `ipcMainServiceWorker.removeHandler(channel)`
* `channel` string
Removes any handler for `channel`, if present.
[ipc-main-service-worker-event]:../api/structures/ipc-main-service-worker-event.md
[ipc-main-service-worker-invoke-event]:../api/structures/ipc-main-service-worker-invoke-event.md

View File

@@ -41,6 +41,16 @@ The `ipcRenderer` module has the following method to listen for events and send
Listens to `channel`, when a new message arrives `listener` would be called with
`listener(event, args...)`.
:::warning
Do not expose the `event` argument to the renderer for security reasons! Wrap any
callback that you receive from the renderer in another function like this:
`ipcRenderer.on('my-channel', (event, ...args) => callback(...args))`.
Not wrapping the callback in such a function would expose dangerous Electron APIs
to the renderer process. See the
[security guide](../tutorial/security.md#20-do-not-expose-electron-apis-to-untrusted-web-content)
for more info.
:::
### `ipcRenderer.off(channel, listener)`
* `channel` string

View File

@@ -19,7 +19,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)

View File

@@ -327,6 +327,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

@@ -63,6 +63,14 @@ Your application should then always use `shouldUseDarkColors` to determine what
A `boolean` for if the OS / Chromium currently has high-contrast mode enabled
or is being instructed to show a high-contrast UI.
### `nativeTheme.shouldUseDarkColorsForSystemIntegratedUI` _macOS_ _Windows_ _Readonly_
A `boolean` property indicating whether or not the system theme has been set to dark or light.
On Windows this property distinguishes between system and app light/dark theme, returning
`true` if the system theme is set to dark theme and `false` otherwise. On macOS the return
value will be the same as `nativeTheme.shouldUseDarkColors`.
### `nativeTheme.shouldUseInvertedColorScheme` _macOS_ _Windows_ _Readonly_
A `boolean` for if the OS / Chromium currently has an inverted color scheme

View File

@@ -5,7 +5,16 @@
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._
Each navigation entry corresponds to a specific page. The indexing system follows a sequential order, where the first available navigation entry is at index 0, representing the earliest visited page, and the latest navigation entry is at index N, representing the most recent page. Maintaining this ordered list of navigation entries enables seamless navigation both backward and forward through the user's browsing history.
Each [NavigationEntry](./structures/navigation-entry.md) corresponds to a specific visited page.
The indexing system follows a sequential order, where the entry for the earliest visited
page is at index 0 and the entry for the most recent visited page is at index N.
Some APIs in this class also accept an _offset_, which is an integer representing the relative
position of an index from the current entry according to the above indexing system (i.e. an offset
value of `1` would represent going forward in history by one page).
Maintaining this ordered list of navigation entries enables seamless navigation both backward and
forward through the user's browsing history.
### Instance Methods
@@ -21,7 +30,7 @@ Returns `boolean` - Whether the browser can go forward to next web page.
* `offset` Integer
Returns `boolean` - Whether the web page can go to the specified `offset` from the current entry.
Returns `boolean` - Whether the web page can go to the specified relative `offset` from the current entry.
#### `navigationHistory.clear()`
@@ -57,7 +66,7 @@ Navigates browser to the specified absolute web page index.
* `offset` Integer
Navigates to the specified offset from the current entry.
Navigates to the specified relative offset from the current entry.
#### `navigationHistory.length()`
@@ -74,3 +83,22 @@ Returns `boolean` - Whether the navigation entry was removed from the webContent
#### `navigationHistory.getAllEntries()`
Returns [`NavigationEntry[]`](structures/navigation-entry.md) - WebContents complete history.
#### `navigationHistory.restore(options)`
Restores navigation history and loads the given entry in the in stack. Will make a best effort
to restore not just the navigation stack but also the state of the individual pages - for instance
including HTML form values or the scroll position. It's recommended to call this API before any
navigation entries are created, so ideally before you call `loadURL()` or `loadFile()` on the
`webContents` object.
This API allows you to create common flows that aim to restore, recreate, or clone other webContents.
* `options` Object
* `entries` [NavigationEntry[]](structures/navigation-entry.md) - Result of a prior `getAllEntries()` call
* `index` Integer (optional) - Index of the stack that should be loaded. If you set it to `0`, the webContents will load the first (oldest) entry. If you leave it undefined, Electron will automatically load the last (newest) entry.
Returns `Promise<void>` - the promise will resolve when the page has finished loading the selected navigation entry
(see [`did-finish-load`](web-contents.md#event-did-finish-load)), and rejects
if the page fails to load (see
[`did-fail-load`](web-contents.md#event-did-fail-load)). A noop rejection handler is already attached, which avoids unhandled rejection errors.

View File

@@ -26,7 +26,10 @@ Emitted when system changes to battery power.
### Event: 'thermal-state-change' _macOS_
* `state` string - The system's new thermal state. Can be `unknown`, `nominal`, `fair`, `serious`, `critical`.
Returns:
* `details` Event\<\>
* `state` string - The system's new thermal state. Can be `unknown`, `nominal`, `fair`, `serious`, `critical`.
Emitted when the thermal state of the system changes. Notification of a change
in the thermal status of the system, such as entering a critical temperature
@@ -44,7 +47,8 @@ See https://developer.apple.com/library/archive/documentation/Performance/Concep
Returns:
* `limit` number - The operating system's advertised speed limit for CPUs, in percent.
* `details` Event\<\>
* `limit` number - The operating system's advertised speed limit for CPUs, in percent.
Notification of a change in the operating system's advertised speed limit for
CPUs, in percent. Values below 100 indicate that the system is impairing

View File

@@ -114,6 +114,7 @@ A `string` representing the current process's type, can be:
* `browser` - The main process
* `renderer` - A renderer process
* `service-worker` - In a service worker
* `worker` - In a web worker
* `utility` - In a node process launched as a service

View File

@@ -46,4 +46,7 @@ See: https://developer.apple.com/documentation/appkit/nsapplication/1428476-regi
### `pushNotifications.unregisterForAPNSNotifications()` _macOS_
Unregisters the app from notifications received from APNS.
Apps unregistered through this method can always reregister.
See: https://developer.apple.com/documentation/appkit/nsapplication/1428747-unregisterforremotenotifications?language=objc

View File

@@ -124,7 +124,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 +133,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 +145,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

@@ -0,0 +1,54 @@
# ServiceWorkerMain
> An instance of a Service Worker representing a version of a script for a given scope.
Process: [Main](../glossary.md#main-process)
## Class: ServiceWorkerMain
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._
### Instance Methods
#### `serviceWorker.isDestroyed()` _Experimental_
Returns `boolean` - Whether the service worker has been destroyed.
#### `serviceWorker.send(channel, ...args)` _Experimental_
- `channel` string
- `...args` any[]
Send an asynchronous message to the service worker process via `channel`, along with
arguments. Arguments will be serialized with the [Structured Clone Algorithm][SCA],
just like [`postMessage`][], so prototype chains will not be included.
Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
The service worker process can handle the message by listening to `channel` with the
[`ipcRenderer`](ipc-renderer.md) module.
#### `serviceWorker.startTask()` _Experimental_
Returns `Object`:
- `end` Function - Method to call when the task has ended. If never called, the service won't terminate while otherwise idle.
Initiate a task to keep the service worker alive until ended.
### Instance Properties
#### `serviceWorker.ipc` _Readonly_ _Experimental_
An [`IpcMainServiceWorker`](ipc-main-service-worker.md) instance scoped to the service worker.
#### `serviceWorker.scope` _Readonly_ _Experimental_
A `string` representing the scope URL of the service worker.
#### `serviceWorker.versionId` _Readonly_ _Experimental_
A `number` representing the ID of the specific version of the service worker script in its scope.
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

View File

@@ -56,6 +56,17 @@ Returns:
Emitted when a service worker has been registered. Can occur after a call to [`navigator.serviceWorker.register('/sw.js')`](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register) successfully resolves or when a Chrome extension is loaded.
#### Event: 'running-status-changed' _Experimental_
Returns:
* `details` Event\<\>
* `versionId` number - ID of the updated service worker version
* `runningStatus` string - Running status.
Possible values include `starting`, `running`, `stopping`, or `stopped`.
Emitted when a service worker's running status has changed.
### Instance Methods
The following methods are available on instances of `ServiceWorkers`:
@@ -64,10 +75,55 @@ The following methods are available on instances of `ServiceWorkers`:
Returns `Record<number, ServiceWorkerInfo>` - A [ServiceWorkerInfo](structures/service-worker-info.md) object where the keys are the service worker version ID and the values are the information about that service worker.
#### `serviceWorkers.getFromVersionID(versionId)`
#### `serviceWorkers.getInfoFromVersionID(versionId)`
* `versionId` number
* `versionId` number - ID of the service worker version
Returns [`ServiceWorkerInfo`](structures/service-worker-info.md) - Information about this service worker
If the service worker does not exist or is not running this method will throw an exception.
#### `serviceWorkers.getFromVersionID(versionId)` _Deprecated_
* `versionId` number - ID of the service worker version
Returns [`ServiceWorkerInfo`](structures/service-worker-info.md) - Information about this service worker
If the service worker does not exist or is not running this method will throw an exception.
**Deprecated:** Use the new `serviceWorkers.getInfoFromVersionID` API.
#### `serviceWorkers.getWorkerFromVersionID(versionId)` _Experimental_
* `versionId` number - ID of the service worker version
Returns [`ServiceWorkerMain | undefined`](service-worker-main.md) - Instance of the service worker associated with the given version ID. If there's no associated version, or its running status has changed to 'stopped', this will return `undefined`.
#### `serviceWorkers.startWorkerForScope(scope)` _Experimental_
* `scope` string - The scope of the service worker to start.
Returns `Promise<ServiceWorkerMain>` - Resolves with the service worker when it's started.
Starts the service worker or does nothing if already running.
```js
const { app, session } = require('electron')
const { serviceWorkers } = session.defaultSession
// Collect service workers scopes
const workerScopes = Object.values(serviceWorkers.getAllRunning()).map((info) => info.scope)
app.on('browser-window-created', async (event, window) => {
for (const scope of workerScopes) {
try {
// Ensure worker is started
const serviceWorker = await serviceWorkers.startWorkerForScope(scope)
serviceWorker.send('window-created', { windowId: window.id })
} catch (error) {
console.error(`Failed to start service worker for ${scope}`)
console.error(error)
}
}
})
```

View File

@@ -933,6 +933,7 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
* `storage-access` - Allows content loaded in a third-party context to request access to third-party cookies using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).
* `top-level-storage-access` - Allow top-level sites to request third-party cookie access on behalf of embedded content originating from another site in the same related website set using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).
* `usb` - Expose non-standard Universal Serial Bus (USB) compatible devices services to the web with the [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API).
* `deprecated-sync-clipboard-read` _Deprecated_ - Request access to run `document.execCommand("paste")`
* `requestingOrigin` string - The origin URL of the permission check
* `details` Object - Some properties are only available on certain permission types.
* `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
@@ -1330,18 +1331,43 @@ the initial state will be `interrupted`. The download will start only when the
Returns `Promise<void>` - resolves when the sessions HTTP authentication cache has been cleared.
#### `ses.setPreloads(preloads)`
#### `ses.setPreloads(preloads)` _Deprecated_
* `preloads` string[] - An array of absolute path to preload scripts
Adds scripts that will be executed on ALL web contents that are associated with
this session just before normal `preload` scripts run.
#### `ses.getPreloads()`
**Deprecated:** Use the new `ses.registerPreloadScript` API.
#### `ses.getPreloads()` _Deprecated_
Returns `string[]` an array of paths to preload scripts that have been
registered.
**Deprecated:** Use the new `ses.getPreloadScripts` API. This will only return preload script paths
for `frame` context types.
#### `ses.registerPreloadScript(script)`
* `script` [PreloadScriptRegistration](structures/preload-script-registration.md) - Preload script
Registers preload script that will be executed in its associated context type in this session. For
`frame` contexts, this will run prior to any preload defined in the web preferences of a
WebContents.
Returns `string` - The ID of the registered preload script.
#### `ses.unregisterPreloadScript(id)`
* `id` string - Preload script ID
Unregisters script.
#### `ses.getPreloadScripts()`
Returns [`PreloadScript[]`](structures/preload-script.md): An array of paths to preload scripts that have been registered.
#### `ses.setCodeCachePath(path)`
* `path` String - Absolute path to store the v8 generated JS code cache from the renderer.

View File

@@ -58,8 +58,8 @@
`false` on macOS. This option is not configurable on other platforms.
* `disableAutoHideCursor` boolean (optional) - Whether to hide cursor when typing.
Default is `false`.
* `autoHideMenuBar` boolean (optional) - Auto hide the menu bar unless the `Alt`
key is pressed. Default is `false`.
* `autoHideMenuBar` boolean (optional) _Linux_ _Windows_ - Auto hide the menu bar
unless the `Alt` key is pressed. Default is `false`.
* `enableLargerThanScreen` boolean (optional) _macOS_ - Enable the window to
be resized larger than screen. Only relevant for macOS, as other OSes
allow larger-than-screen windows by default. Default is `false`.
@@ -93,13 +93,14 @@
**Note:** This option is currently experimental.
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
* `symbolColor` String (optional) _Windows_ _Linux_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
Set a custom position for the traffic light buttons in frameless windows.
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
should have rounded corners on macOS. Default is `true`. Setting this property
to `false` will prevent the window from being fullscreenable.
* `roundedCorners` boolean (optional) _macOS_ _Windows_ - Whether frameless window
should have rounded corners. Default is `true`. Setting this property
to `false` will prevent the window from being fullscreenable on macOS.
On Windows versions older than Windows 11 Build 22000 this property has no effect, and frameless windows will not have rounded corners.
* `thickFrame` boolean (optional) - Use `WS_THICKFRAME` style for frameless windows on
Windows, which adds standard window frame. Setting it to `false` will remove
window shadow and window animations. Default is `true`.
@@ -149,7 +150,7 @@ Possible values are:
focus, keyboard or mouse events, but you can use `globalShortcut` to receive
input sparingly.
* The `panel` type enables the window to float on top of full-screened apps
by adding the `NSWindowStyleMaskNonactivatingPanel` style mask,normally
by adding the `NSWindowStyleMaskNonactivatingPanel` style mask, normally
reserved for NSPanel, at runtime. Also, the window will appear on all
spaces (desktops).
* On Windows, possible type is `toolbar`.

View File

@@ -5,7 +5,7 @@
* `colorDepth` number - The number of bits per pixel.
* `colorSpace` string - represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions.
* `depthPerComponent` number - The number of bits per color component.
* `detected` boolean - `true`` if the display is detected by the system.
* `detected` boolean - `true` if the display is detected by the system.
* `displayFrequency` number - The display refresh rate.
* `id` number - Unique identifier associated with the display. A value of of -1 means the display is invalid or the correct `id` is not yet known, and a value of -10 means the display is a virtual display assigned to a unified desktop.
* `internal` boolean - `true` for an internal display and `false` for an external display.

View File

@@ -1,5 +1,6 @@
# IpcMainEvent Object extends `Event`
* `type` String - Possible values include `frame`
* `processId` Integer - The internal ID of the renderer process that sent this message
* `frameId` Integer - The ID of the renderer frame that sent this message
* `returnValue` any - Set this to the value to be returned in a synchronous message

View File

@@ -1,5 +1,6 @@
# IpcMainInvokeEvent Object extends `Event`
* `type` String - Possible values include `frame`
* `processId` Integer - The internal ID of the renderer process that sent this message
* `frameId` Integer - The ID of the renderer frame that sent this message
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message

View File

@@ -0,0 +1,11 @@
# IpcMainServiceWorkerEvent Object extends `Event`
* `type` String - Possible values include `service-worker`.
* `serviceWorker` [ServiceWorkerMain](../service-worker-main.md) _Readonly_ - The service worker that sent this message
* `versionId` Number - The service worker version ID.
* `session` Session - The [`Session`](../session.md) instance with which the event is associated.
* `returnValue` any - Set this to the value to be returned in a synchronous message
* `ports` [MessagePortMain](../message-port-main.md)[] - A list of MessagePorts that were transferred with this message
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
* `channel` string
* `...args` any[]

View File

@@ -0,0 +1,6 @@
# IpcMainServiceWorkerInvokeEvent Object extends `Event`
* `type` String - Possible values include `service-worker`.
* `serviceWorker` [ServiceWorkerMain](../service-worker-main.md) _Readonly_ - The service worker that sent this message
* `versionId` Number - The service worker version ID.
* `session` Session - The [`Session`](../session.md) instance with which the event is associated.

View File

@@ -2,3 +2,6 @@
* `url` string
* `title` string
* `pageState` string (optional) - A base64 encoded data string containing Chromium page state
including information like the current scroll position or form values. It is committed by
Chromium before a navigation event and on a regular interval.

View File

@@ -0,0 +1,6 @@
# PreloadScriptRegistration Object
* `type` string - Context type where the preload script will be executed.
Possible values include `frame` or `service-worker`.
* `id` string (optional) - Unique ID of preload script. Defaults to a random UUID.
* `filePath` string - Path of the script file. Must be an absolute path.

View File

@@ -0,0 +1,6 @@
# PreloadScript Object
* `type` string - Context type where the preload script will be executed.
Possible values include `frame` or `service-worker`.
* `id` string - Unique ID of preload script.
* `filePath` string - Path of the script file. Must be an absolute path.

View File

@@ -3,3 +3,4 @@
* `scriptUrl` string - The full URL to the script that this service worker runs
* `scope` string - The base URL that this service worker is active for.
* `renderProcessId` number - The virtual ID of the process that this service worker is running in. This is not an OS level PID. This aligns with the ID set used for `webContents.getProcessId()`.
* `versionId` number - ID of the service worker version

View File

@@ -148,6 +148,7 @@
this will cause the `preferred-size-changed` event to be emitted on the
`WebContents` when the preferred size changes. Default is `false`.
* `transparent` boolean (optional) - Whether to enable background transparency for the guest page. Default is `true`. **Note:** The guest page's text and background colors are derived from the [color scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme) of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent.
* `enableDeprecatedPaste` boolean (optional) _Deprecated_ - Whether to enable the `paste` [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand). Default is `false`.
[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5

View File

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

View File

@@ -6,7 +6,7 @@ Process: [Main](../glossary.md#main-process), [Utility](../glossary.md#utility-p
```js
const { systemPreferences } = require('electron')
console.log(systemPreferences.isAeroGlassEnabled())
console.log(systemPreferences.getEffectiveAppearance())
```
## Events
@@ -181,35 +181,13 @@ Some popular `key` and `type`s are:
Removes the `key` in `NSUserDefaults`. This can be used to restore the default
or global value of a `key` previously set with `setUserDefault`.
### `systemPreferences.isAeroGlassEnabled()` _Windows_
### `systemPreferences.isAeroGlassEnabled()` _Windows_ _Deprecated_
Returns `boolean` - `true` if [DWM composition][dwm-composition] (Aero Glass) is
enabled, and `false` otherwise.
An example of using it to determine if you should create a transparent window or
not (transparent windows won't work correctly when DWM composition is disabled):
```js
const { BrowserWindow, systemPreferences } = require('electron')
const browserOptions = { width: 1000, height: 800 }
// Make the window transparent only if the platform supports it.
if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
browserOptions.transparent = true
browserOptions.frame = false
}
// Create the window.
const win = new BrowserWindow(browserOptions)
// Navigate.
if (browserOptions.transparent) {
win.loadFile('index.html')
} else {
// No transparency, so we load a fallback that uses basic styles.
win.loadFile('fallback.html')
}
```
**Deprecated:**
This function has been always returning `true` since Electron 23, which only supports Windows 10+.
[dwm-composition]: https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw

View File

@@ -44,6 +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`.
## Class: UtilityProcess
> Instances of the `UtilityProcess` represent the Chromium spawned child process

View File

@@ -106,6 +106,12 @@ Examples of valid `color` values:
* `visible` boolean - If false, the view will be hidden from display.
#### `view.getVisible()`
Returns `boolean` - Whether the view should be drawn. Note that this is
different from whether the view is visible on screen—it may still be obscured
or out of view.
### Instance Properties
Objects created with `new View` have the following properties:

View File

@@ -2389,7 +2389,7 @@ A [`WebFrameMain`](web-frame-main.md) property that represents the top frame of
#### `contents.opener` _Readonly_
A [`WebFrameMain`](web-frame-main.md) property that represents the frame that opened this WebContents, either
A [`WebFrameMain | null`](web-frame-main.md) property that represents the frame that opened this WebContents, either
with open(), or by navigating a link with a target attribute.
[keyboardevent]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent

View File

@@ -73,6 +73,7 @@ The `callback` has to be called with an `response` object.
Some examples of valid `urls`:
```js
'<all_urls>'
'http://foo:1234/'
'http://foo.com/'
'http://foo:1234/bar'

View File

@@ -14,6 +14,58 @@ This document uses the following convention to categorize breaking changes:
## Planned Breaking API Changes (35.0)
### Behavior Changes: `app.commandLine`
`app.commandLine` will convert upper-cases switches and arguments to lowercase.
`app.commandLine` was only meant to handle chromium switches (which aren't case-sensitive) and switches passed via `app.commandLine` will not be passed down to any of the child processes.
If you were using `app.commandLine` to control the behavior of the main process, you should do this via `process.argv`.
### Behavior Changed: Dialog API's `defaultPath` option on Linux
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)
can be used to force a required version for your application.
See [#44426](https://github.com/electron/electron/pull/44426) for more details.
### Deprecated: `setPreloads`, `getPreloads` on `Session`
`registerPreloadScript`, `unregisterPreloadScript`, and `getPreloadScripts` are introduced as a
replacement for the deprecated methods. These new APIs allow third-party libraries to register
preload scripts without replacing existing scripts. Also, the new `type` option allows for
additional preload targets beyond `frame`.
```js
// Deprecated
session.setPreloads([path.join(__dirname, 'preload.js')])
// Replace with:
session.registerPreloadScript({
type: 'frame',
id: 'app-preload',
filePath: path.join(__dirname, 'preload.js')
})
```
### Deprecated: `getFromVersionID` on `session.serviceWorkers`
The `session.serviceWorkers.fromVersionID(versionId)` API has been deprecated
in favor of `session.serviceWorkers.getInfoFromVersionID(versionId)`. This was
changed to make it more clear which object is returned with the introduction
of the `session.serviceWorkers.getWorkerFromVersionID(versionId)` API.
```js
// Deprecated
session.serviceWorkers.fromVersionID(versionId)
// Replace with
session.serviceWorkers.getInfoFromVersionID(versionId)
```
### Deprecated: `level`, `message`, `line`, and `sourceId` arguments in `console-message` event on `WebContents`
The `console-message` event on `WebContents` has been updated to provide details on the `Event`
@@ -29,6 +81,29 @@ webContents.on('console-message', ({ level, message, lineNumber, sourceId, frame
Additionally, `level` is now a string with possible values of `info`, `warning`, `error`, and `debug`.
### Behavior Changed: `urls` property of `WebRequestFilter`.
Previously, an empty urls array was interpreted as including all URLs. To explicitly include all URLs, developers should now use the `<all_urls>` pattern, which is a [designated URL pattern](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns#all_urls) that matches every possible URL. This change clarifies the intent and ensures more predictable behavior.
```js
// Deprecated
const deprecatedFilter = {
urls: []
}
// Replace with
const newFilter = {
urls: ['<all_urls>']
}
```
### Deprecated: `systemPreferences.isAeroGlassEnabled()`
The `systemPreferences.isAeroGlassEnabled()` function has been deprecated without replacement.
It has been always returning `true` since Electron 23, which only supports Windows 10+, where DWM composition can no longer be disabled.
https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw#disabling-dwm-composition-windows7-and-earlier
## Planned Breaking API Changes (34.0)
### Behavior Changed: menu bar will be hidden during fullscreen on Windows
@@ -39,6 +114,15 @@ This brings the behavior to parity with Linux. Prior behavior: Menu bar is still
## Planned Breaking API Changes (33.0)
### Deprecated: `document.execCommand("paste")`
The synchronous clipboard read API [document.execCommand("paste")](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard) has been
deprecated in favor of [async clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API). This is to align with the browser defaults.
The `enableDeprecatedPaste` option on `WebPreferences` that triggers the permission
checks for this API and the associated permission type `deprecated-sync-clipboard-read`
are also deprecated.
### Behavior Changed: frame properties may retrieve detached WebFrameMain instances or none at all
APIs which provide access to a `WebFrameMain` instance may return an instance
@@ -56,15 +140,15 @@ immediately upon being received. Otherwise, it's not guaranteed to point to the
same webpage as when received. To avoid misaligned expectations, Electron will
return `null` in the case of late access where the webpage has changed.
```ts
```js
ipcMain.on('unload-event', (event) => {
event.senderFrame; // ✅ accessed immediately
});
event.senderFrame // ✅ accessed immediately
})
ipcMain.on('unload-event', async (event) => {
await crossOriginNavigationPromise;
event.senderFrame; // ❌ returns `null` due to late access
});
await crossOriginNavigationPromise
event.senderFrame // ❌ returns `null` due to late access
})
```
### Behavior Changed: custom protocol URL handling on Windows
@@ -111,6 +195,16 @@ macOS 10.15 (Catalina) is no longer supported by [Chromium](https://chromium-rev
Older versions of Electron will continue to run on Catalina, but macOS 11 (Big Sur)
or later will be required to run Electron v33.0.0 and higher.
### Behavior Changed: Native modules now require C++20
Due to changes made upstream, both
[V8](https://chromium-review.googlesource.com/c/v8/v8/+/5587859) and
[Node.js](https://github.com/nodejs/node/pull/45427) now require C++20 as a
minimum version. Developers using native node modules should build their
modules with `--std=c++20` rather than `--std=c++17`. Images using gcc9 or
lower may need to update to gcc10 in order to compile. See
[#43555](https://github.com/electron/electron/pull/43555) for more details.
### Deprecated: `systemPreferences.accessibilityDisplayShouldReduceTransparency`
The `systemPreferences.accessibilityDisplayShouldReduceTransparency` property is now deprecated in favor of the new `nativeTheme.prefersReducedTransparency`, which provides identical information and works cross-platform.
@@ -182,6 +276,14 @@ win.webContents.navigationHistory.canGoToOffset()
win.webContents.navigationHistory.goToOffset(index)
```
### Behavior changed: Directory `databases` in `userData` will be deleted
If you have a directory called `databases` in the directory returned by
`app.getPath('userData')`, it will be deleted when Electron 32 is first run.
The `databases` directory was used by WebSQL, which was removed in Electron 31.
Chromium now performs a cleanup that deletes this directory. See
[issue #45396](https://github.com/electron/electron/issues/45396).
## Planned Breaking API Changes (31.0)
### Removed: `WebSQL` support

View File

@@ -65,7 +65,7 @@ Verify that the Pull Request is correct and make a corresponding entry in the
API History:
> [!NOTE]
> Refer to the [API History section of `styleguide.md`](../styleguide.md#api-history)
> Refer to the [API History section of `style-guide.md`](./style-guide.md#api-history)
for information on how to create API History blocks.
`````markdown

View File

@@ -195,7 +195,7 @@ required[, optional]
More detailed information on each of the arguments is noted in an unordered list
below the method. The type of argument is notated by either JavaScript primitives
(e.g. `string`, `Promise`, or `Object`), a custom API structure like Electron's
[`Cookie`](api/structures/cookie.md), or the wildcard `any`.
[`Cookie`](../api/structures/cookie.md), or the wildcard `any`.
If the argument is of type `Array`, use `[]` shorthand with the type of value
inside the array (for example,`any[]` or `string[]`).
@@ -290,7 +290,7 @@ The purpose of the API History block is to describe when/where/how/why an API wa
Each API change listed in the block should include a link to the
PR where that change was made along with an optional short description of the
change. If applicable, include the [heading id](https://gist.github.com/asabaylus/3071099)
for that change from the [breaking changes documentation](./breaking-changes.md).
for that change from the [breaking changes documentation](../breaking-changes.md).
The [API History linting script][api-history-linting-script] (`lint:api-history`)
validates API History blocks in the Electron documentation against the schema and

View File

@@ -24,9 +24,7 @@ const dockMenu = Menu.buildFromTemplate([
])
app.whenReady().then(() => {
if (process.platform === 'darwin') {
app.dock.setMenu(dockMenu)
}
app.dock?.setMenu(dockMenu)
}).then(createWindow)
app.on('window-all-closed', () => {

View File

@@ -37,7 +37,6 @@ the illusion of a circular window.
open on the user's system).
* The window will not be transparent when DevTools is opened.
* On _Windows_:
* Transparent windows will not work when DWM is disabled.
* Transparent windows can not be maximized using the Windows system menu or by double
clicking the title bar. The reasoning behind this can be seen on
PR [#28207](https://github.com/electron/electron/pull/28207).

View File

@@ -9,10 +9,11 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
| 35.0.0 | 2025-Jan-16 | 2025-Feb-05 | 2025-Mar-04 | 2025-Sep-02 | M134 | TBD | ✅ |
| 36.0.0 | 2025-Mar-06 | 2025-Apr-02 | 2025-Apr-29 | 2025-Oct-28 | M136 | TBD | ✅ |
| 35.0.0 | 2025-Jan-16 | 2025-Feb-05 | 2025-Mar-04 | 2025-Sep-02 | M134 | v22.14 | ✅ |
| 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2025-Jan-14 | 2025-Jun-24 | M132 | v20.18 | ✅ |
| 33.0.0 | 2024-Aug-22 | 2024-Sep-18 | 2024-Oct-15 | 2025-Apr-29 | M130 | v20.18 | ✅ |
| 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | v20.16 | |
| 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | v20.16 | 🚫 |
| 31.0.0 | 2024-Apr-18 | 2024-May-15 | 2024-Jun-11 | 2025-Jan-14 | M126 | v20.14 | 🚫 |
| 30.0.0 | 2024-Feb-22 | 2024-Mar-20 | 2024-Apr-16 | 2024-Oct-15 | M124 | v20.11 | 🚫 |
| 29.0.0 | 2023-Dec-07 | 2024-Jan-24 | 2024-Feb-20 | 2024-Aug-20 | M122 | v20.9 | 🚫 |

View File

@@ -14,7 +14,7 @@ To configure a local keyboard shortcut, you need to specify an [`accelerator`][]
property when creating a [MenuItem][] within the [Menu][] module.
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` to be:
[tutorial starter code][tutorial-starter-code], update the `main.js` to be:
```fiddle docs/fiddles/features/keyboard-shortcuts/local
const { app, BrowserWindow, Menu, MenuItem } = require('electron/main')
@@ -75,7 +75,7 @@ module to detect keyboard events even when the application does not have
keyboard focus.
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` to be:
[tutorial starter code][tutorial-starter-code], update the `main.js` to be:
```fiddle docs/fiddles/features/keyboard-shortcuts/global
const { app, BrowserWindow, globalShortcut } = require('electron/main')
@@ -144,7 +144,7 @@ is emitted before dispatching `keydown` and `keyup` events in the page. It can
be used to catch and handle custom shortcuts that are not visible in the menu.
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` file with the
[tutorial starter code][tutorial-starter-code], update the `main.js` file with the
following lines:
```fiddle docs/fiddles/features/keyboard-shortcuts/interception-from-main
@@ -207,3 +207,4 @@ Mousetrap.bind('up up down down left right left right b a enter', () => {
[mousetrap]: https://github.com/ccampbell/mousetrap
[dom-events]: https://developer.mozilla.org/en-US/docs/Web/Events
[addEventListener-api]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
[tutorial-starter-code]: tutorial-2-first-app.md#final-starter-code

View File

@@ -50,9 +50,7 @@ const dockMenu = Menu.buildFromTemplate([
])
app.whenReady().then(() => {
if (process.platform === 'darwin') {
app.dock.setMenu(dockMenu)
}
app.dock?.setMenu(dockMenu)
}).then(createWindow)
app.on('window-all-closed', () => {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,380 @@
# Native Code and Electron
One of Electron's most powerful features is the ability to combine web technologies with native code - both for compute-intensive logic as well as for the occasional native user interface, where desired.
Electron does so by building on top of "Native Node.js Addons". You've probably already come across a few of them - packages like the famous [sqlite](https://www.npmjs.com/package/sqlite3) use native code to combine JavaScript and native technologies. You can use this feature to extend your Electron application with anything a fully native application can do:
* Access native platform APIs not available in JavaScript. Any macOS, Windows, or Linux operating system API is available to you.
* Create UI components that interact with native desktop frameworks.
* Integrate with existing native libraries.
* Implement performance-critical code that runs faster than JavaScript.
Native Node.js addons are dynamically-linked shared objects (on Unix-like systems) or DLL files (on Windows) that can be loaded into Node.js or Electron using the `require()` or `import` functions. They behave just like regular JavaScript modules but provide an interface to code written in C++, Rust, or other languages that can compile to native code.
# Tutorial: Creating a Native Node.js Addon for Electron
This tutorial will walk you through building a basic Node.js native addon that can be used in Electron applications. We'll focus on concepts common to all platforms, using C++ as the implementation language. Once you complete this tutorial common to all native Node.js addons, you can move on to one of our platform-specific tutorials.
## Requirements
This tutorial assumes you have Node.js and npm installed, as well as the basic tools necessary for compiling code on your platform (like Visual Studio on Windows, Xcode on macOS, or GCC/Clang on Linux). You can find detailed instructions in the [`node-gyp` readme](https://github.com/nodejs/node-gyp?tab=readme-ov-file).
### Requirements: macOS
To build native Node.js addons on macOS, you'll need the Xcode Command Line Tools. These provide the necessary compilers and build tools (namely, `clang`, `clang++`, and `make`). The following command will prompt you to install the Command Line Tools if they aren't already installed.
```sh
xcode-select --install
```
### Requirements: Windows
The official Node.js installer offers the optional installation of "Tools for Native Modules", which installs everything required for the basic compilation of C++ modules - specifically, Python 3 and the "Visual Studio Desktop development with C++" workload. Alternatively, you can use `chocolatey`, `winget`, or the Windows Store.
### Requirements: Linux
* [A supported version of Python](https://devguide.python.org/versions/)
* `make`
* A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org)
## 1) Creating a package
First, create a new Node.js package that will contain your native addon:
```sh
mkdir my-native-addon
cd my-native-addon
npm init -y
```
This creates a basic `package.json` file. Next, we'll install the necessary dependencies:
```sh
npm install node-addon-api bindings
```
* `node-addon-api`: This is a C++ wrapper for the low-level Node.js API that makes it easier to build addons. It provides a C++ object-oriented API that's more convenient and safer to use than the raw C-style API.
* `bindings`: A helper module that simplifies the process of loading your compiled native addon. It handles finding your compiled `.node` file automatically.
Now, let's update our `package.json` to include the appropriate build scripts. We will explain what these specifically do further below.
```json title='package.json'
{
"name": "my-native-addon",
"version": "1.0.0",
"description": "A native addon for Electron",
"main": "js/index.js",
"scripts": {
"clean": "node -e \"require('fs').rmSync('build', { recursive: true, force: true })\"",
"build": "node-gyp configure && node-gyp build"
},
"dependencies": {
"bindings": "^1.5.0",
"node-addon-api": "^8.3.0"
},
"devDependencies": {
"node-gyp": "^11.1.0"
}
}
```
These scripts will:
* `clean`: Remove the build directory, allowing for a fresh build
* `build`: Run the standard node-gyp build process to compile your addon
## 2) Setting up the build system
Node.js addons use a build system called `node-gyp`, which is a cross-platform command-line tool written in Node.js. It compiles native addon modules for Node.js using platform-specific build tools behind the scenes:
* On Windows: Visual Studio
* On macOS: Xcode or command-line tools
* On Linux: GCC or similar compilers
### Configuring `node-gyp`
The `binding.gyp` file is a JSON-like configuration file that tells node-gyp how to build your native addon. It's similar to a make file or a project file but in a platform-independent format. Let's create a basic `binding.gyp` file:
```json title='binding.gyp'
{
"targets": [
{
"target_name": "my_addon",
"sources": [
"src/my_addon.cc",
"src/cpp_code.cc"
],
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")",
"include"
],
"dependencies": [
"<!(node -p \"require('node-addon-api').gyp\")"
],
"defines": [
"NODE_ADDON_API_CPP_EXCEPTIONS"
],
"cflags!": ["-fno-exceptions"],
"cflags_cc!": ["-fno-exceptions"],
"xcode_settings": {
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"CLANG_CXX_LIBRARY": "libc++",
"MACOSX_DEPLOYMENT_TARGET": "10.14"
},
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1
}
}
}
]
}
```
Let's break down this configuration:
* `target_name`: The name of your addon. This determines the filename of the compiled module (my_addon.node).
* `sources`: List of source files to compile. We'll have two files: the main addon file and our actual C++ implementation.
* `include_dirs`: Directories to search for header files. The cryptic-looking line `<!@(node -p \"require('node-addon-api').include\")` runs a Node.js command to get the path to the node-addon-api include directory.
* `dependencies`: The `node-addon-api` dependency. Similar to the include dirs, this executes a Node.js command to get the proper configuration.
* `defines`: Preprocessor definitions. Here we're enabling C++ exceptions for node-addon-api.
Platform-specific settings:
* `cflags`! and cflags_cc!: Compiler flags for Unix-like systems
* `xcode_settings`: Settings specific to macOS/Xcode compiler
* `msvs_settings`: Settings specific to Microsoft Visual Studio on Windows
Now, create the directory structure for our project:
```sh
mkdir src
mkdir include
mkdir js
```
This creates:
* `src/`: Where our source files will go
* `include/`: For header files
* `js/`: For our JavaScript wrapper
## 3) "Hello World" from C++
Let's start by defining our C++ interface in a header file. Create `include/cpp_code.h`:
```cpp
#pragma once
#include <string>
namespace cpp_code {
// A simple function that takes a string input and returns a string
std::string hello_world(const std::string& input);
} // namespace cpp_code
```
The `#pragma once` directive is a header guard that prevents the file from being included multiple times in the same compilation unit. The actual function declaration is inside a namespace to avoid potential name conflicts.
Next, let's implement the function in `src/cpp_code.cc`:
```cpp title='src/cpp_code.cc'
#include <string>
#include "../include/cpp_code.h"
namespace cpp_code {
std::string hello_world(const std::string& input) {
// Simply concatenate strings and return
return "Hello from C++! You said: " + input;
}
} // namespace cpp_code
```
This is a simple implementation that just adds some text to the input string and returns it.
Now, let's create the addon code that bridges our C++ code with the Node.js/JavaScript world. Create `src/my_addon.cc`:
```cpp title='src/my_addon.cc'
#include <napi.h>
#include <string>
#include "../include/cpp_code.h"
// Create a class that will be exposed to JavaScript
class MyAddon : public Napi::ObjectWrap<MyAddon> {
public:
// This static method defines the class for JavaScript
static Napi::Object Init(Napi::Env env, Napi::Object exports) {
// Define the JavaScript class with method(s)
Napi::Function func = DefineClass(env, "MyAddon", {
InstanceMethod("helloWorld", &MyAddon::HelloWorld)
});
// Create a persistent reference to the constructor
Napi::FunctionReference* constructor = new Napi::FunctionReference();
*constructor = Napi::Persistent(func);
env.SetInstanceData(constructor);
// Set the constructor on the exports object
exports.Set("MyAddon", func);
return exports;
}
// Constructor
MyAddon(const Napi::CallbackInfo& info)
: Napi::ObjectWrap<MyAddon>(info) {}
private:
// Method that will be exposed to JavaScript
Napi::Value HelloWorld(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
// Validate arguments (expecting one string)
if (info.Length() < 1 || !info[0].IsString()) {
Napi::TypeError::New(env, "Expected string argument").ThrowAsJavaScriptException();
return env.Null();
}
// Convert JavaScript string to C++ string
std::string input = info[0].As<Napi::String>();
// Call our C++ function
std::string result = cpp_code::hello_world(input);
// Convert C++ string back to JavaScript string and return
return Napi::String::New(env, result);
}
};
// Initialize the addon
Napi::Object Init(Napi::Env env, Napi::Object exports) {
return MyAddon::Init(env, exports);
}
// Register the initialization function
NODE_API_MODULE(my_addon, Init)
```
Let's break down this code:
1. We define a `MyAddon` class that inherits from `Napi::ObjectWrap<MyAddon>`, which handles wrapping our C++ class for JavaScript.
2. The `Init` static method:
2.1 Defines a JavaScript class with a method called `helloWorld`
2.2 Creates a persistent reference to the constructor (to prevent garbage collection)
2.3 Exports the class constructor
3. The constructor simply passes its arguments to the parent class.
4. The `HelloWorld` method:
4.1 Gets the Napi environment
4.2 Validates input arguments (expecting a string)
4.3 Converts the JavaScript string to a C++ string
4.4 Calls our C++ function
4.5 Converts the result back to a JavaScript string and returns it
5. We define an initialization function and register it with NODE_API_MODULE macro, which makes our module loadable by Node.js.
Now, let's create a JavaScript wrapper to make the addon easier to use. Create `js/index.js`:
```js title='js/index.js' @ts-expect-error=[5]
const EventEmitter = require('events')
// Load the native addon using the 'bindings' module
// This will look for the compiled .node file in various places
const bindings = require('bindings')
const native = bindings('my_addon')
// Create a nice JavaScript wrapper
class MyNativeAddon extends EventEmitter {
constructor () {
super()
// Create an instance of our C++ class
this.addon = new native.MyAddon()
}
// Wrap the C++ method with a nicer JavaScript API
helloWorld (input = '') {
if (typeof input !== 'string') {
throw new TypeError('Input must be a string')
}
return this.addon.helloWorld(input)
}
}
// Export a singleton instance
if (process.platform === 'win32' || process.platform === 'darwin' || process.platform === 'linux') {
module.exports = new MyNativeAddon()
} else {
// Provide a fallback for unsupported platforms
console.warn('Native addon not supported on this platform')
module.exports = {
helloWorld: (input) => `Hello from JS! You said: ${input}`
}
}
```
This JavaScript wrapper:
1. Uses `bindings` to load our compiled native addon
1. Creates a class that extends EventEmitter (useful for future extensions that might emit events)
1. Instantiates our C++ class and provides a simpler API
1. Adds some input validation on the JavaScript side
1. Exports a singleton instance of our wrapper
1. Handles unsupported platforms gracefully
### Building and testing the addon
Now we can build our native addon:
```sh
npm run build
```
This will run `node-gyp configure` and `node-gyp build` to compile our C++ code into a `.node` file.
Let's create a simple test script to verify everything works. Create `test.js` in the project root:
```js title='test.js' @ts-expect-error=[2]
// Load our addon
const myAddon = require('./js')
// Try the helloWorld function
const result = myAddon.helloWorld('This is a test')
// Should print: "Hello from C++! You said: This is a test"
console.log(result)
```
Run the test:
```sh
node test.js
```
If everything works correctly, you should see:
```txt
Hello from C++! You said: This is a test
```
### Using the addon in Electron
To use this addon in an Electron application, you would:
1. Include it as a dependency in your Electron project
1. Build it targeting your specific Electron version. `electron-forge` handles this step automatically for you - for more details, see [Native Node Modules](./using-native-node-modules.md).
1. Import and use it just like any other module in a process that has Node.js enabled.
```js @ts-expect-error=[2]
// In your main process
const myAddon = require('my-native-addon')
console.log(myAddon.helloWorld('Electron'))
```
## References and further learning
Native addon development can be written in several languages beyond C++. Rust can be used with crates like [`napi-rs`](https://github.com/napi-rs/napi-rs), [`neon`](https://neon-rs.dev/), or [`node-bindgen`](https://github.com/infinyon/node-bindgen). Objective-C/Swift can be used through Objective-C++ on macOS.
The specific implementation details differ significantly by platform, especially when accessing platform-specific APIs or UI frameworks, like Windows' Win32 API, COM components, UWP/WinRT - or macOS's Cocoa, AppKit, or ObjectiveC runtime.
This means that you'll likely use two groups of references for your native code: First, on the Node.js side, use the [N-API documentation](https://nodejs.org/api/n-api.html) to learn about creating and exposing complex structures to JavaScript - like asynchronous thread-safe function calls or creating JavaScript-native objects (`error`, `promise`, etc). Secondly, on the side of the technology you're working with, you'll likely be looking at their lower-level documentation:
* [Microsoft C++, C, and Assembler documentation](https://learn.microsoft.com/en-us/cpp/?view=msvc-170)
* [C++/WinRT](https://learn.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/)
* [MSVC-170 C++ Documentation](https://learn.microsoft.com/en-us/cpp/cpp/?view=msvc-170)
* [Apple Developer Documentation](https://developer.apple.com/documentation)
* [Programming with Objective-C](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011210)

View File

@@ -22,12 +22,9 @@ In `preload.js` use the [`contextBridge`][] to inject a method `window.electron.
```js
const { contextBridge, ipcRenderer } = require('electron')
const path = require('node:path')
contextBridge.exposeInMainWorld('electron', {
startDrag: (fileName) => {
ipcRenderer.send('ondragstart', path.join(process.cwd(), fileName))
}
startDrag: (fileName) => ipcRenderer.send('ondragstart', fileName)
})
```

View File

@@ -69,8 +69,25 @@ if (navigationHistory.canGoToOffset(2)) {
}
```
## Restoring history
A common flow is that you want to restore the history of a webContents - for instance to implement an "undo close tab" feature. To do so, you can call `navigationHistory.restore({ index, entries })`. This will restore the webContent's navigation history and the webContents location in said history, meaning that `goBack()` and `goForward()` navigate you through the stack as expected.
```js @ts-type={navigationHistory:Electron.NavigationHistory}
const firstWindow = new BrowserWindow()
// Later, you want a second window to have the same history and navigation position
async function restore () {
const entries = firstWindow.webContents.navigationHistory.getAllEntries()
const index = firstWindow.webContents.navigationHistory.getActiveIndex()
const secondWindow = new BrowserWindow()
await secondWindow.webContents.navigationHistory.restore({ index, entries })
}
```
Here's a full example that you can open with Electron Fiddle:
```fiddle docs/fiddles/features/navigation-history
```

View File

@@ -14,7 +14,7 @@ _Notes_:
* There are two rendering modes that can be used (see the section below) and only
the dirty area is passed to the `paint` event to be more efficient.
* You can stop/continue the rendering as well as set the frame rate.
* The maximum frame rate is 240 because greater values bring only performance
* When `webPreferences.offscreen.useSharedTexture` is not `true`, the maximum frame rate is 240 because greater values bring only performance
losses with no benefits.
* When nothing is happening on a webpage, no frames are generated.
* An offscreen window is always created as a

View File

@@ -86,7 +86,7 @@ The main process also controls your application's lifecycle through Electron's
that you can use to add custom application behavior (for instance, programmatically
quitting your application, modifying the application dock, or showing an About panel).
As a practical example, the app shown in the [quick start guide][quick-start-lifecycle]
As a practical example, the app shown in the [tutorial starter code][tutorial-lifecycle]
uses `app` APIs to create a more native application window experience.
```js title='main.js'
@@ -97,7 +97,7 @@ app.on('window-all-closed', () => {
```
[app]: ../api/app.md
[quick-start-lifecycle]: ../tutorial/quick-start.md#manage-your-windows-lifecycle
[tutorial-lifecycle]: ../tutorial/tutorial-2-first-app.md#quit-the-app-when-all-windows-are-closed-windows--linux
### Native APIs

View File

@@ -1,513 +0,0 @@
# Quick Start
This guide will step you through the process of creating a barebones Hello World app in
Electron, similar to [`electron/electron-quick-start`][quick-start].
By the end of this tutorial, your app will open a browser window that displays a web page
with information about which Chromium, Node.js, and Electron versions are running.
[quick-start]: https://github.com/electron/electron-quick-start
## Prerequisites
To use Electron, you need to install [Node.js][node-download]. We recommend that you
use the latest `LTS` version available.
> Please install Node.js using pre-built installers for your platform.
> You may encounter incompatibility issues with different development tools otherwise.
To check that Node.js was installed correctly, type the following commands in your
terminal client:
```sh
node -v
npm -v
```
The commands should print the versions of Node.js and npm accordingly.
**Note:** Since Electron embeds Node.js into its binary, the version of Node.js running
your code is unrelated to the version running on your system.
[node-download]: https://nodejs.org/en/download/
## Create your application
### Scaffold the project
Electron apps follow the same general structure as other Node.js projects.
Start by creating a folder and initializing an npm package.
```sh npm2yarn
mkdir my-electron-app && cd my-electron-app
npm init
```
The interactive `init` command will prompt you to set some fields in your config.
There are a few rules to follow for the purposes of this tutorial:
* `entry point` should be `main.js`.
* `author` and `description` can be any value, but are necessary for
[app packaging](#package-and-distribute-your-application).
Your `package.json` file should look something like this:
```json
{
"name": "my-electron-app",
"version": "1.0.0",
"description": "Hello World!",
"main": "main.js",
"author": "Jane Doe",
"license": "MIT"
}
```
Then, install the `electron` package into your app's `devDependencies`.
```sh npm2yarn
npm install --save-dev electron
```
> Note: If you're encountering any issues with installing Electron, please
> refer to the [Advanced Installation][advanced-installation] guide.
Finally, you want to be able to execute Electron. In the [`scripts`][package-scripts]
field of your `package.json` config, add a `start` command like so:
```json
{
"scripts": {
"start": "electron ."
}
}
```
This `start` command will let you open your app in development mode.
```sh npm2yarn
npm start
```
> Note: This script tells Electron to run on your project's root folder. At this stage,
> your app will immediately throw an error telling you that it cannot find an app to run.
[advanced-installation]: ./installation.md
[package-scripts]: https://docs.npmjs.com/cli/v7/using-npm/scripts
### Run the main process
The entry point of any Electron application is its `main` script. This script controls the
**main process**, which runs in a full Node.js environment and is responsible for
controlling your app's lifecycle, displaying native interfaces, performing privileged
operations, and managing renderer processes (more on that later).
During execution, Electron will look for this script in the [`main`][package-json-main]
field of the app's `package.json` config, which you should have configured during the
[app scaffolding](#scaffold-the-project) step.
To initialize the `main` script, create an empty file named `main.js` in the root folder
of your project.
> Note: If you run the `start` script again at this point, your app will no longer throw
> any errors! However, it won't do anything yet because we haven't added any code into
> `main.js`.
[package-json-main]: https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main
### Create a web page
Before we can create a window for our application, we need to create the content that
will be loaded into it. In Electron, each window displays web contents that can be loaded
from either a local HTML file or a remote URL.
For this tutorial, you will be doing the former. Create an `index.html` file in the root
folder of your project:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using Node.js <span id="node-version"></span>,
Chromium <span id="chrome-version"></span>,
and Electron <span id="electron-version"></span>.
</body>
</html>
```
> Note: Looking at this HTML document, you can observe that the version numbers are
> missing from the body text. We'll manually insert them later using JavaScript.
### Opening your web page in a browser window
Now that you have a web page, load it into an application window. To do so, you'll
need two Electron modules:
* The [`app`][app] module, which controls your application's event lifecycle.
* The [`BrowserWindow`][browser-window] module, which creates and manages application
windows.
Because the main process runs Node.js, you can import these as [CommonJS][commonjs]
modules at the top of your `main.js` file:
```js
const { app, BrowserWindow } = require('electron')
```
Then, add a `createWindow()` function that loads `index.html` into a new `BrowserWindow`
instance.
```js
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600
})
win.loadFile('index.html')
}
```
Next, call this `createWindow()` function to open your window.
In Electron, browser windows can only be created after the `app` module's
[`ready`][app-ready] event is fired. You can wait for this event by using the
[`app.whenReady()`][app-when-ready] API. Call `createWindow()` after `whenReady()`
resolves its Promise.
```js @ts-type={createWindow:()=>void}
app.whenReady().then(() => {
createWindow()
})
```
> Note: At this point, your Electron application should successfully
> open a window that displays your web page!
[app]: ../api/app.md
[browser-window]: ../api/browser-window.md
[commonjs]: https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules
[app-ready]: ../api/app.md#event-ready
[app-when-ready]: ../api/app.md#appwhenready
### Manage your window's lifecycle
Although you can now open a browser window, you'll need some additional boilerplate code
to make it feel more native to each platform. Application windows behave differently on
each OS, and Electron puts the responsibility on developers to implement these
conventions in their app.
In general, you can use the `process` global's [`platform`][node-platform] attribute
to run code specifically for certain operating systems.
#### Quit the app when all windows are closed (Windows & Linux)
On Windows and Linux, exiting all windows generally quits an application entirely.
To implement this, listen for the `app` module's [`'window-all-closed'`][window-all-closed]
event, and call [`app.quit()`][app-quit] if the user is not on macOS (`darwin`).
```js
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
```
[node-platform]: https://nodejs.org/api/process.html#process_process_platform
[window-all-closed]: ../api/app.md#event-window-all-closed
[app-quit]: ../api/app.md#appquit
#### Open a window if none are open (macOS)
Whereas Linux and Windows apps quit when they have no windows open, macOS apps generally
continue running even without any windows open, and activating the app when no windows
are available should open a new one.
To implement this feature, listen for the `app` module's [`activate`][activate]
event, and call your existing `createWindow()` method if no browser windows are open.
Because windows cannot be created before the `ready` event, you should only listen for
`activate` events after your app is initialized. Do this by attaching your event listener
from within your existing `whenReady()` callback.
[activate]: ../api/app.md#event-activate-macos
```js @ts-type={createWindow:()=>void}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
```
> Note: At this point, your window controls should be fully functional!
### Access Node.js from the renderer with a preload script
Now, the last thing to do is print out the version numbers for Electron and its
dependencies onto your web page.
Accessing this information is trivial to do in the main process through Node's
global `process` object. However, you can't just edit the DOM from the main
process because it has no access to the renderer's `document` context.
They're in entirely different processes!
> Note: If you need a more in-depth look at Electron processes, see the
> [Process Model][] document.
This is where attaching a **preload** script to your renderer comes in handy.
A preload script runs before the renderer process is loaded, and has access to both
renderer globals (e.g. `window` and `document`) and a Node.js environment.
Create a new script named `preload.js` as such:
```js
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector)
if (element) element.innerText = text
}
for (const dependency of ['chrome', 'node', 'electron']) {
replaceText(`${dependency}-version`, process.versions[dependency])
}
})
```
The above code accesses the Node.js `process.versions` object and runs a basic `replaceText`
helper function to insert the version numbers into the HTML document.
To attach this script to your renderer process, pass in the path to your preload script
to the `webPreferences.preload` option in your existing `BrowserWindow` constructor.
```js
const { app, BrowserWindow } = require('electron')
// include the Node.js 'path' module at the top of your file
const path = require('node:path')
// modify your existing createWindow() function
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
win.loadFile('index.html')
}
// ...
```
There are two Node.js concepts that are used here:
* The [`__dirname`][dirname] string points to the path of the currently executing script
(in this case, your project's root folder).
* The [`path.join`][path-join] API joins multiple path segments together, creating a
combined path string that works across all platforms.
We use a path relative to the currently executing JavaScript file so that your relative
path will work in both development and packaged mode.
[Process Model]: ./process-model.md
[dirname]: https://nodejs.org/api/modules.html#modules_dirname
[path-join]: https://nodejs.org/api/path.html#path_path_join_paths
### Bonus: Add functionality to your web contents
At this point, you might be wondering how to add more functionality to your application.
For any interactions with your web contents, you want to add scripts to your
renderer process. Because the renderer runs in a normal web environment, you can add a
`<script>` tag right before your `index.html` file's closing `</body>` tag to include
any arbitrary scripts you want:
```html
<script src="./renderer.js"></script>
```
The code contained in `renderer.js` can then use the same JavaScript APIs and tooling
you use for typical front-end development, such as using [`webpack`][webpack] to bundle
and minify your code or [React][react] to manage your user interfaces.
[webpack]: https://webpack.js.org
[react]: https://reactjs.org
### Recap
After following the above steps, you should have a fully functional
Electron application that looks like this:
![Simplest Electron app](../images/simplest-electron-app.png)
<!--TODO(erickzhao): Remove the individual code blocks for static website -->
The full code is available below:
```js
// main.js
// Modules to control application life and create native browser window
const { app, BrowserWindow } = require('electron')
const path = require('node:path')
const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
```
```js
// preload.js
// All the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector)
if (element) element.innerText = text
}
for (const dependency of ['chrome', 'node', 'electron']) {
replaceText(`${dependency}-version`, process.versions[dependency])
}
})
```
```html
<!--index.html-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using Node.js <span id="node-version"></span>,
Chromium <span id="chrome-version"></span>,
and Electron <span id="electron-version"></span>.
<!-- You can also require other files to run in this process -->
<script src="./renderer.js"></script>
</body>
</html>
```
```fiddle docs/fiddles/quick-start
```
To summarize all the steps we've done:
* We bootstrapped a Node.js application and added Electron as a dependency.
* We created a `main.js` script that runs our main process, which controls our app
and runs in a Node.js environment. In this script, we used Electron's `app` and
`BrowserWindow` modules to create a browser window that displays web content
in a separate process (the renderer).
* In order to access certain Node.js functionality in the renderer, we attached
a preload script to our `BrowserWindow` constructor.
## Package and distribute your application
The fastest way to distribute your newly created app is using
[Electron Forge](https://www.electronforge.io).
:::info
To build an RPM package for Linux, you will need to [install its required system dependencies](https://www.electronforge.io/config/makers/rpm).
:::
1. Add a description to your `package.json` file, otherwise rpmbuild will fail. Blank description are not valid.
2. Add Electron Forge as a development dependency of your app, and use its `import` command to set up
Forge's scaffolding:
```sh npm2yarn
npm install --save-dev @electron-forge/cli
npx electron-forge import
✔ Checking your system
✔ Initializing Git Repository
✔ Writing modified package.json file
✔ Installing dependencies
✔ Writing modified package.json file
✔ Fixing .gitignore
We have ATTEMPTED to convert your app to be in a format that electron-forge understands.
Thanks for using "electron-forge"!!!
```
3. Create a distributable using Forge's `make` command:
```sh npm2yarn
npm run make
> my-electron-app@1.0.0 make /my-electron-app
> electron-forge make
✔ Checking your system
✔ Resolving Forge Config
We need to package your application before we can make it
✔ Preparing to Package Application for arch: x64
✔ Preparing native dependencies
✔ Packaging Application
Making for the following targets: zip
✔ Making for target: zip - On platform: darwin - For arch: x64
```
Electron Forge creates the `out` folder where your package will be located:
```plain
// Example for macOS
out/
├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip
├── ...
└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app
```

View File

@@ -116,6 +116,7 @@ You should at least follow these steps to improve the security of your applicati
17. [Validate the `sender` of all IPC messages](#17-validate-the-sender-of-all-ipc-messages)
18. [Avoid usage of the `file://` protocol and prefer usage of custom protocols](#18-avoid-usage-of-the-file-protocol-and-prefer-usage-of-custom-protocols)
19. [Check which fuses you can change](#19-check-which-fuses-you-can-change)
20. [Do not expose Electron APIs to untrusted web content](#20-do-not-expose-electron-apis-to-untrusted-web-content)
To automate the detection of misconfigurations and insecure patterns, it is
possible to use
@@ -229,7 +230,7 @@ API to remotely loaded content via the [contextBridge API](../api/context-bridge
### 3. Enable Context Isolation
:::info
This recommendation is the default behavior in Electron since 12.0.0.
Context Isolation is the default behavior in Electron since 12.0.0.
:::
Context isolation is an Electron feature that allows developers to run code
@@ -804,6 +805,48 @@ flipping these fuses easy. Check out the README of that module for more details
potential error cases, and refer to
[How do I flip the fuses?](./fuses.md#how-do-i-flip-the-fuses) in our documentation.
### 20. Do not expose Electron APIs to untrusted web content
You should not directly expose Electron's APIs, especially IPC, to untrusted web content in your
preload scripts.
### Why?
Exposing raw APIs like `ipcRenderer.on` is dangerous because it gives renderer processes direct
access to the entire IPC event system, allowing them to listen for any IPC events, not just the ones
intended for them.
To avoid that exposure, we also cannot pass callbacks directly through: The first
argument to IPC event callbacks is an `IpcRendererEvent` object, which includes properties like `sender`
that provide access to the underlying `ipcRenderer` instance. Even if you only listen for specific
events, passing the callback directly means the renderer gets access to this event object.
In short, we want the untrusted web content to only have access to necessary information and APIs.
### How?
```js title='preload'.js'
// Bad
contextBridge.exposeInMainWorld('electronAPI', {
on: ipcRenderer.on
})
// Also bad
contextBridge.exposeInMainWorld('electronAPI', {
onUpdateCounter: (callback) => ipcRenderer.on('update-counter', callback)
})
// Good
contextBridge.exposeInMainWorld('electronAPI', {
onUpdateCounter: (callback) => ipcRenderer.on('update-counter', (_event, value) => callback(value))
})
```
:::info
For more information on what `contextIsolation` is and how to use it to secure your app,
please see the [Context Isolation](context-isolation.md) document.
:::
[breaking-changes]: ../breaking-changes.md
[browser-window]: ../api/browser-window.md
[webview-tag]: ../api/webview-tag.md

View File

@@ -252,7 +252,7 @@ apps often use the preload script to set up inter-process communication (IPC) in
to pass arbitrary messages between the two kinds of processes.
In the next part of the tutorial, we will be showing you resources on adding more
functionality to your app, then teaching you distributing your app to users.
functionality to your app, then teaching you how to distribute your app to users.
<!-- Links -->

View File

@@ -1,3 +1,5 @@
import DocCardList from '@theme/DocCardList';
# Window Customization
The [`BrowserWindow`][] module is the foundation of your Electron application, and
@@ -5,13 +7,15 @@ it exposes many APIs that let you customize the look and behavior of your app
This section covers how to implement various use cases for window customization on macOS,
Windows, and Linux.
:::info
`BrowserWindow` is a subclass of the [`BaseWindow`][] module. Both modules allow
you to create and manage application windows in Electron, with the main difference
being that `BrowserWindow` supports a single, full size web view while `BaseWindow`
supports composing many web views. `BaseWindow` can be used interchangeably with `BrowserWindow`
in the examples of the documents in this section.
:::
> [!NOTE]
> `BrowserWindow` is a subclass of the [`BaseWindow`][] module. Both modules allow
> you to create and manage application windows in Electron, with the main difference
> being that `BrowserWindow` supports a single, full size web view while `BaseWindow`
> supports composing many web views. `BaseWindow` can be used interchangeably with `BrowserWindow`
> in the examples of the documents in this section.
<!-- markdownlint-disable-next-line MD033 -->
<DocCardList />
[`BaseWindow`]: ../api/base-window.md
[`BrowserWindow`]: ../api/browser-window.md

View File

@@ -8,7 +8,7 @@ If your app doesn't use any native modules, then it's really easy to create an A
1. Make sure that your app's `node_modules` directory is empty.
2. Using a _Command Prompt_, run `set npm_config_arch=arm64` before running `npm install`/`yarn install` as usual.
3. [If you have Electron installed as a development dependency](quick-start.md#prerequisites), npm will download and unpack the arm64 version. You can then package and distribute your app as normal.
3. [If you have Electron installed as a development dependency](tutorial-2-first-app.md#initializing-your-npm-project), npm will download and unpack the arm64 version. You can then package and distribute your app as normal.
## General considerations

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