Commit graph

29222 commits

Author SHA1 Message Date
Calvin
f15fa56e38
refactor: reduce & remove no-op MicrotasksScope calls (#46681)
* fix: do not run microtasks in V8Serializer in browser process

* Remove no-op MicrotasksScope in `shell/browser/api/electron_api_auto_updater.cc`

This call was added in https://github.com/electron/electron/pull/40576 as an expansion of `gin_helper::EmitEvent`.

Since this only runs in the browser process and `bool ignore_browser_checkpoint = true` this code is a no-op.

Node should perform a microtask checkpoint if necessary in `node::MakeCallback`.

* Remove no-op MicrotasksScope in `shell/common/api/electron_bindings.cc`

This method is only called by the browser process. The containing function, `ElectronBindings::DidReceiveMemoryDump`, is only used in two places:

* `ElectronBindings::GetProcessMemoryInfo` in the same file, which has a `CHECK` that it's running in the browser process at the top.
* From `shell/browser/api/electron_api_web_contents.cc`, which is only run in the browser process.

Added a DCHECK for clarity and validation.

* Replace `gin_helper::MicrotasksScope` with `v8::MicrotasksScope` in `shell/renderer/`

The browser check is unnecessary in the renderer. Since `gin_helper::MicrotasksScope` will always act exactly like `v8::MicrotasksScope`, it's clear to just use the v8 object directly. This also brings them in line with the many other uses of `v8::MicrotasksScope` in `shell/renderer/`.
2025-04-19 12:18:03 -05:00
Charles Kerr
297c4297b1
perf: avoid triple map lookup in ElectronHidDelegate::GetContextObserver() (#46672)
perf: avoid triple map lookup in ElectronHidDelegate::GetContextObserver()
2025-04-19 10:51:52 -05:00
Calvin
3a982ecad5
fix: do not run microtasks in V8Serializer in browser process (#46668) 2025-04-19 11:43:02 +09:00
Charles Kerr
926a6ee8bd
refactor: remove WebContentsPermissionHelper::PermissionTypes::KEYBOARD_LOCK (#46670)
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.
2025-04-18 16:14:45 -05:00
Shelley Vohr
437542767a
fix: backgroundMaterial on initial activate (#46657)
* fix: backgroundMaterial on initial activate

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

* Update patches/chromium/fix_activate_background_material_on_windows.patch

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

---------

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-17 20:34:45 +02:00
Shelley Vohr
a29e1170b9
feat: support Web Serial & WebUSB blocklists (#46600) 2025-04-17 20:34:34 +02:00
Shelley Vohr
352a403efd
fix: postMessage crash with invalid transferrable (#46639) 2025-04-17 15:09:48 +02:00
John Kleinschmidt
e8117f8e40
build: update build tools (#46656)
* build: update build tools

* chore: fix core.fscache

* chore: fix core.preloadindex

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-17 10:32:17 +02:00
Shelley Vohr
32fea719b3
refactor: migrate to non-deprecated allowedContentTypes on macOS (#46623)
refactor: migrated to non-deprecated allowedContentTypes on macOS
2025-04-15 09:51:34 -05:00
Shelley Vohr
14df4aab83
fix: window border on Gnome Wayland (#46624) 2025-04-15 15:45:33 +02:00
dependabot[bot]
24e46849c7
build(deps): bump actions/setup-node from 4.3.0 to 4.4.0 (#46636)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.3.0 to 4.4.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](cdca7365b2...49933ea528)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: 4.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-15 15:44:04 +02:00
Shelley Vohr
489d30edfb
build: roll build-images (#46625) 2025-04-14 16:10:46 -04:00
Shelley Vohr
e748b521b2
test: fix node spec disabled tests (#46627) 2025-04-14 11:38:27 -04:00
Shelley Vohr
51bffb533e
fix: paint and flash issues on macOS (#46615)
* fix: paint and flash issues on macOS

* Adhere to paintWhenInitiallyHidden
2025-04-14 16:29:07 +02:00
Shelley Vohr
62b5b5f99d
fix: handle potential missing close event property (#46605)
fix: handle missing close event property
2025-04-11 13:07:26 -04:00
Keeley Hammond
a9b2ec514b
fix: fallback to old MacOS context menu behavior if no frame is present (#46595)
* fix: fallback to old MacOS context menu behavior if no frame is present

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

* docs: add additional option for focusedFrame

* fix: handle frame found, but no view update from rfh

* fix: fix conditional

Co-authored-by: Calvin <clavin@users.noreply.github.com>

---------

Co-authored-by: georgexu99 <georgexu99@electronjs.org>
Co-authored-by: erickzhao <erickzhao@electronjs.org>
Co-authored-by: clavin <calvin@electronjs.org>
Co-authored-by: Calvin <clavin@users.noreply.github.com>
2025-04-11 10:15:35 -04:00
Shelley Vohr
3064b24c9d
refactor: use default printing path when no user options (#46587) 2025-04-11 10:14:29 -04:00
David Sanders
74d641c7b3
build: ignore files in .git when running markdownlint-cli2 (#46608) 2025-04-10 18:37:07 -05:00
Shelley Vohr
446d0769ed
feat: expose nativeTheme.shouldUseDarkColorsForSystemIntegratedUI (#46438)
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.
2025-04-10 12:08:29 +02:00
Jemil Suleimanov
013133867b
docs: unify documentation example and fiddle for IPC pattern-1 (#46517)
* docs: unify documentation examples and fiddle

* docs: remove changes in ipc documentation
2025-04-10 12:08:10 +02:00
Yuri
de407e82b7
docs: updated tray doc with tooltip removing (#46515)
added tooltip removing doc
2025-04-09 11:50:08 -04:00
Charles Kerr
c6e6a03a24
fix: NativeWindow.window_id() returns same value for all windows (#46562)
fix: NativeWindow.window_id() returns same value for all windows
2025-04-09 10:45:06 -05:00
Shelley Vohr
c1c74b0a6c
fix: re-enable OOP printing on Linux (#46529) 2025-04-09 15:42:16 +02:00
Shelley Vohr
45a0494287
fix: remove obsoleted --inspect-brk logic (#46560)
fix: remove obsoleted --inspect-brk logic
2025-04-09 15:35:40 +02:00
Shelley Vohr
521108e2a5
fix: crash on parent window close and focur/blur (#46559) 2025-04-09 15:35:30 +02:00
dependabot[bot]
93a51cc756
build(deps): bump github/codeql-action from 3.28.13 to 3.28.15 (#46554)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.13 to 3.28.15.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](1b549b9259...45775bd823)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.28.15
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-09 10:36:38 +02:00
Charles Kerr
ab23758e51
refactor: use v8::True(isolate) and v8::False(isolate) (#46544) 2025-04-08 12:58:39 -05:00
Charles Kerr
9069542d0b
refactor: remove unnecessary const_cast (#46543)
refactor: remove unnecessary const_cast

unnecessary since July 2019 in 50b9c70
2025-04-08 12:58:28 -05:00
Charles Kerr
636cbc19ac
refactor: simplify some BaseWindow JS getters (#46542)
* refactor: return a std::array<int 2> from BaseWindow::GetMaximumSize()

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

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

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

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

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

* refactor: #include correctness
2025-04-08 10:58:12 -05:00
Shelley Vohr
1a6de10da8
fix: assert.ok in the renderer process (#46528)
fix: assert.ok in the renderer process
2025-04-08 07:09:54 -05:00
Charles Kerr
b1731407bc
refactor: make TrackableObjectBase::weak_map_id_ const (#46524)
refactor: make TrackableObjectBase::weak_map_id_ const

simplify declaration and initialization
2025-04-07 20:49:05 -05:00
Charles Kerr
4bb7a4ceb0
refactor: make api::View methods const, private (#46545)
* refactor: make api::View::GetBounds() const

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

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

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

* refactor: make ChildPair private
2025-04-07 16:23:36 -05:00
Shelley Vohr
e22b83abf2
build: update codespaces config (#46533) 2025-04-07 16:29:33 -04:00
Niklas Wenzel
bbc9d1cdc1
build: emphasize the need for a testcase in our issue template (#46447) 2025-04-07 10:50:59 -07:00
Charles Kerr
85dce12be3
refactor: migrate to View::AddChildView(std::unique_ptr<ui::View*>) (#46474)
* refactor: use AddChildView(std::unique_ptr<View>) in OpaqueFrameView::CreateButton()

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

* refactor: use AddChildView(std::unique_ptr<View>) in MenuBar::RebuildChildren()

* refactor: use AddChildView(std::unique_ptr<View>) for ClientFrameViewLinux labels

* refactor: use AddChildView(std::unique_ptr<View>) for ClientFrameViewLinux buttons

* refactor: use AddChildView(std::unique_ptr<View>) in AutofillPopupView

* refactor: use AddChildViewRaw() to flag the edge cases that we still need to fix

* chore: use west coast const for consistency
2025-04-07 09:20:46 -05:00
Charles Kerr
a6875c732c
docs: note that titleBarOverlay.symbolColor is supported on Linux (#46492)
docs: note that titleBarOverlay.symbolColor is supported on Linux

this is supported via OpaqueFrameView
2025-04-07 11:10:54 +02:00
Charles Kerr
c0fdf09f28
perf: on Windows, make Archive::HeaderIntegrity() faster (#46509)
* perf: do not clone the map each time we call Archive::HeaderIntegrity()

* perf: use absl::flat_hash_map for the integrity cache

* perf: do not clone the JSON payload string

* perf: preallocate capacity for the integrity cache

* perf: use move variant of insert_or_assign()

* refactor: simplify integrity cache building

remove unnecessary std::optional<>

* refactor: use base::FindOrNull()

* refactor: remove unused #includes

* refactor: make variable types explicit

* fix: make res_size unsigned

* refactor: put GetIntegrityConfigCache() in an unnamed namespace

refator: put LoadIntegrityConfig() in an unnamed namespace

* fix: oops, missing rel_path_utf8 key

* fix: oops, fix Wunreachable-code-return
2025-04-07 11:10:29 +02:00
Charles Kerr
41d8f90d68
refactor: use base::flat_set in WebContents::DidUpdateFaviconUrl() (#46475)
* refactor: add gin::Converter<std::span>::ToV8()

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

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

* refactor: add gin::Converter<std::array>::ToV8()
2025-04-07 10:16:02 +02:00
Charles Kerr
3c5c9c8e19
perf: avoid redundant virtual method call in NativeWindowViews::SetEnabledInternal() (#46508)
perf: avoid redundant virtual method call in NativeWindowViews::SetEnabledInternal()

Why waste time make lot call when few call do trick?
2025-04-06 19:02:04 -07:00
Hailey
ac18decc56
revert: allow NSMenuItems to be disabled (#46502)
Revert "fix: allow NSMenuItems to be disabled (#46307)"

This reverts commit ac616ef41d.
2025-04-06 20:42:05 -05:00
Charles Kerr
052da50aeb
refactor: remove unused electron::api::App::FileIconCallback (#46490)
refactor: remove electron::api::App::FileIconCallback

last use removed in 2018 by 3f15f516
2025-04-05 00:39:17 -05:00
Charles Kerr
4e33d1690d
refactor: instantiate navigation_entries local variable on the stack (#46453)
* refactor: instantiate navigation_entries on the stack instead of the heap

* refactor: reserve the full size of navigation_entries

* refactor: use emplace_back to simplify the code a little
2025-04-04 16:55:27 -05:00
Shelley Vohr
c2ae4afb8f
fix: destroy parent port backend when JS env exits (#46437)
* fix: destroy parent port backend when JS env exits

* fix: close parent port before destroying

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-04-04 11:02:54 -05:00
Felix Rieseberg
e81e3acd2d
docs: Add C++/Win32 tutorial (#46160)
* docs: Add C++/Win32 tutorial

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

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

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

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

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

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

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

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

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

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

* docs: make linter happy

---------

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-04-04 08:00:45 -05:00
electron-roller[bot]
9c019b6147
chore: bump chromium to 136.0.7095.0 (main) (#46118)
* chore: bump chromium in DEPS to 136.0.7076.0

* chore: bump chromium in DEPS to 136.0.7077.0

* 6368856: Migrate absl variant.h and utility.h in content (part 2/2) | 6368856

* 6356528: Clean up LegacyRenderWidgetHostHWND code | 6356528

* chore: export patches

* 6339113: [Viewport Segments] Add CDP commands to override Viewport Segments without overriding other device properties. | 6339113

* 6352169: [DevTools][MultiInstance] Support new tab in another window on Android | 6352169

* 6368856: Migrate absl variant.h and utility.h in content (part 2/2) | 6368856

* 6360858:Clickiness: Wire response from URLLoader to DB, add e2e tests| 6360858

* chore: bump chromium in DEPS to 136.0.7079.0

* chore: export patches

* chore: bump chromium in DEPS to 136.0.7081.0

* chore: export patches

* chore: bump chromium in DEPS to 136.0.7083.0

* 6361987: Remove double-declaration with gfx::NativeView and gfx::NativeWindow | 6361987

* chore: export patches

* chore: bump chromium in DEPS to 136.0.7087.0

* chore: export patches

* fix: include node patch for missing AtomicsWaitEvent
6385540

* build: add depot_tools python to path

* fix: cppgc init and unregistering v8 isolate

6333562

CppGc is now initialized earlier so Node can skip reinitializing it.

Additionally, gin::IsolateHandle was attempting to destruct an already destructed
v8::Isolate upon electron::JavaScriptEnvironment destruction. By removing the call
to NodePlatform::UnregisterIsolate, this fixes the crash on app shutdown.

* fix: unregister isolate after destruction

See code comment.

* chore: bump chromium in DEPS to 136.0.7095.0

* chore: sync patches

* fix: add script_parsing::ContentScriptType parameter
6298395

* fix: migrate content::BrowserAccessibilityState methods
6401437
6383275

* feat: enableHappyEyeballs option for host resolver
6332599

* fix: add new cookie exclusion reason
6343479

* fix: add new url loader method
6337340

* fix: add new cppgc header file for electron_node headers
6348644

* fix: disable CREL on Linux ARM64
https://chromium-review.googlesource.com/q/I3a62f02f564f07be63173b0773b4ecaffbe939b9

* fixup! fix: add new cppgc header file for electron_node headers 6348644

* chore: update corner smoothing patch

* fixup! chore: update corner smoothing patch

* chore: disable NAN weak tests

These two tests are incompatible with a V8 change that disallows running JS code from a weak finalizer callback.

Ref: 4733273

* test: fix task starvation in node test

A V8 change makes these contexts get collected in a task that is posted
and run asynchronously. The tests were synchronously GC'ing in an
infinite loop, preventing the task loop from running the task that would
GC these contexts.

This change should be upstreamed in some way.

Ref: 4733273

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: alice <alice@makenotion.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: clavin <clavin@electronjs.org>
2025-04-03 19:02:49 -05:00
Charles Kerr
0a5da83a1b
perf: avoid redundant map lookup in HidChooserContext::DeviceChanged() (#46451)
perf: avoid redundant map lookup in HidChooserContext::DeviceChanged()
2025-04-03 17:51:37 -05:00
Fedor Indutny
7601af5200
fix: don't copy 'package.json's out of ASAR file (#46390)
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`.
2025-04-03 13:39:53 -07:00
yangllu
e46b0c8ddc
fix: gin_helper::Promise in GPUInfoManager must be destroyed before destroying Node/V8 (#46434)
* fix: gin_helper::Promise in GPUInfoManager must be destroyed before destroying Node/V8

* fix: use CleanedUpAtExit to control the lifetime of GPUInfoManager
2025-04-03 10:12:12 -07:00
Samuel Attard
0e3246e20d
fix: ensure maximize is emitted when reduce motion is enabled on macOS (#46459)
* fix: ensure maximize is emitted when reduce motion is enabled on macOS

* Revert "build: reenable graphics effects for macOS tests (#46454)"

This reverts commit 682ea345ac.
2025-04-03 11:14:16 -05:00
Charles Kerr
0ff98810ba
fix: NativeWindowViews::GetRestoredState() can return wrong state when maximized (#46450)
fix: NativeWindowViews::GetRestoredState() returning wrong state

Introduced by the af58931 Chromium 131.0.6744.0 roll, specifically
9840662 (diff-f9d7ef7)

98406626
2025-04-03 08:55:04 -05:00