Compare commits

..

164 Commits

Author SHA1 Message Date
David Sanders
eb9967b08c chore: break build to test problem matcher 2025-04-09 12:15:21 -07: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) | https://chromium-review.googlesource.com/c/chromium/src/+/6368856

* 6356528: Clean up LegacyRenderWidgetHostHWND code | https://chromium-review.googlesource.com/c/chromium/src/+/6356528

* chore: export patches

* 6339113: [Viewport Segments] Add CDP commands to override Viewport Segments without overriding other device properties. | https://chromium-review.googlesource.com/c/chromium/src/+/6339113

* 6352169: [DevTools][MultiInstance] Support new tab in another window on Android | https://chromium-review.googlesource.com/c/chromium/src/+/6352169

* 6368856: Migrate absl variant.h and utility.h in content (part 2/2) | https://chromium-review.googlesource.com/c/chromium/src/+/6368856

* 6360858:Clickiness: Wire response from URLLoader to DB, add e2e tests| https://chromium-review.googlesource.com/c/chromium/src/+/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 | https://chromium-review.googlesource.com/c/chromium/src/+/6361987

* chore: export patches

* chore: bump chromium in DEPS to 136.0.7087.0

* chore: export patches

* fix: include node patch for missing AtomicsWaitEvent
https://chromium-review.googlesource.com/c/chromium/src/+/6385540

* build: add depot_tools python to path

* fix: cppgc init and unregistering v8 isolate

https://chromium-review.googlesource.com/c/v8/v8/+/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
https://chromium-review.googlesource.com/c/chromium/src/+/6298395

* fix: migrate content::BrowserAccessibilityState methods
https://chromium-review.googlesource.com/c/chromium/src/+/6401437
https://chromium-review.googlesource.com/c/chromium/src/+/6383275

* feat: enableHappyEyeballs option for host resolver
https://chromium-review.googlesource.com/c/chromium/src/+/6332599

* fix: add new cookie exclusion reason
https://chromium-review.googlesource.com/c/chromium/src/+/6343479

* fix: add new url loader method
https://chromium-review.googlesource.com/c/chromium/src/+/6337340

* fix: add new cppgc header file for electron_node headers
https://chromium-review.googlesource.com/c/v8/v8/+/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 https://chromium-review.googlesource.com/c/v8/v8/+/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: https://chromium-review.googlesource.com/c/v8/v8/+/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: https://chromium-review.googlesource.com/c/v8/v8/+/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
https://github.com/electron/electron/pull/43948/commits/9840662#diff-f9d7ef7

98406626
2025-04-03 08:55:04 -05:00
Shelley Vohr
f48680a983 fix: zlib pointer alignment (#46435)
fix: fix zlib pointer alignment
2025-04-03 09:35:38 -04:00
Niklas Wenzel
682ea345ac build: reenable graphics effects for macOS tests (#46454) 2025-04-02 21:33:12 -05:00
Charles Kerr
a21c805ece perf: avoid redundant call to virtual methods GetProcess() and GetID() (#46409) 2025-04-02 11:57:09 -05:00
Charles Kerr
6f24dbaab4 perf: prefer absl::flat_hash_set over std::set when sorted order is not needed (#46410)
* perf: use an absl::flat_hash_set for UsbChooserContext::ephemeral_devices_

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

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

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

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

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

* perf: use an absl::flat_hash_set for NativeWindow::background_throttling_sources_
2025-04-02 11:03:36 -05:00
Charles Kerr
36e233797c perf: cache the return value of IsX11() (#46391)
* perf: cache the return value of IsX11()

* fix: mark as nodiscard for those who call, but mark as maybe_unused for Windows
2025-04-01 15:28:01 -05:00
Shelley Vohr
c02e5bc72c build: make it clearer when cookie auth runs (#46406) 2025-04-01 10:44:51 -07:00
Charles Kerr
5499c800a7 perf: avoid redundant map lookup in UsbChooserContext::OnDeviceRemoved() (#46387) 2025-04-01 12:39:34 -05:00
Charles Kerr
0492f0f745 perf: have ErrorThrower lazily lookup the current isolate (#46388)
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.
2025-04-01 12:25:27 -05:00
Charles Kerr
ac1ffb1bff fix: leaked gfx::Canvas in AutofillPopupView::OnPaint() (#46384)
* perf: avoid redundant call to popup_bounds_in_view()

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

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

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

* refactor: remove unnecessary draw_canvas variable

* refactor: rename bitmap to offscreen_bitmap for symmetry

* refactor: avoid another redundant call to popup_bounds_in_view()
2025-04-01 11:22:26 -05:00
Charles Kerr
5a6f1ede6a feat!: remove support for ProtocolResponse.session null value (#46264)
BREAKING CHANGE

This was deprecated in f7ba0d3b & is now being removed for Electron 37.
2025-04-01 08:52:12 -05:00
zoy
0e687d3082 fix: rounded corners disappear momentarily on window close (#46382)
fix: Explicitly set rounded corners in borderless mode on Windows 11

Signed-off-by: zoy <zoy-l@outlook.com>
2025-04-01 15:43:54 +02:00
Calvin
08da2b0b07 chore: move build files to build/ dir (#46368) 2025-04-01 13:42:14 +02:00
Shelley Vohr
9c4720766d fix: UtilityProcess.fork crash before app ready (#46380)
fix: UtilityProcess.fork crash before app ready
2025-04-01 13:42:03 +02:00
Shelley Vohr
5da75c4a97 feat: support system-context-menu on Linux (#45848)
feat: support system-context-menu on Linux
2025-04-01 11:00:39 +02:00
Charles Kerr
77833eddfb perf: avoid unnecessary vector copy in GetMimeTypeToExtensionIdMap() (#46373)
* 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.

* 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.

* perf: avoid redundant map lookup

* refactor: const correctness

* refactor: cleanup
2025-03-31 21:52:49 -05:00
Calvin
1730062c8f fix: flicker and ghosting in transparent windows on macOS (#46353)
* fix: transparent flicker on MAS

* Gate condition on `IsTranslucent` instead
2025-03-31 18:12:35 -05:00
Calvin
09135443a0 feat: Corner Smoothing CSS rule (Reland) (#46278)
* feat: Corner Smoothing CSS rule (Reland)

Reland of #45185

* Fix patch conflicts

* fixup! Fix patch conflicts

* Update expected image

The dashed border is subtly different. The new version is correct and the old one was incorrect.
2025-03-31 11:22:23 -05:00
Charles Kerr
fcd836e34f refactor: remove field unused weak_factory_ (#46363)
refactor: remove unused weak_factory_

Appears to have been added in e3f61b46 but never used
2025-03-31 10:39:21 +02:00
Charles Kerr
28fd7c5a17 perf: improve temporaries in WebWorkerObserver::WorkerScriptReadyForEvaluation() (#46347)
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
2025-03-30 23:21:39 -05:00
Charles Kerr
ae6930030a perf: prefer absl::flat_hash_set over std::unordered_set (#46348)
* perf: use absl::flat_hash_set in SpellCheckClient::SpellCheckText()

* perf: use absl::flat_hash_set in MessagePort::DisentanglePorts()
2025-03-30 23:21:18 -05:00
Charles Kerr
2fa4fb0da9 refactor: use v8::String::Empty() when creating empty strings (#46349)
refactor: use v8::String::Empty() when creating empty strings
2025-03-30 21:14:18 -05:00
Charles Kerr
bf93427cbb perf: avoid double map lookup in HidChooserContext::DeviceRemoved() (#46343) 2025-03-28 21:34:24 -05:00
Charles Kerr
72fc65d2c5 perf: avoid 3x call to GetID() in RegisterPendingSiteInstance() (#46339)
perf: avoid 3x call to GetID() in RegisterPendingSiteInstance()
2025-03-28 21:33:45 -05:00
Charles Kerr
2baa4a3514 perf: avoid a double-map lookup in NotificationPresenter::RemoveNotification() (#46338)
perf: avoid a double-map lokup in NotificationPresenter::RemoveNotification()
2025-03-28 21:33:11 -05:00
Samuel Attard
49aba471dc feat: add support for associating a Menu with a WebFrameMain (#45138)
* feat: add support for associating a Menu with a WebFrameMain

This allows certain OS level features to activate such as Writing Tools, Autofill.. and Services.

There appears to be a bug in macOS where the responder chain isn't traversed if the menu is not popped up using an event, as such we spoof a fake mouse event at the write coordinates in the right window and use that to open the menu.

* build: fix build on non-mac

* build: oops missed a header

* fix: safely handle optional T* by checking nullptr too

* build: fix gn check and build errors

* docs: suggested changes

* feat: default `frame` to `window.webContents.mainFrame` when possible

* fix: avoid deref nullptr view

* Revert "feat: default `frame` to `window.webContents.mainFrame` when possible"

This reverts commit 2e88836819.

* fix: lint

* Remove redundant scoped objects

This code, including the comments, matches almost exactly the behavior of this argument to the function.

* Add ScopedPumpMessagesInPrivateModes patch

* More null pointer safety

---------

Co-authored-by: clavin <clavin@electronjs.org>
2025-03-28 11:50:07 -07:00
Charles Kerr
46b108e9a4 perf: avoid redundant map lookups in GetStorageMask() (#46315)
* perf: avoid a redundant map lookuop in GetStorageMask()

* perf: avoid a redundant map lookup in GetDataTypeMask()
2025-03-28 00:25:25 -05:00
Hailey
ac616ef41d fix: allow NSMenuItems to be disabled (#46307)
* fix: disable NSMenu autoenable feature to allow disabling of NSMenuItems

* style: fix linter issues and update comments

* chore: remove unneeded comment
2025-03-27 17:43:46 -07:00
Charles Kerr
e09712f0e1 perf: avoid a triple-redundant map lookup in ViewsDelegate::GetAppbarAutohideEdges() (#46306)
perf: avoid a triple-redundant map lookup in ViewsDelegate::GetAppbarAutohideEdges()
2025-03-27 14:32:27 -05:00
Charles Kerr
35c90fd807 perf: avoid double map lookup in WebFrameMain::UpdateRenderFrameHost() (#46293)
perf: avoid double map lookup in WebFrameMain::UpdateRenderFrameHost()
2025-03-27 14:32:01 -05:00
Shelley Vohr
756423e81e build: validate Chromium cookie authentication (#46274) 2025-03-27 14:29:01 -05:00
Shelley Vohr
dc61a6ab80 fix: possible crash in shell.readShortcutLink (#46294)
fix: possible crash in shell.readShortcutLink
2025-03-27 14:27:32 -05:00
Shelley Vohr
a0c859fc4f build: roll build-images SHAs (#46291) 2025-03-27 10:39:02 +01:00
Shelley Vohr
17e38230d5 fix: crash when drag-dropping some files (#46253)
* fix: crash when drag-dropping some files

* fix: extra destination context scope
2025-03-26 17:17:23 -05:00
Charles Kerr
3ae285b614 perf: avoid std::map temporaries in WebContents::DevToolsRequestFileSystems() (#46268)
* perf: move the GetDevToolsWebContents() call outside of the loop

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

* refactor: remove unused GetAddedFileSystemPaths()

* perf: remove std::vector temporary in WebContents::DevToolsRequestFileSystems()
2025-03-26 16:26:56 -05:00
Shelley Vohr
3212f60d69 fix: set userAgent on navigationHistory.restore() (#46260)
fix: set userAgent on navigationHistory restore
2025-03-26 10:59:19 -05:00
Charles Kerr
a5076a663b perf: avoid redundant map lookup in WebContents::DevToolsIndexPath() (#46254)
perf: avoid double map lookup in WebContents::DevToolsIndexPath()
2025-03-26 10:30:02 -05:00
Shelley Vohr
d2c2261c58 fix: hard crash on invalid command line switches (#46004)
* fix: hard crash on invalid command line switch

* Update docs/api/command-line.md

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

* chore: feedback from review

* docs: Add breaking change note

---------

Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-03-26 08:14:03 -05:00
Charles Kerr
8412d78310 perf: avoid redundant map lookup in AddComponentResourceEntries() (#46255)
* perf: avoid double map lookup in ElectronComponentExtensionResourceManager::AddComponentResourceEntries()

* perf: move the path key when calling try_emplace()
2025-03-26 08:12:16 -05:00
Charles Kerr
48a38c0289 fix: build failure when printing is disabled (#46283)
fix: ftbfs when printing is disabled
2025-03-26 10:04:39 +01:00
Charles Kerr
6e44662f15 perf: avoid redundant map lookup in WebFrameMain constructor (#46238)
perf: avoid double map lookup in WebFrameMain constructor
2025-03-25 16:53:24 -05:00
Charles Kerr
c8d3184a95 refactor: migrate hashing code to new upstream crypto::hash API (#46237)
* refactor: migrate AsarFileValidator to crypto::hash

This change migrates AsarFileValidator's uses of crypto::secure_hash
to the new crypto::hash API, which has more memory safety and less
heap allocations.

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

* refactor: migrate ValidateIntegrityOrDie to crypto::hash

This change migrates ValidateIntegrityOrDie's use of crypto::SHA256Hash
to the new crypto::hash API, which has more memory safety and less heap
allocations.

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/6287609
2025-03-25 15:01:17 -05:00
dependabot[bot]
bb0ddcad27 build(deps): bump actions/setup-node from 4.2.0 to 4.3.0 (#46092)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](1d0ff469b7...cdca7365b2)

---
updated-dependencies:
- dependency-name: actions/setup-node
  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-03-25 13:29:22 -05:00
John Kleinschmidt
4eda76de36 build: fixup windows source cache for release (#46236)
* build: fixup windows source cache for release

* build: fixup ffmpeg gn gen

* build: add build-tools depot_tools to PATH

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

* put back regular gn gen for ffmpeg

* 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.`
2025-03-25 14:24:58 -04:00
Charles Kerr
ced8fdbce8 perf: avoid std::map temporaries in IsDevToolsFileSystemAdded() (#46230)
* refactor: extract-method GetAddedFileSystems()

* refactor: use GetAddedFileSystems() in GetAddedFileSystemPaths()

* refactor: use GetAddedFileSystems() in IsDevToolsFileSystemAdded()
2025-03-25 11:42:58 -05:00
Charles Kerr
f7ba0d3b4b docs: deprecate setting ProtocolResponse.session to null (#46131)
* docs: deprecate setting ProtocolResponse.session to null

* docs: mark null ProtocolResponse.session as deprecated in struct docs

* Update docs/breaking-changes.md

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

---------

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2025-03-25 10:04:21 -05:00
Charles Kerr
4f4e23a3b3 perf: avoid redundant map lookups in GlobalShortcut (#46229)
* perf: avoid redundant map lookup in GlobalShortcut::OnKeyPressed()

* perf: avoid redundant map lookup in GlobalShortcut::ExecuteCommand()
2025-03-25 09:46:03 -05:00
Shelley Vohr
1d6cb348b4 fix: webContents.printToPDF() with cross-process subframes (#46218)
fix: webContents.printToPDF() with cross-process subframes
2025-03-25 08:16:47 -05:00
dependabot[bot]
8e856dfdb8 build(deps): bump github/codeql-action from 3.28.11 to 3.28.13 (#46240)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.11 to 3.28.13.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](6bb031afdd...1b549b9259)

---
updated-dependencies:
- dependency-name: github/codeql-action
  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-03-25 12:21:23 +01:00
John Beutner
cf82c3215f perf: don't wait for thumbnails if they were not requested on macOS (#46138)
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.
2025-03-25 12:20:38 +01:00
Robo
307d4f94c7 fix: oob string read when parsing node_options (#46210)
* fix: oob string read when parsing node_options

* chore: re-enable test

* fix: missing linux server env for tests
2025-03-25 19:33:10 +09:00
dependabot[bot]
cfada0347e build(deps): bump actions/download-artifact from 4.1.9 to 4.2.1 (#46239) 2025-03-25 08:47:33 +01:00
dependabot[bot]
7cb921369b build(deps): bump actions/upload-artifact from 4.6.1 to 4.6.2 (#46241) 2025-03-25 08:46:18 +01:00
Robo
a86e44b176 fix: NODE_OPTIONS parsing for child processes on macOS (#46209)
* fix: NODE_OPTIONS parsing for child processes on macOS

* chore: temporarily disable test

* chore: apply review feedback

* chore: fix build
2025-03-25 13:01:37 +09:00
Calvin
abaef13c0b fix: Revert "feat: Corner Smoothing CSS rule" (#46231)
Revert "feat: Corner Smoothing CSS rule (#45185)"

This reverts commit b75e802280.
2025-03-24 20:36:49 +01:00
John Beutner
cfd64b5f89 fix: handle OnDelegatedSourceListDismissed asynchronously (#46112)
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.
2025-03-24 20:09:11 +01:00
John Kleinschmidt
cbcd779610 build: fixup release builds (#46228) 2025-03-24 14:34:57 -04:00
Calvin
b75e802280 feat: Corner Smoothing CSS rule (#45185)
* feat: Corner Smoothing

* Patch Blink to add CSS rule and Painting

* Add `system-ui` keyword

* Add `cornerSmoothingCSS` web preference

* Add tests

* Documentation

* fixup! Documentation

* fix: initialize smoothness value

* Use a 1.0 scale factor in tests

* Fix tests for CI

* Fix tests

* fixup! Merge branch 'main' into clavin/corner-smoothing

* Add code docs

* Document `system-ui` keyword values

* Address review comments

* fixup! Address review comments

* Address review comments

* Update patch to address upstream changes

The patch went from 694 lines to 505 lines, which is a 27.2% smaller!

* fixup! Update patch to address upstream changes
2025-03-24 11:46:12 -04:00
Shelley Vohr
9ec14b91e7 feat: add BrowserWindow.isSnapped() (#46079)
* feat: add BrowserWindow.isSnapped() on Windows

* docs: mark _Readonly_
2025-03-24 12:09:14 +01:00
Shelley Vohr
47cf4e7bfd fix: Wayland resizing border (#46155)
* 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.

* fix: border insets when fullscreen
2025-03-24 12:08:24 +01:00
Charles Kerr
b8150f33db refactor: remove unused weak_factory_ in electron_management_api_delegate.cc (#46200)
refactor: remove unused weak_factory_

Appears to have been added in 3745b76da but never used
2025-03-24 12:07:49 +01:00
Charles Kerr
02a4bd5942 refactor: remove unused method ProxyingWebSocket::web_request_api() (#46201)
Appears to have been added in c608d6d7 but never used
2025-03-24 10:09:24 +01:00
Charles Kerr
7ed4f0ca27 perf: use absl::flat_hash_map instead of std::unordered_map (#46202)
* perf: make ElectronUsbDelegate::controller_map_ an absl::flat_hash_map

* perf: make ElectronSerialDelegate::controller_map_ an absl::flat_hash_map

* perf: make ElectronHidDelegate::controller_map_ an absl::flat_hash_map

* perf: make FrameTreeNodeIdMap an absl::flat_hash_map

* perf: make AutofillDriverFactory::driver_map_ an absl::flat_hash_map

* perf: make asar::Archive::external_files_ an absl::flat_hash_map

* perf: make VersionIdMap an absl::flat_hash_map

* perf: make ObjectCache::proxy_map_ an absl::flat_hash_map

* docs: add TODO to investigate absl map in KeyWeakMap
2025-03-24 10:09:14 +01:00
Shelley Vohr
964090d086 fix: ensure TraverseParent bails on resource path exit (#46100)
* fix: ensure TraverseParent bails on resource path exit

* Address review changes
2025-03-24 10:06:59 +01:00
Erik Moura
e9082ea57a docs: fix capitalization for InputEvent.modifiers (#46130) 2025-03-23 16:38:15 -05:00
Charles Kerr
5623c96dd7 refactor: remove unused field ServiceWorkerMain::weak_factory_ (#46171)
refactor: remove unused field ServiceWorkerMain::weak_factory_

Added in a467d06, appears to have never been used
2025-03-23 10:14:45 +01:00
Charles Kerr
3fd35abe98 refactor: remove unused method ElectronBrowserContext::GetWeakPtr() (#46170)
* refactor: use forward declaration of MediaDeviceIDSalt in electron_browser_context.h

* refactor: remove unused #include from browser_context.h

* refactor: remove unused ElectronBrowserContext::GetWeakPtr()

last use removed in Aug 2020 by bac2f46
2025-03-22 10:15:15 -05:00
Charles Kerr
a81e11d9de refactor: use = default to define trivial destructors (#46165)
refactor: use '= default' to define trivial destructors
2025-03-21 16:15:34 -05:00
John Kleinschmidt
db47267be4 build: Use windows src cache (#45881)
build: use source cache on windows
2025-03-21 14:45:08 -04:00
Charles Kerr
6723bfbe32 refactor: reduce coupling in electron::api::Protocol (#46122)
* refactor: decouple api::Protocol from ElectronBrowserContext

now they do not know about each other

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

* refactor: remove unused isolate arg in Protocol constructor

* refactor: use =default for trivial destructor
2025-03-21 07:33:25 -05:00
Shelley Vohr
603057b198 fix: remove File.path from types (#46005) 2025-03-21 08:40:49 +01:00
Shelley Vohr
9ccc63d682 fix: add missing cpp_heap to Node.js worker CreateParams (#46104) 2025-03-21 08:40:28 +01:00
LZL
4d7161f36e feat: add ffmpeg.dll to delay load configuration (#46151)
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).
2025-03-21 16:24:34 +09:00
Shelley Vohr
32141eacfb refactor: use upstream Widget::IsVisibleOnAllWorkspaces() (#45887)
* refactor: use upstream Widget::IsVisibleOnAllWorkspaces()

* chore: add to breaking changes
2025-03-20 23:43:47 -05:00
Charles Kerr
1b5db9989e refactor: make URLPipeLoader private (#46113)
Move the URLPipeLoader class into an anonymous namespace in
electron_url_loader_factory.cc.
2025-03-20 15:47:47 -05:00
Charles Kerr
46967ca9c9 refactor: Add ElectronBrowserContext::BrowserContexts() (#46089)
* 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-20 11:17:26 -05:00
Charles Kerr
273baf4ec2 refactor: use base::NumberToString() (#46141)
base::NumberToString() is slightly more efficient than
absl::StrFormat("%u").
2025-03-20 10:13:28 +01:00
Charles Kerr
c4800d9934 refactor: remove ToV8(isolate, const char*) (#46108) 2025-03-20 10:04:50 +01:00
Shelley Vohr
86cc9f626f fix: APNS token ids are lowercase ASCII (#46101) 2025-03-20 07:57:50 +01:00
Shelley Vohr
09a3bcf0f0 fix: webContents.print() crash on Linux (#46087) 2025-03-20 06:41:00 +01:00
Shelley Vohr
bf64967b68 build: combine pipewire patches (#46129) 2025-03-19 23:26:06 -05:00
Niklas Wenzel
bf1d377e08 docs: use optional chaining for app.dock (#46119)
docs: use optional chaining for app.dock
2025-03-19 18:34:03 -05:00
Shelley Vohr
d424c3aee7 test: disable parallel/test-worker-resource-limits (#46105)
test: disable parallel/test-worker-resource-limits
2025-03-19 22:03:26 +01:00
Niklas Wenzel
e4d660af86 docs: fix code example in breaking-changes.md (#46093) 2025-03-19 11:20:22 +01:00
Shelley Vohr
2efd75e2ca build: fail for out of date patches on forks (#46080) 2025-03-19 10:05:51 +01:00
electron-roller[bot]
b13f05e2dc chore: bump chromium to 136.0.7067.0 (main) (#46018)
* chore: bump chromium in DEPS to 136.0.7066.0

* chore: bump chromium in DEPS to 136.0.7067.0

* 6325710: [LNA] Add Local Network Access permission type

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

* 6342514: Create frame mojo endpoints in renderer during window.open()

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

* 6344040: Create widget mojo endpoints in renderer process for window.open()

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

* chore: update patches

* 6349218: Move ExtensionService::install_directory() to ExtensionRegistrar

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

* 6349395: Move ExtensionService::extensions_enabled() to ExtensionRegistrar

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

* 6331510: Migrate views::Background class to ui::ColorVariant | https://chromium-review.googlesource.com/c/chromium/src/+/6331510

* build: reorder set-cookie step https://github.com/electron/electron/pull/46091

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
Co-authored-by: alice <alice@makenotion.com>
2025-03-18 19:20:54 -04:00
Shelley Vohr
dcbab692c0 test: fix app.dock for corrected type (#46110)
test: fix app.dock for corrected type
2025-03-18 17:44:39 -04:00
Niklas Wenzel
71f3ff6bf2 docs: fix types of app.dock (#46073) 2025-03-18 13:14:08 +01:00
Alice Zhao
ff0a14a7c6 build: move set chromium cookie before build tools step (#46091)
build: move set cookie before build tools
2025-03-18 10:07:05 +01:00
Charles Kerr
4bf99c9bea refactor: add ElectronBrowserContext::GetDefaultBrowserContext() (#46065)
* refactor: add ElectronBrowserContext::DestroyAllContexts()

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

* refactor: add ElectronBrowserContext::GetDefaultBrowserContext()

clearer semantics than everyone calling From("", false)
2025-03-17 08:43:23 -05:00
Charles Kerr
9513486bf3 refactor: use GetDefaultStoragePartition() instead of GetStoragePartition(nullptr) (#46064)
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
2025-03-17 08:39:55 -05:00
Charles Kerr
bea7d618f1 fix: warning in file picker UI (#46067) 2025-03-16 20:49:15 -05:00
Charles Kerr
4ad20ccb39 chore: e patches all (#46068) 2025-03-16 14:04:01 -05:00
Charles Kerr
73a017577e perf: avoid redundant map lookup in ElectronBrowserContext::From() (#46044)
perf: avoid redundant map lookup in ElectronBrowserContext::FromPath()
2025-03-15 09:51:20 -05:00
Shelley Vohr
2d8a547692 build: fix compound bash conditional in patchup (#46047) 2025-03-15 09:57:59 +01:00
Charles Kerr
5f0603ed28 fix: ElectronBrowserContext raw_ptr bug + remove dead code (#46030)
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_`.
2025-03-14 23:35:10 -05:00
Sam Maddock
afca4e271e feat: ServiceWorkerMain.scriptURL (#45863)
feat: serviceWorker.scriptURL
2025-03-14 21:00:13 -04:00
Charles Kerr
30d2fadb28 refactor: replace base::StringPrintf() calls with absl::StrFormat() (#46024)
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
2025-03-14 17:14:32 -05:00
Charles Kerr
3271b82094 refactor: remove unused system header includes (#46015)
* chore: remove unused #include <string>

* chore: remove unused #include <optional>

* chore: remove unused #include <vector>

* chore: remove unused #include <string_view>

* chore: remove unused #include <memory>

* chore: remove unused #include <utility>

* chore: remove unused #include <tuple>

* chore: remove unused #include <unordered_set>

* chore: remove unused #include <functional>

* chore: iwyu <set>

* chore: iwyu <map>
2025-03-14 10:59:15 -05:00
Shelley Vohr
c0e180758b fix: don't crash Utility Processes on unhandled rejections (#45921)
* fix: don't crash on unhandled rejections

* Update docs/breaking-changes.md

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

---------

Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-03-14 09:09:02 -05:00
Shelley Vohr
5817d27429 fix: take Snapped status into account when showing a window (#46006) 2025-03-14 09:07:27 -05:00
Michaela Laurencin
4812b4e6c2 fix: prevent title change for within page navigation (#45981)
* fix: prevent title change for on page navigation

* add back and forward testing

* update Chromium comment

* remove errant script tag
2025-03-14 12:10:23 +01:00
Shelley Vohr
7c0b7b417b fix: emit context-menu event in Windows draggable regions (#45851)
fix: emit context-menu event in Windows draggable regions
2025-03-14 10:29:29 +01:00
Charles Kerr
785fe5f3b6 refactor: make a variadic gin_helper::internal::InvokeFactory() (#45988)
refactor: make a variadic gin_helper::internal::InvokeFactory()
2025-03-13 17:24:49 -05:00
Shelley Vohr
502a6b0166 build: roll sysroots again (#46016) 2025-03-13 16:28:53 -05:00
Shelley Vohr
4a28e60e89 fix: package import existence verification (#45997) 2025-03-13 14:51:43 -05:00
Shelley Vohr
a90d50e13f fix: don't crash Web Workers on unhandled rejections (#45992) 2025-03-13 13:09:23 -05:00
electron-roller[bot]
962d8b325a chore: bump chromium to 136.0.7064.0 (main) (#45985)
* chore: bump chromium in DEPS to 136.0.7063.0

* chore: bump chromium in DEPS to 136.0.7064.0

* 6169919: Instantiate Linux (or CrOS) system fonts using Fontations

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

* 6341209: Remove file-wide unsafe buffer suppression from content/ [1 of N].

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

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-03-13 12:02:06 -05:00
Charles Kerr
c813bc2a92 refactor: use private inheritance from mojo::MessageReceiver (#45973)
* refactor: make UtilityProcessWrapper inherit privately from mojo::MessageReceiver

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

* refactor: make MessagePort inherit privately from mojo::MessageReceiver
2025-03-12 19:06:41 +01:00
Shelley Vohr
5ce41bac8d fix: system-context-menu should only fire in draggable regions (#45893)
fix: system-context-menu should only fire in draggable regions
2025-03-12 13:47:58 +01:00
David Sanders
6bc7bde229 ci: don't fail branch created workflow if previous board not found (#45986) 2025-03-12 09:27:40 +01:00
electron-roller[bot]
2de8fd7d93 chore: bump chromium to 136.0.7062.0 (main) (#45957)
* chore: bump chromium in DEPS to 136.0.7059.0

* chore: bump chromium in DEPS to 136.0.7060.0

* chore: bump chromium in DEPS to 136.0.7062.0

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-03-11 17:44:08 -04:00
Shelley Vohr
dcd319cfbe build: roll sysroots to pick up glibc fix (#45974) 2025-03-11 17:31:48 -04:00
Shelley Vohr
cd56b96544 refactor: remove usage of V8's {Attach|Detach}CppHeap() (#45922)
* refactor: remove usage of V8's {Attach|Detach}CppHeap()

* chore: remove revert patch
2025-03-11 18:54:33 +01:00
Charles Kerr
22262c14f1 test: fix timing issue in utilityProcess test fixtures (#45964)
* fix: potential timing issue in utilityProcess test

* fix: potential timing issue in utilityProcess esm test
2025-03-11 17:41:42 +01:00
dependabot[bot]
6e056709be build(deps): bump github/codeql-action from 3.28.10 to 3.28.11 (#45970)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.10 to 3.28.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b56ba49b26...6bb031afdd)

---
updated-dependencies:
- dependency-name: github/codeql-action
  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-03-11 10:44:00 -05:00
dependabot[bot]
2f63b20acf build(deps): bump dsanders11/project-actions from 1.5.2 to 1.7.0 (#45969)
Bumps [dsanders11/project-actions](https://github.com/dsanders11/project-actions) from 1.5.2 to 1.7.0.
- [Release notes](https://github.com/dsanders11/project-actions/releases)
- [Changelog](https://github.com/dsanders11/project-actions/blob/main/.releaserc.json)
- [Commits](7fc3c5441a...2134fe7cc7)

---
updated-dependencies:
- dependency-name: dsanders11/project-actions
  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-03-11 10:43:46 -05:00
Felix Rieseberg
eb126eecb0 docs: Add 'Native Code and Electron' (#45882)
* docs: Add 'Native Code and Electron'

* docs: Add node-gyp requirements

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

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

* Cross-platform clean command

* Mention napi-rs

* Apply suggestions from code review

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

* Fix lint, fix more comments

* Apply suggestions from code review

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

---------

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2025-03-10 13:45:33 -07:00
Shelley Vohr
4e1a915f1a build: remove patches merged upstream (#45963) 2025-03-10 20:00:28 +01:00
Charles Kerr
f2b09ff0bd fix: remove redundant MediaCaptureDevicesDispatcher::GetInstance() call (#45929)
fix: remove redundant MediaCaptureDevicesDispatcher::GetInstance() call

This appears to be a copy-paste error introduced in 465dee2c
2025-03-10 09:44:24 -05:00
electron-roller[bot]
b0c11371e0 chore: bump chromium to 136.0.7058.1 (main) (#45928)
* chore: bump chromium in DEPS to 136.0.7056.0

* chore: update mas_avoid_private_macos_api_usage.patch.patch

no manual changes; patch applied with fuzz

* chore: update fix_adapt_exclusive_access_for_electron_needs.patch

patch applied manually due to context shear

6319958: [FS] Replace GURL with url::Origin for Excluisve Access Bubble | https://chromium-review.googlesource.com/c/chromium/src/+/6319958

* chore: update feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch

no manual changes; patch applied with fuzz

6311876: Expose captured surface resolution for MacOS | https://chromium-review.googlesource.com/c/chromium/src/+/6311876

* chore: e patches all

* 6319958: [FS] Replace GURL with url::Origin for Excluisve Access Bubble | https://chromium-review.googlesource.com/c/chromium/src/+/6319958

* 6326673: views: Delete the single-parameter Widget::InitParams constructor. | https://chromium-review.googlesource.com/c/chromium/src/+/6326673

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

* 6331102: [A11yPerformance] Rename AXMode::kScreenReader to kExtendedProperties | https://chromium-review.googlesource.com/c/chromium/src/+/6331102

Sync with shell/browser/ui/webui/accessibility_ui.cc to
upstream chrome/browser/accessibility/accessibility_ui.cc
changes in 4af8657

* chore: bump Chromium 136.0.7058.1 (#45933)

chore: bump chromium in DEPS to 136.0.7058.1

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-10 00:30:34 -05:00
Samuel Attard
9b2e7db469 chore: cherry-pick 9dacf5694dfd from chromium (#45936) 2025-03-09 16:26:06 -07:00
Samuel Attard
f04c06a0db chore: cherry-pick 521faebc8a7c from chromium (#45941) 2025-03-09 16:23:04 -07:00
Charles Kerr
8ac061ebe7 fix: race condition in utilityProcess tests (#45926) 2025-03-09 17:37:35 -05:00
Milan Burda
b30f31e1f6 refactor: eliminate duplicate code in spec/api-process-spec.ts (#45927) 2025-03-09 17:37:14 -05:00
Charles Kerr
288ef37b1d perf: prefer base::SplitStringPiece() over base::SplitString() (#45924)
* perf: use base::SplitStringPiece() in SetNodeOptions()

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

* refactor: StringToAccelerator() now takes a std::string_view
2025-03-09 17:36:13 -05:00
electron-roller[bot]
20414f66ca chore!: bump chromium to 136.0.7054.0 (main) (#45923)
* chore: bump chromium in DEPS to 136.0.7054.0

* chore: update allow_in-process_windows_to_have_different_web_prefs.patch

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

patch applied manually due to context shear

* chore: e patches all

* refactor!: Session.clearStorageData(syncable)

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

Remove syncable type from opts.quota in Session.clearStorageData(opts)
because it that category has been removed upstream.

BREAKING CHANGE: Removed ses.clearDataStorage({ quota: 'syncable' })

* docs: deprecate Session.clearDataStorage({ quota })

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-07 17:49:21 -06:00
electron-roller[bot]
458b14b8ed chore: bump chromium to 136.0.7053.1 (main) (#45906)
* chore: bump chromium in DEPS to 136.0.7052.0

* chore: update mas_avoid_private_macos_api_usage.patch.patch

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

patch applied manually due to context shear

* chore: update preconnect_manager.patch

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

patch applied manually due to context shear

* chore: e patches all

* chore: bump chromium to 136.0.7053.1

* chore: update fix_remove_profiles_from_spellcheck_service.patch

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

patch applied manually due to context shear

* chore: e patches all

* chore: revert removal of v8 API used by Node.js

* devtools: Remove DevToolsUIBindings::SendJsonRequest() | https://chromium-review.googlesource.com/c/chromium/src/+/6326236

* 6244461: Merge //content/common/user_agent.cc into //components/embedder_support:user_agent | https://chromium-review.googlesource.com/c/chromium/src/+/6244461

* 6313744: Migrate views::Background factory methods to ColorVariant | https://chromium-review.googlesource.com/c/chromium/src/+/6313744

* 6314545: Remove multiple argument support from base::ToString() | https://chromium-review.googlesource.com/c/chromium/src/+/6314545

* 6317362: [Extensions] Inline MessagingDelegate::CreateReceiverForTab() | https://chromium-review.googlesource.com/c/chromium/src/+/6317362

* 6308998: Add SettingAccess structured metrics event for DevTools | https://chromium-review.googlesource.com/c/chromium/src/+/6308998

* 6295214: Remove redundant state field in per-extension preferences | https://chromium-review.googlesource.com/c/chromium/src/+/6295214

NB: this change is copied from the upstream change to extensions/shell/browser/shell_extension_loader.cc

* fix: ui/ linter error

This is showing up in an eslint build step in Electron:

> /__w/electron/electron/src/out/Default/gen/ui/webui/resources/cr_elements/preprocessed/cr_menu_selector/cr_menu_selector.ts
>   77:23  error  This assertion is unnecessary since the receiver accepts the original type of the expression  @typescript-eslint/no-unnecessary-type-assertion
>
> ✖ 1 problem (1 error, 0 warnings)
>   1 error and 0 warnings potentially fixable with the `--fix` option.

However, removing the assertion causes a typescript build failure:

> gen/ui/webui/resources/cr_elements/preprocessed/cr_menu_selector/cr_menu_selector.ts:77:23 - error TS2345: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'.
>   Type 'null' is not assignable to type 'HTMLElement'.
>
> 77         items.indexOf(this.querySelector<HTMLElement>(':focus'));
>                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So I think the two different steps may be picking up typescript definitions.

This patch should be removed after the issue is tracked down
and fixed in a followup task.

* fix: -Wnonnull warning

Fixes this warning:

> 2025-03-07T01:05:01.8637705Z ../../third_party/electron_node/src/debug_utils.cc(257,12): error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
> 2025-03-07T01:05:01.8638267Z   257 |     return nullptr;
> 2025-03-07T01:05:01.8638481Z       |            ^~~~~~~
> 2025-03-07T01:05:01.8638700Z 1 error generated.

Not sure why this warning was never triggered before; `git blame`
indicates this code hasn't changed in ages:

> c40a8273ef2 (Michaël Zasso    2024-05-10 09:50:20 +0200 255) #endif  // DEBUG
> 8e2d33f1562 (Anna Henningsen  2018-06-07 16:54:29 +0200 256)     }
> 247b5130595 (Refael Ackermann 2018-10-22 15:07:00 -0400 257)     return nullptr;
> 247b5130595 (Refael Ackermann 2018-10-22 15:07:00 -0400 258)   }

Presumably this is failing in this Chromium roll due to a
clang version bump.

We should remove this patch after upstreaming it.

* docs: add upstream pr link for Node patch

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-07 11:35:59 -06:00
Robo
530ccfe350 fix: resolve font list in default prefernce values (#45905)
* fix: resolve font list in default prefernce values

* chore: fix unsafe buffer usage

* docs: add code comment
2025-03-07 18:22:03 +09:00
Robo
041ada1586 build: match upstream with unsafe buffer paths (#45853)
* build: match upstream with unsafe buffer paths

* Don't assume STL iterators are pointers

Refs https://issues.chromium.org/issues/328308661

* chore: spanify process_singleton_win.cc
2025-03-06 16:04:18 -05:00
yangllu
d987bee007 fix: javascript heap OOM is not raised (#45895)
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.
2025-03-06 17:34:19 +01:00
Erick Zhao
431a791a99 chore: emphasize documentation style guide (#45639)
docs: emphasize documentation style guide
2025-03-06 17:17:06 +01:00
dependabot[bot]
9441cf4627 build(deps): bump dsanders11/project-actions from 1.5.1 to 1.5.2 (#45901)
Bumps [dsanders11/project-actions](https://github.com/dsanders11/project-actions) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/dsanders11/project-actions/releases)
- [Changelog](https://github.com/dsanders11/project-actions/blob/main/.releaserc.json)
- [Commits](9c80cd31f5...7fc3c5441a)

---
updated-dependencies:
- dependency-name: dsanders11/project-actions
  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-03-06 16:38:31 +01:00
Charles Kerr
bb1c3dff21 chore: bump chromium to 135.0.7049.7 (main) (#45900)
chore: bump chromium in DEPS to 135.0.7049.7
2025-03-05 16:36:52 -05:00
458 changed files with 5721 additions and 13138 deletions

View File

@@ -1,4 +1,5 @@
{ {
"name": "Electron Core Development Environment",
"dockerComposeFile": "docker-compose.yml", "dockerComposeFile": "docker-compose.yml",
"service": "buildtools", "service": "buildtools",
"onCreateCommand": ".devcontainer/on-create-command.sh", "onCreateCommand": ".devcontainer/on-create-command.sh",
@@ -33,27 +34,15 @@
"surajbarkale.ninja", "surajbarkale.ninja",
"ms-vscode.cpptools", "ms-vscode.cpptools",
"mutantdino.resourcemonitor", "mutantdino.resourcemonitor",
"dsanders11.vscode-electron-build-tools",
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"shakram02.bash-beautify", "shakram02.bash-beautify",
"marshallofsound.gnls-electron", "marshallofsound.gnls-electron"
], ],
"settings": { "settings": {
"editor.tabSize": 2, "editor.tabSize": 2,
"bashBeautify.tabSize": 2, "bashBeautify.tabSize": 2,
"typescript.tsdk": "node_modules/typescript/lib", "typescript.tsdk": "node_modules/typescript/lib",
"[gn]": {
"editor.formatOnSave": true
},
"[javascript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"[typescript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"javascript.preferences.quoteStyle": "single", "javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single" "typescript.preferences.quoteStyle": "single"
} }

View File

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

View File

@@ -73,7 +73,7 @@ body:
- type: input - type: input
attributes: attributes:
label: Testcase Gist URL label: Testcase Gist URL
description: If you can reproduce the issue in a standalone test case, please use [Electron Fiddle](https://github.com/electron/fiddle) to create one and to publish it as a [GitHub gist](https://gist.github.com) and put the gist URL here. This is **the best way** to ensure this issue is triaged quickly. description: Electron maintainers need a standalone test case to reproduce and fix your issue. Please use [Electron Fiddle](https://github.com/electron/fiddle) to create one and to publish it as a [GitHub gist](https://gist.github.com). Then put the gist URL here. Issues without testcase gists receive less attention and might be closed without a maintainer taking a closer look. To maximize how much attention your issue receives, please include a testcase gist right from the start.
placeholder: https://gist.github.com/... placeholder: https://gist.github.com/...
- type: textarea - type: textarea
attributes: attributes:

View File

@@ -38,15 +38,6 @@ runs:
run: | run: |
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"x64\" v8_snapshot_toolchain=\"//build/toolchain/mac:clang_x64\"" 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 echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
- name: Set GN_EXTRA_ARGS for Windows
shell: bash
if: ${{inputs.target-arch != 'x64' && inputs.target-platform == 'win' }}
run: |
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"${{ inputs.target-arch }}\""
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 }} - name: Build Electron ${{ inputs.step-suffix }}
shell: bash shell: bash
run: | run: |
@@ -190,8 +181,8 @@ runs:
electron/script/zip-symbols.py -b $BUILD_PATH electron/script/zip-symbols.py -b $BUILD_PATH
fi fi
- name: Generate FFMpeg ${{ inputs.step-suffix }} - name: Generate FFMpeg ${{ inputs.step-suffix }}
if: ${{ inputs.is-release == 'true' }}
shell: bash shell: bash
if: ${{ inputs.is-release == 'true' }}
run: | run: |
cd src cd src
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS" gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS"
@@ -208,9 +199,6 @@ runs:
e build --target electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES 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:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:libcxx_objects_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 }} - name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
if: ${{ inputs.is-release == 'true' }} if: ${{ inputs.is-release == 'true' }}
shell: bash shell: bash

View File

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

View File

@@ -40,10 +40,10 @@ runs:
if: ${{ inputs.generate-sas-token == 'true' }} if: ${{ inputs.generate-sas-token == 'true' }}
shell: bash shell: bash
run: | run: |
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$CACHE_FILE?platform=${{ inputs.target-platform }}&getAccountName=true" > 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 - name: Save SAS Key
if: ${{ inputs.generate-sas-token == 'true' }} if: ${{ inputs.generate-sas-token == 'true' }}
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf
with: with:
path: sas-token path: sas-token
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }} key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
@@ -80,21 +80,6 @@ runs:
else else
echo "The cross mount cache has $freespace_human free space - continuing" echo "The cross mount cache has $freespace_human free space - continuing"
fi fi
- name: Add patch conflict problem matcher
shell: bash
run: echo "::add-matcher::src/electron/.github/problem-matchers/patch-conflict.json"
- name: Restore gitcache
if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash
run: |
GIT_CACHE_TAR="$CACHE_DRIVE/gitcache.tar"
if [ ! -f "$GIT_CACHE_TAR" ]; then
echo "Git cache tar file does not exist, skipping restore"
exit 0
fi
echo "Restoring git cache from $GIT_CACHE_TAR to $GIT_CACHE_PATH"
mkdir -p $GIT_CACHE_PATH
tar -xf $GIT_CACHE_TAR -C $GIT_CACHE_PATH
- name: Gclient Sync - name: Gclient Sync
if: steps.check-cache.outputs.cache_exists == 'false' if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash shell: bash
@@ -117,7 +102,12 @@ runs:
git update-index --refresh || true git update-index --refresh || true
if ! git diff-index --quiet HEAD --; then if ! git diff-index --quiet HEAD --; then
# There are changes to the patches. Make a git commit with the updated patches # There are changes to the patches. Make a git commit with the updated patches
if node ./script/patch-up.js; then git add patches
GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
# Export it
mkdir -p ../../patches
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
if node ./script/push-patch.js; then
echo echo
echo "======================================================================" echo "======================================================================"
echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch" echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
@@ -125,11 +115,6 @@ runs:
echo "======================================================================" echo "======================================================================"
exit 1 exit 1
else else
git add patches
GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
# Export it
mkdir -p ../../patches
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
echo echo
echo "======================================================================" echo "======================================================================"
echo "There were changes to the patches when applying." echo "There were changes to the patches when applying."
@@ -143,11 +128,7 @@ runs:
echo "No changes to patches detected" echo "No changes to patches detected"
fi fi
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 # delete all .git directories under src/ except for
# third_party/angle/ and third_party/dawn/ because of build time generation of files # 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 # gen/angle/commit.h depends on third_party/angle/.git/HEAD
@@ -198,11 +179,3 @@ runs:
else else
echo "Cache key persisted in $final_cache_path" echo "Cache key persisted in $final_cache_path"
fi fi
- name: Wait for active SSH sessions
shell: bash
if: always() && !cancelled()
run: |
while [ -f /var/.ssh-lock ]
do
sleep 60
done

View File

@@ -6,8 +6,6 @@ runs:
- name: Free Space on MacOS - name: Free Space on MacOS
shell: bash shell: bash
run: | run: |
echo "Disk usage before cleanup:"
df -h
sudo mkdir -p $TMPDIR/del-target sudo mkdir -p $TMPDIR/del-target
tmpify() { tmpify() {
@@ -64,5 +62,4 @@ runs:
# lipo off some huge binaries arm64 versions to save space # lipo off some huge binaries arm64 versions to save space
strip_universal_deep $(xcode-select -p)/../SharedFrameworks strip_universal_deep $(xcode-select -p)/../SharedFrameworks
# strip_arm_deep /System/Volumes/Data/Library/Developer/CommandLineTools/usr # strip_arm_deep /System/Volumes/Data/Library/Developer/CommandLineTools/usr
sudo mdutil -a -i off

View File

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

View File

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

View File

@@ -8,14 +8,14 @@ runs:
steps: steps:
- name: Obtain SAS Key - name: Obtain SAS Key
continue-on-error: true continue-on-error: true
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
with: with:
path: sas-token path: sas-token
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-1 key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-1
enableCrossOsArchive: true enableCrossOsArchive: true
- name: Obtain SAS Key - name: Obtain SAS Key
continue-on-error: true continue-on-error: true
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
with: with:
path: sas-token path: sas-token
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }} key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
@@ -32,23 +32,22 @@ runs:
shell: bash shell: bash
command: | command: |
sas_token=$(cat sas-token) sas_token=$(cat sas-token)
if [ -z "$sas_token" ]; then if [ -z $sas-token ]; then
echo "SAS Token not found; exiting src cache download early..." echo "SAS Token not found; exiting src cache download early..."
exit 1 exit 1
else else
sas_token=$(jq -r '.sasToken' sas-token)
account_name=$(jq -r '.accountName' sas-token)
if [ "${{ inputs.target-platform }}" = "win" ]; then if [ "${{ inputs.target-platform }}" = "win" ]; then
azcopy copy --log-level=ERROR \ azcopy copy --log-level=ERROR \
"https://$account_name.file.core.windows.net/${{ env.AZURE_AKS_WIN_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar "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 else
azcopy copy --log-level=ERROR \ azcopy copy --log-level=ERROR \
"https://$account_name.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar "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
fi fi
env: env:
AZURE_AKS_CACHE_SHARE_NAME: linux-cache AZURE_AKS_CACHE_STORAGE_ACCOUNT: f723719aa87a34622b5f7f3
AZURE_AKS_WIN_CACHE_SHARE_NAME: windows-cache 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 - name: Clean SAS Key
shell: bash shell: bash
run: rm -f sas-token run: rm -f sas-token
@@ -97,7 +96,7 @@ runs:
$TEMP_DIR=New-Item -ItemType Directory -Path temp-cache $TEMP_DIR=New-Item -ItemType Directory -Path temp-cache
$TEMP_DIR_PATH = $TEMP_DIR.FullName $TEMP_DIR_PATH = $TEMP_DIR.FullName
C:\ProgramData\Chocolatey\bin\7z.exe -y -snld x $src_cache -o"$TEMP_DIR_PATH" C:\ProgramData\Chocolatey\bin\7z.exe -y x $src_cache -o"$TEMP_DIR_PATH"
- name: Move Src Cache (Windows) - name: Move Src Cache (Windows)
if: ${{ inputs.target-platform == 'win' }} if: ${{ inputs.target-platform == 'win' }}

View File

@@ -1,20 +0,0 @@
name: Debug via SSH
description: Setup a SSH server with a tunnel to access it to debug via SSH.
inputs:
tunnel:
description: 'Enable SSH tunneling via cloudflared'
required: true
default: 'false'
timeout:
description: 'SSH session timeout in minutes'
required: false
type: number
default: 60
runs:
using: composite
steps:
- run: $GITHUB_ACTION_PATH/setup-ssh.sh
shell: bash
env:
TUNNEL: ${{ inputs.tunnel }}
TIMEOUT: ${{ inputs.timeout }}

View File

@@ -1,4 +0,0 @@
# If we're in an interactive SSH session and we're not already in tmux and there's no explicit SSH command, auto attach tmux
if [ -n "$SSH_TTY" ] && [ -z "$TMUX" ] && [ -z "$SSH_ORIGINAL_COMMAND" ]; then
exec tmux attach || exec tmux
fi

View File

@@ -1,140 +0,0 @@
#!/bin/bash -e
get_authorized_keys() {
if [ -z "$AUTHORIZED_USERS" ] || ! echo "$AUTHORIZED_USERS" | grep -q "\b$GITHUB_ACTOR\b"; then
return 1
fi
api_response=$(curl -s "https://api.github.com/users/$GITHUB_ACTOR/keys")
if echo "$api_response" | jq -e 'type == "object" and has("message")' >/dev/null; then
error_msg=$(echo "$api_response" | jq -r '.message')
echo "Error: $error_msg"
return 1
else
echo "$api_response" | jq -r '.[].key'
fi
}
authorized_keys=$(get_authorized_keys "$GITHUB_ACTOR")
if [ -n "$authorized_keys" ]; then
echo "Configured SSH key(s) for user: $GITHUB_ACTOR"
else
echo "Error: User '$GITHUB_ACTOR' is not authorized to access this debug session."
echo "Authorized users: $AUTHORIZED_USERS"
exit 1
fi
if [ "$TUNNEL" != "true" ]; then
echo "SSH tunneling is disabled. Set enable-tunnel: true to enable remote access."
echo "Local SSH server would be available on localhost:2222 if this were a local environment."
exit 0
fi
echo "SSH tunneling enabled. Setting up remote access..."
EXTERNAL_DEPS="curl jq ssh-keygen"
for dep in $EXTERNAL_DEPS; do
if ! command -v "$dep" > /dev/null 2>&1; then
echo "Command $dep not installed on the system!" >&2
exit 1
fi
done
cd "$GITHUB_ACTION_PATH"
bashrc_path=$(pwd)/bashrc
# Source `bashrc` to auto start tmux on SSH login.
if ! grep -q "$bashrc_path" ~/.bash_profile; then
echo >> ~/.bash_profile # On macOS runner there's no newline at the end of the file
echo "source \"$bashrc_path\"" >> ~/.bash_profile
fi
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ARCH="amd64"
elif [ "$ARCH" = "aarch64" ]; then
ARCH="arm64"
fi
# Install tmux on macOS runners if not present.
if [ "$OS" = "darwin" ] && ! command -v tmux > /dev/null 2>&1; then
echo "Installing tmux..."
brew install tmux
fi
if [ "$OS" = "darwin" ]; then
cloudflared_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-${OS}-${ARCH}.tgz"
echo "Downloading \`cloudflared\` from <$cloudflared_url>..."
curl --location --silent --output cloudflared.tgz "$cloudflared_url"
tar xf cloudflared.tgz
rm cloudflared.tgz
else
cloudflared_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-${OS}-${ARCH}"
echo "Downloading \`cloudflared\` from <$cloudflared_url>..."
curl --location --silent --output cloudflared "$cloudflared_url"
fi
chmod +x cloudflared
echo "Setting up SSH key for authorized user: $GITHUB_ACTOR"
echo "$authorized_keys" > authorized_keys
echo 'Creating SSH server key...'
ssh-keygen -q -f ssh_host_rsa_key -N ''
echo 'Creating SSH server config...'
sed "s,\$PWD,$PWD,;s,\$USER,$USER," sshd_config.template > sshd_config
echo 'Starting SSH server...'
/usr/sbin/sshd -f sshd_config -D &
sshd_pid=$!
echo 'Starting tmux session...'
(cd "$GITHUB_WORKSPACE" && tmux new-session -d -s debug)
#if no cloudflare tunnel token is provided, exit
if [ -z "$CLOUDFLARE_TUNNEL_TOKEN" ]; then
echo "Error: required CLOUDFLARE_TUNNEL_TOKEN not found"
exit 1
fi
echo 'Starting Cloudflare tunnel...'
./cloudflared tunnel --no-autoupdate run --token "$CLOUDFLARE_TUNNEL_TOKEN" 2>&1 | tee cloudflared.log | sed -u 's/^/cloudflared: /' &
cloudflared_pid=$!
url="$TUNNEL_HOSTNAME"
public_key=$(cut -d' ' -f1,2 < ssh_host_rsa_key.pub)
(
echo ' '
echo ' '
echo '🔗 SSH Debug Session Ready!'
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
echo ' '
echo '📋 Copy and run this command to connect:'
echo ' '
if [ -n "$TUNNEL_HOSTNAME" ]; then
echo "ssh-keygen -R action-ssh-debug && echo 'action-ssh-debug $public_key' >> ~/.ssh/known_hosts && ssh -o ProxyCommand='cloudflared access tcp --hostname $url' runner@action-ssh-debug"
else
echo "ssh-keygen -R action-ssh-debug && echo 'action-ssh-debug $public_key' >> ~/.ssh/known_hosts && ssh -o ProxyCommand='cloudflared access tcp --hostname $url' runner@action-ssh-debug"
fi
echo ' '
echo "⏰ Session expires automatically in $TIMEOUT minutes"
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
echo ' '
echo ' '
) | cat
echo 'Starting SSH session in background...'
./ssh-session.sh "$sshd_pid" "$cloudflared_pid" $TIMEOUT &
echo 'SSH session is running in background. GitHub Action will continue.'
echo 'Session will auto-cleanup after timeout or when processes end.'

View File

@@ -1,21 +0,0 @@
#!/bin/bash
SSHD_PID=$1
CLOUDFLARED_PID=$2
SESSION_TIMEOUT=${3:-3600}
# Wait for timeout or until processes die.
sleep "$SESSION_TIMEOUT" &
SLEEP_PID=$!
# Monitor if SSH or cloudflared dies early.
while kill -0 "$SSHD_PID" 2>/dev/null && kill -0 "$CLOUDFLARED_PID" 2>/dev/null && kill -0 "$SLEEP_PID" 2>/dev/null; do
sleep 10
done
# Cleanup.
kill "$SLEEP_PID" 2>/dev/null || true
kill "$SSHD_PID" 2>/dev/null || true
kill "$CLOUDFLARED_PID" 2>/dev/null || true
echo "SSH session ended"

View File

@@ -1,9 +0,0 @@
Port 2222
HostKey $PWD/ssh_host_rsa_key
PidFile $PWD/sshd.pid
# Only allow single user
AllowUsers $USER
# Only allow those keys
AuthorizedKeysFile $PWD/authorized_keys

View File

@@ -1,18 +0,0 @@
{
"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

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

View File

@@ -1,24 +0,0 @@
{
"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

@@ -13,9 +13,9 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup Node.js/npm - name: Setup Node.js/npm
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
with: with:
node-version: 20.19.x node-version: 20.11.x
- name: Setting Up Dig Site - name: Setting Up Dig Site
run: | run: |
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}" echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"
@@ -41,7 +41,7 @@ jobs:
sha-file: .dig-old sha-file: .dig-old
filename: electron.old.d.ts filename: electron.old.d.ts
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4.6.1 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with: with:
name: artifacts name: artifacts
path: electron/artifacts path: electron/artifacts

View File

@@ -94,7 +94,7 @@ jobs:
})) }))
- name: Create Release Project Board - name: Create Release Project Board
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: dsanders11/project-actions/copy-project@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/copy-project@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
id: create-release-board id: create-release-board
with: with:
drafts: true drafts: true
@@ -114,14 +114,15 @@ jobs:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
- name: Find Previous Release Project Board - name: Find Previous Release Project Board
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: dsanders11/project-actions/find-project@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/find-project@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
id: find-prev-release-board id: find-prev-release-board
with: with:
fail-if-project-not-found: false
title: ${{ steps.generate-project-metadata.outputs.prev-prev-major }}-x-y title: ${{ steps.generate-project-metadata.outputs.prev-prev-major }}-x-y
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
- name: Close Previous Release Project Board - name: Close Previous Release Project Board
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.find-prev-release-board.outputs.number }}
uses: dsanders11/project-actions/close-project@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/close-project@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
with: with:
project-number: ${{ steps.find-prev-release-board.outputs.number }} project-number: ${{ steps.find-prev-release-board.outputs.number }}
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}

View File

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

View File

@@ -6,7 +6,7 @@ on:
build-image-sha: build-image-sha:
type: string type: string
description: 'SHA for electron/build image' description: 'SHA for electron/build image'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373' default: '9f11982e806f439d0a0a8ebbbf566cd5e0d9e952'
required: true required: true
skip-macos: skip-macos:
type: boolean type: boolean
@@ -64,7 +64,7 @@ jobs:
id: set-output id: set-output
run: | run: |
if [ -z "${{ inputs.build-image-sha }}" ]; then if [ -z "${{ inputs.build-image-sha }}" ]; then
echo "build-image-sha=424eedbf277ad9749ffa9219068aa72ed4a5e373" >> "$GITHUB_OUTPUT" echo "build-image-sha=9f11982e806f439d0a0a8ebbbf566cd5e0d9e952" >> "$GITHUB_OUTPUT"
else else
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT" echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
fi fi
@@ -92,7 +92,7 @@ jobs:
checkout-macos: checkout-macos:
needs: setup needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-macos}} if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-macos}}
runs-on: electron-arc-centralus-linux-amd64-32core runs-on: electron-arc-linux-amd64-32core
container: container:
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }} image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
options: --user root options: --user root
@@ -120,7 +120,7 @@ jobs:
checkout-linux: checkout-linux:
needs: setup needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-linux}} if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-linux}}
runs-on: electron-arc-centralus-linux-amd64-32core runs-on: electron-arc-linux-amd64-32core
container: container:
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }} image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
options: --user root options: --user root
@@ -128,7 +128,7 @@ jobs:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache - /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas - /var/run/sas:/var/run/sas
env: env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }} CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }} PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
outputs: outputs:
@@ -146,7 +146,7 @@ jobs:
checkout-windows: checkout-windows:
needs: setup needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }} if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
runs-on: electron-arc-centralus-linux-amd64-32core runs-on: electron-arc-linux-amd64-32core
container: container:
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }} image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
options: --user root --device /dev/fuse --cap-add SYS_ADMIN options: --user root --device /dev/fuse --cap-add SYS_ADMIN
@@ -191,7 +191,7 @@ jobs:
with: with:
target-platform: linux target-platform: linux
target-archs: x64 arm arm64 target-archs: x64 arm arm64
check-runs-on: electron-arc-centralus-linux-amd64-8core check-runs-on: electron-arc-linux-amd64-8core
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
gn-build-type: testing gn-build-type: testing
secrets: inherit secrets: inherit
@@ -202,7 +202,7 @@ jobs:
with: with:
target-platform: win target-platform: win
target-archs: x64 x86 arm64 target-archs: x64 x86 arm64
check-runs-on: electron-arc-centralus-linux-amd64-8core 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/win-cache:/mnt/win-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 gn-build-type: testing
secrets: inherit secrets: inherit
@@ -252,8 +252,8 @@ jobs:
uses: ./.github/workflows/pipeline-electron-build-and-test-and-nan.yml uses: ./.github/workflows/pipeline-electron-build-and-test-and-nan.yml
needs: checkout-linux needs: checkout-linux
with: with:
build-runs-on: electron-arc-centralus-linux-amd64-32core build-runs-on: electron-arc-linux-amd64-32core
test-runs-on: electron-arc-centralus-linux-amd64-4core test-runs-on: electron-arc-linux-amd64-4core
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}' test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
target-platform: linux target-platform: linux
@@ -272,8 +272,8 @@ jobs:
uses: ./.github/workflows/pipeline-electron-build-and-test.yml uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-linux needs: checkout-linux
with: with:
build-runs-on: electron-arc-centralus-linux-amd64-32core build-runs-on: electron-arc-linux-amd64-32core
test-runs-on: electron-arc-centralus-linux-amd64-4core test-runs-on: electron-arc-linux-amd64-4core
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}' test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
target-platform: linux target-platform: linux
@@ -293,8 +293,8 @@ jobs:
uses: ./.github/workflows/pipeline-electron-build-and-test.yml uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-linux needs: checkout-linux
with: with:
build-runs-on: electron-arc-centralus-linux-amd64-32core build-runs-on: electron-arc-linux-amd64-32core
test-runs-on: electron-arc-centralus-linux-arm64-4core test-runs-on: electron-arc-linux-arm64-4core
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init","volumes":["/home/runner/externals:/mnt/runner-externals"]}' test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init","volumes":["/home/runner/externals:/mnt/runner-externals"]}'
target-platform: linux target-platform: linux
@@ -313,8 +313,8 @@ jobs:
uses: ./.github/workflows/pipeline-electron-build-and-test.yml uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-linux needs: checkout-linux
with: with:
build-runs-on: electron-arc-centralus-linux-amd64-32core build-runs-on: electron-arc-linux-amd64-32core
test-runs-on: electron-arc-centralus-linux-arm64-4core test-runs-on: electron-arc-linux-arm64-4core
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}' test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
target-platform: linux target-platform: linux
@@ -334,7 +334,7 @@ jobs:
needs: checkout-windows needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }} if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with: with:
build-runs-on: electron-arc-centralus-windows-amd64-16core build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: windows-latest test-runs-on: windows-latest
target-platform: win target-platform: win
target-arch: x64 target-arch: x64
@@ -353,7 +353,7 @@ jobs:
needs: checkout-windows needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }} if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with: with:
build-runs-on: electron-arc-centralus-windows-amd64-16core build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: windows-latest test-runs-on: windows-latest
target-platform: win target-platform: win
target-arch: x86 target-arch: x86
@@ -372,7 +372,7 @@ jobs:
needs: checkout-windows needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }} if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with: with:
build-runs-on: electron-arc-centralus-windows-amd64-16core build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: electron-hosted-windows-arm64-4core test-runs-on: electron-hosted-windows-arm64-4core
target-platform: win target-platform: win
target-arch: arm64 target-arch: arm64

View File

@@ -10,7 +10,7 @@ on:
jobs: jobs:
clean-src-cache: clean-src-cache:
runs-on: electron-arc-centralus-linux-amd64-32core runs-on: electron-arc-linux-amd64-32core
container: container:
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1 image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
options: --user root options: --user root

View File

@@ -20,7 +20,7 @@ jobs:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 90 project-number: 90
@@ -39,7 +39,7 @@ jobs:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 90 project-number: 90

View File

@@ -19,7 +19,7 @@ jobs:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- name: Add to Issue Triage - name: Add to Issue Triage
uses: dsanders11/project-actions/add-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/add-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
with: with:
field: Reporter field: Reporter
field-value: ${{ github.event.issue.user.login }} field-value: ${{ github.event.issue.user.login }}

View File

@@ -19,7 +19,7 @@ jobs:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- name: Remove from issue triage - name: Remove from issue triage
uses: dsanders11/project-actions/delete-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/delete-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 90 project-number: 90

View File

@@ -30,7 +30,7 @@ jobs:
org: electron org: electron
- name: Set status - name: Set status
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }} if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
uses: dsanders11/project-actions/edit-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 90 project-number: 90

View File

@@ -6,7 +6,7 @@ on:
build-image-sha: build-image-sha:
type: string type: string
description: 'SHA for electron/build image' description: 'SHA for electron/build image'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373' default: '9f11982e806f439d0a0a8ebbbf566cd5e0d9e952'
upload-to-storage: upload-to-storage:
description: 'Uploads to Azure storage' description: 'Uploads to Azure storage'
required: false required: false
@@ -19,7 +19,7 @@ on:
jobs: jobs:
checkout-linux: checkout-linux:
runs-on: electron-arc-centralus-linux-amd64-32core runs-on: electron-arc-linux-amd64-32core
container: container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }} image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
options: --user root options: --user root
@@ -43,7 +43,7 @@ jobs:
needs: checkout-linux needs: checkout-linux
with: with:
environment: production-release environment: production-release
build-runs-on: electron-arc-centralus-linux-amd64-32core build-runs-on: electron-arc-linux-amd64-32core
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
target-platform: linux target-platform: linux
target-arch: x64 target-arch: x64
@@ -59,7 +59,7 @@ jobs:
needs: checkout-linux needs: checkout-linux
with: with:
environment: production-release environment: production-release
build-runs-on: electron-arc-centralus-linux-amd64-32core build-runs-on: electron-arc-linux-amd64-32core
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
target-platform: linux target-platform: linux
target-arch: arm target-arch: arm
@@ -75,7 +75,7 @@ jobs:
needs: checkout-linux needs: checkout-linux
with: with:
environment: production-release environment: production-release
build-runs-on: electron-arc-centralus-linux-amd64-32core build-runs-on: electron-arc-linux-amd64-32core
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
target-platform: linux target-platform: linux
target-arch: arm64 target-arch: arm64

View File

@@ -6,7 +6,7 @@ on:
build-image-sha: build-image-sha:
type: string type: string
description: 'SHA for electron/build image' description: 'SHA for electron/build image'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373' default: '9f11982e806f439d0a0a8ebbbf566cd5e0d9e952'
required: true required: true
upload-to-storage: upload-to-storage:
description: 'Uploads to Azure storage' description: 'Uploads to Azure storage'
@@ -20,7 +20,7 @@ on:
jobs: jobs:
checkout-macos: checkout-macos:
runs-on: electron-arc-centralus-linux-amd64-32core runs-on: electron-arc-linux-amd64-32core
container: container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }} image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
options: --user root options: --user root

View File

@@ -15,7 +15,7 @@ concurrency:
jobs: jobs:
docs-only: docs-only:
name: Docs Only Compile name: Docs Only Compile
runs-on: electron-arc-centralus-linux-amd64-4core runs-on: electron-arc-linux-amd64-4core
timeout-minutes: 20 timeout-minutes: 20
container: ${{ fromJSON(inputs.container) }} container: ${{ fromJSON(inputs.container) }}
steps: steps:

View File

@@ -18,7 +18,7 @@ env:
jobs: jobs:
lint: lint:
name: Lint name: Lint
runs-on: electron-arc-centralus-linux-amd64-4core runs-on: electron-arc-linux-amd64-4core
timeout-minutes: 20 timeout-minutes: 20
container: ${{ fromJSON(inputs.container) }} container: ${{ fromJSON(inputs.container) }}
steps: steps:
@@ -61,9 +61,6 @@ jobs:
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]" gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
- name: Add ESLint problem matcher
shell: bash
run: echo "::add-matcher::src/electron/.github/problem-matchers/eslint-stylish.json"
- name: Run Lint - name: Run Lint
shell: bash shell: bash
run: | run: |

View File

@@ -73,7 +73,6 @@ env:
SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }} SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }}
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || inputs.target-platform == 'win' && '--custom-var=checkout_win=True' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }} GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || inputs.target-platform == 'win' && '--custom-var=checkout_win=True' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}
jobs: jobs:
build: build:
@@ -95,15 +94,6 @@ jobs:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Setup SSH Debugging
if: ${{ inputs.target-platform == 'macos' && env.ACTIONS_STEP_DEBUG == 'true' }}
uses: ./src/electron/.github/actions/ssh-debug
with:
tunnel: 'true'
env:
CLOUDFLARE_TUNNEL_TOKEN: ${{ secrets.CLOUDFLARE_TUNNEL_TOKEN }}
TUNNEL_HOSTNAME: ${{ secrets.CLOUDFLARED_SSH_HOSTNAME }}
AUTHORIZED_USERS: ${{ secrets.SSH_DEBUG_AUTHORIZED_USERS }}
- name: Free up space (macOS) - name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos uses: ./src/electron/.github/actions/free-space-macos
@@ -112,9 +102,9 @@ jobs:
run: df -h run: df -h
- name: Setup Node.js/npm - name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
with: with:
node-version: 20.19.x node-version: 20.11.x
cache: yarn cache: yarn
cache-dependency-path: src/electron/yarn.lock cache-dependency-path: src/electron/yarn.lock
- name: Install Dependencies - name: Install Dependencies

View File

@@ -40,7 +40,6 @@ env:
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }} CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }} ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}
jobs: jobs:
test: test:
@@ -80,9 +79,9 @@ jobs:
cp "C:\Python311\python.exe" "C:\Python311\python3.exe" cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
- name: Setup Node.js/npm - name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'win' }} if: ${{ inputs.target-platform == 'win' }}
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
with: with:
node-version: 20.19.x node-version: 20.11.x
- name: Add TCC permissions on macOS - name: Add TCC permissions on macOS
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
run: | run: |
@@ -101,11 +100,9 @@ jobs:
} }
userValuesArray=( userValuesArray=(
"'kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
"'kTCCServiceCamera','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159" "'kTCCServiceCamera','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
"'kTCCServiceBluetoothAlways','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159" "'kTCCServiceBluetoothAlways','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
"'kTCCServiceAppleEvents','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
"'kTCCServiceCamera','/opt/hca/hosted-compute-agent',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
"'kTCCServiceBluetoothAlways','/opt/hca/hosted-compute-agent',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
) )
for values in "${userValuesArray[@]}"; do for values in "${userValuesArray[@]}"; do
# Sonoma and higher have a few extra values # Sonoma and higher have a few extra values
@@ -127,15 +124,6 @@ jobs:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Setup SSH Debugging
if: ${{ inputs.target-platform == 'macos' && env.ACTIONS_STEP_DEBUG == 'true' }}
uses: ./src/electron/.github/actions/ssh-debug
with:
tunnel: 'true'
env:
CLOUDFLARE_TUNNEL_TOKEN: ${{ secrets.CLOUDFLARE_TUNNEL_TOKEN }}
TUNNEL_HOSTNAME: ${{ secrets.CLOUDFLARED_SSH_HOSTNAME }}
AUTHORIZED_USERS: ${{ secrets.SSH_DEBUG_AUTHORIZED_USERS }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies uses: ./src/electron/.github/actions/install-dependencies
- name: Set Chromium Git Cookie - name: Set Chromium Git Cookie
@@ -146,9 +134,6 @@ jobs:
git config --global core.filemode false git config --global core.filemode false
git config --global core.autocrlf false git config --global core.autocrlf false
git config --global branch.autosetuprebase always git config --global branch.autosetuprebase always
git config --global core.fscache true
git config --global core.longpaths true
git config --global core.preloadindex true
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
# Ensure depot_tools does not update. # Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools test -d depot_tools && cd depot_tools
@@ -162,12 +147,12 @@ jobs:
echo "DISABLE_CRASH_REPORTER_TESTS=true" >> $GITHUB_ENV echo "DISABLE_CRASH_REPORTER_TESTS=true" >> $GITHUB_ENV
echo "IS_ASAN=true" >> $GITHUB_ENV echo "IS_ASAN=true" >> $GITHUB_ENV
- name: Download Generated Artifacts - name: Download Generated Artifacts
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
with: with:
name: generated_artifacts_${{ env.ARTIFACT_KEY }} name: generated_artifacts_${{ env.ARTIFACT_KEY }}
path: ./generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }} path: ./generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
- name: Download Src Artifacts - name: Download Src Artifacts
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
with: with:
name: src_artifacts_${{ env.ARTIFACT_KEY }} name: src_artifacts_${{ env.ARTIFACT_KEY }}
path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }} path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
@@ -205,6 +190,7 @@ jobs:
MOCHA_REPORTER: mocha-multi-reporters MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
ELECTRON_DISABLE_SECURITY_WARNINGS: 1 ELECTRON_DISABLE_SECURITY_WARNINGS: 1
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
DISPLAY: ':99.0' DISPLAY: ':99.0'
NPM_CONFIG_MSVS_VERSION: '2022' NPM_CONFIG_MSVS_VERSION: '2022'
run: | run: |
@@ -261,7 +247,7 @@ jobs:
if: always() && !cancelled() if: always() && !cancelled()
- name: Upload Test Artifacts - name: Upload Test Artifacts
if: always() && !cancelled() if: always() && !cancelled()
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with: with:
name: test_artifacts_${{ env.ARTIFACT_KEY }}_${{ matrix.shard }} name: test_artifacts_${{ env.ARTIFACT_KEY }}_${{ matrix.shard }}
path: src/electron/spec/artifacts path: src/electron/spec/artifacts

View File

@@ -38,7 +38,7 @@ env:
jobs: jobs:
node-tests: node-tests:
name: Run Node.js Tests name: Run Node.js Tests
runs-on: electron-arc-centralus-linux-amd64-8core runs-on: electron-arc-linux-amd64-8core
timeout-minutes: 30 timeout-minutes: 30
env: env:
TARGET_ARCH: ${{ inputs.target-arch }} TARGET_ARCH: ${{ inputs.target-arch }}
@@ -61,12 +61,12 @@ jobs:
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies uses: ./src/electron/.github/actions/install-dependencies
- name: Download Generated Artifacts - name: Download Generated Artifacts
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
with: with:
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
- name: Download Src Artifacts - name: Download Src Artifacts
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
with: with:
name: src_artifacts_linux_${{ env.TARGET_ARCH }} name: src_artifacts_linux_${{ env.TARGET_ARCH }}
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }} path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
@@ -92,7 +92,7 @@ jobs:
done done
nan-tests: nan-tests:
name: Run Nan Tests name: Run Nan Tests
runs-on: electron-arc-centralus-linux-amd64-4core runs-on: electron-arc-linux-amd64-4core
timeout-minutes: 30 timeout-minutes: 30
env: env:
TARGET_ARCH: ${{ inputs.target-arch }} TARGET_ARCH: ${{ inputs.target-arch }}
@@ -115,12 +115,12 @@ jobs:
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies uses: ./src/electron/.github/actions/install-dependencies
- name: Download Generated Artifacts - name: Download Generated Artifacts
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
with: with:
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
- name: Download Src Artifacts - name: Download Src Artifacts
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
with: with:
name: src_artifacts_linux_${{ env.TARGET_ARCH }} name: src_artifacts_linux_${{ env.TARGET_ARCH }}
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }} path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}

View File

@@ -33,7 +33,7 @@ jobs:
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }} creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
org: electron org: electron
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 94 project-number: 94

View File

@@ -42,7 +42,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab. # format to the repository Actions tab.
- name: "Upload artifact" - name: "Upload artifact"
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with: with:
name: SARIF file name: SARIF file
path: results.sarif path: results.sarif
@@ -50,6 +50,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard. # Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View File

@@ -27,7 +27,7 @@ jobs:
PROJECT_NUMBER=$(gh project list --owner electron --format json | jq -r '.projects | map(select(.title | test("^[0-9]+-x-y$"))) | max_by(.number) | .number') PROJECT_NUMBER=$(gh project list --owner electron --format json | jq -r '.projects | map(select(.title | test("^[0-9]+-x-y$"))) | max_by(.number) | .number')
echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> "$GITHUB_OUTPUT" echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> "$GITHUB_OUTPUT"
- name: Update Completed Stable Prep Items - name: Update Completed Stable Prep Items
uses: dsanders11/project-actions/completed-by@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/completed-by@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
with: with:
field: Prep Status field: Prep Status
field-value: ✅ Complete field-value: ✅ Complete

View File

@@ -6,7 +6,7 @@ on:
build-image-sha: build-image-sha:
type: string type: string
description: 'SHA for electron/build image' description: 'SHA for electron/build image'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373' default: '9f11982e806f439d0a0a8ebbbf566cd5e0d9e952'
required: true required: true
upload-to-storage: upload-to-storage:
description: 'Uploads to Azure storage' description: 'Uploads to Azure storage'
@@ -20,7 +20,7 @@ on:
jobs: jobs:
checkout-windows: checkout-windows:
runs-on: electron-arc-centralus-linux-amd64-32core runs-on: electron-arc-linux-amd64-32core
container: container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }} image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
options: --user root --device /dev/fuse --cap-add SYS_ADMIN options: --user root --device /dev/fuse --cap-add SYS_ADMIN
@@ -51,7 +51,7 @@ jobs:
needs: checkout-windows needs: checkout-windows
with: with:
environment: production-release environment: production-release
build-runs-on: electron-arc-centralus-windows-amd64-16core build-runs-on: electron-arc-windows-amd64-16core
target-platform: win target-platform: win
target-arch: x64 target-arch: x64
is-release: true is-release: true
@@ -65,7 +65,7 @@ jobs:
needs: checkout-windows needs: checkout-windows
with: with:
environment: production-release environment: production-release
build-runs-on: electron-arc-centralus-windows-amd64-16core build-runs-on: electron-arc-windows-amd64-16core
target-platform: win target-platform: win
target-arch: arm64 target-arch: arm64
is-release: true is-release: true
@@ -79,7 +79,7 @@ jobs:
needs: checkout-windows needs: checkout-windows
with: with:
environment: production-release environment: production-release
build-runs-on: electron-arc-centralus-windows-amd64-16core build-runs-on: electron-arc-windows-amd64-16core
target-platform: win target-platform: win
target-arch: x86 target-arch: x86
is-release: true is-release: true

View File

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

View File

@@ -17,19 +17,19 @@ import("//tools/grit/repack.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni") import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//v8/gni/snapshot_toolchain.gni") import("//v8/gni/snapshot_toolchain.gni")
import("build/asar.gni") import("build/asar.gni")
import("build/electron_paks.gni")
import("build/extract_symbols.gni") import("build/extract_symbols.gni")
import("build/js2c_toolchain.gni")
import("build/npm.gni") import("build/npm.gni")
import("build/templated_file.gni") import("build/templated_file.gni")
import("build/tsc.gni") import("build/tsc.gni")
import("build/webpack/webpack.gni") import("build/webpack/webpack.gni")
import("buildflags/buildflags.gni") import("buildflags/buildflags.gni")
import("electron_paks.gni")
import("filenames.auto.gni") import("filenames.auto.gni")
import("filenames.gni") import("filenames.gni")
import("filenames.hunspell.gni") import("filenames.hunspell.gni")
import("filenames.libcxx.gni") import("filenames.libcxx.gni")
import("filenames.libcxxabi.gni") import("filenames.libcxxabi.gni")
import("js2c_toolchain.gni")
if (is_mac) { if (is_mac) {
import("//build/config/mac/rules.gni") import("//build/config/mac/rules.gni")
@@ -314,7 +314,7 @@ asar("default_app_asar") {
} }
grit("resources") { grit("resources") {
source = "electron_resources.grd" source = "build/electron_resources.grd"
outputs = [ outputs = [
"grit/electron_resources.h", "grit/electron_resources.h",
@@ -670,8 +670,6 @@ source_set("electron_lib") {
sources += [ sources += [
"shell/browser/certificate_manager_model.cc", "shell/browser/certificate_manager_model.cc",
"shell/browser/certificate_manager_model.h", "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.cc",
"shell/browser/ui/gtk_util.h", "shell/browser/ui/gtk_util.h",
] ]

6
DEPS
View File

@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
vars = { vars = {
'chromium_version': 'chromium_version':
'136.0.7103.177', '136.0.7095.0',
'node_version': 'node_version':
'v22.18.0', 'v22.14.0',
'nan_version': 'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213', 'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version': 'squirrel.mac_version':
@@ -31,7 +31,7 @@ vars = {
'sysroots_json_path': 'electron/script/sysroots.json', 'sysroots_json_path': 'electron/script/sysroots.json',
# KEEP IN SYNC WITH utils.js FILE # KEEP IN SYNC WITH utils.js FILE
'yarn_version': '1.22.22', 'yarn_version': '1.15.2',
# To be able to build clean Chromium from sources. # To be able to build clean Chromium from sources.
'apply_patches': True, 'apply_patches': True,

View File

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

View File

@@ -1,8 +1,8 @@
{ {
"plugins": [ "plugins": [
"import" "unicorn"
], ],
"rules": { "rules": {
"import/enforce-node-protocol-usage": ["error", "always"] "unicorn/prefer-node-protocol": "error"
} }
} }

View File

@@ -73,5 +73,3 @@ enterprise_cloud_content_analysis = false
# TODO: remove dependency on legacy ipc # TODO: remove dependency on legacy ipc
# https://issues.chromium.org/issues/40943039 # https://issues.chromium.org/issues/40943039
content_enable_legacy_ipc = true content_enable_legacy_ipc = true
clang_unsafe_buffers_paths = "//electron/electron_unsafe_buffers_paths.txt"

View File

@@ -1,8 +1,8 @@
{ {
"plugins": [ "plugins": [
"import" "unicorn"
], ],
"rules": { "rules": {
"import/enforce-node-protocol-usage": ["error", "always"] "unicorn/prefer-node-protocol": "error"
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,10 +6,6 @@
Process: [Main](../glossary.md#main-process) Process: [Main](../glossary.md#main-process)
> [!WARNING]
> Electron's built-in classes cannot be subclassed in user code.
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
### `new Menu()` ### `new Menu()`
Creates a new menu. Creates a new menu.
@@ -36,18 +32,16 @@ In order to escape the `&` character in an item name, add a proceeding `&`. For
Passing `null` will suppress the default menu. On Windows and Linux, Passing `null` will suppress the default menu. On Windows and Linux,
this has the additional effect of removing the menu bar from the window. this has the additional effect of removing the menu bar from the window.
> [!NOTE] **Note:** The default menu will be created automatically if the app does not set one.
> The default menu will be created automatically if the app does not set one. It contains standard items such as `File`, `Edit`, `View`, `Window` and `Help`.
> It contains standard items such as `File`, `Edit`, `View`, `Window` and `Help`.
#### `Menu.getApplicationMenu()` #### `Menu.getApplicationMenu()`
Returns `Menu | null` - The application menu, if set, or `null`, if not set. Returns `Menu | null` - The application menu, if set, or `null`, if not set.
> [!NOTE] **Note:** The returned `Menu` instance doesn't support dynamic addition or
> The returned `Menu` instance doesn't support dynamic addition or removal of menu items. [Instance properties](#instance-properties) can still
> removal of menu items. [Instance properties](#instance-properties) can still be dynamically modified.
> be dynamically modified.
#### `Menu.sendActionToFirstResponder(action)` _macOS_ #### `Menu.sendActionToFirstResponder(action)` _macOS_
@@ -80,7 +74,7 @@ The `menu` object has the following instance methods:
* `options` Object (optional) * `options` Object (optional)
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window. * `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
* `frame` [WebFrameMain](web-frame-main.md) (optional) - Provide the relevant frame * `frame` [WebFrameMain](web-frame-main.md) (optional) - Provide the relevant frame
if you want certain OS-level features such as Writing Tools on macOS to function correctly. Typically, this should be `params.frame` from the [`context-menu` event](web-contents.md#event-context-menu) on a WebContents, or the [`focusedFrame` property](web-contents.md#contentsfocusedframe-readonly) of a WebContents. if you want certain OS-level features such as Writing Tools on macOS to function correctly. Typically, this should be `params.frame` from the [`context-menu` event](web-contents.md#event-context-menu) on a WebContents.
* `x` number (optional) - Default is the current mouse cursor position. * `x` number (optional) - Default is the current mouse cursor position.
Must be declared if `y` is declared. Must be declared if `y` is declared.
* `y` number (optional) - Default is the current mouse cursor position. * `y` number (optional) - Default is the current mouse cursor position.
@@ -125,9 +119,8 @@ Inserts the `menuItem` to the `pos` position of the menu.
Objects created with `new Menu` or returned by `Menu.buildFromTemplate` emit the following events: Objects created with `new Menu` or returned by `Menu.buildFromTemplate` emit the following events:
> [!NOTE] **Note:** Some events are only available on specific operating systems and are
> Some events are only available on specific operating systems and are labeled as such.
> labeled as such.
#### Event: 'menu-will-show' #### Event: 'menu-will-show'
@@ -336,27 +329,6 @@ name, no matter what label you set. To change it, modify your app bundle's
[About Information Property List Files][AboutInformationPropertyListFiles] [About Information Property List Files][AboutInformationPropertyListFiles]
for more information. 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_) ## Setting Menu for Specific Browser Window (_Linux_ _Windows_)
The [`setMenu` method][setMenu] of browser windows can set the menu of certain The [`setMenu` method][setMenu] of browser windows can set the menu of certain

View File

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

View File

@@ -134,8 +134,7 @@ Creates an empty `NativeImage` instance.
Returns `Promise<NativeImage>` - fulfilled with the file's thumbnail preview image, which is a [NativeImage](native-image.md). Returns `Promise<NativeImage>` - fulfilled with the file's thumbnail preview image, which is a [NativeImage](native-image.md).
> [!NOTE] Note: The Windows implementation will ignore `size.height` and scale the height according to `size.width`.
> Windows implementation will ignore `size.height` and scale the height according to `size.width`.
### `nativeImage.createFromPath(path)` ### `nativeImage.createFromPath(path)`
@@ -143,8 +142,8 @@ Returns `Promise<NativeImage>` - fulfilled with the file's thumbnail preview ima
Returns `NativeImage` Returns `NativeImage`
Creates a new `NativeImage` instance from an image file (e.g., PNG or JPEG) located at `path`. Creates a new `NativeImage` instance from a file located at `path`. This method
This method returns an empty image if the `path` does not exist, cannot be read, or is not returns an empty image if the `path` does not exist, cannot be read, or is not
a valid image. a valid image.
```js ```js
@@ -272,12 +271,16 @@ changes:
Returns `string` - The [Data URL][data-url] of the image. Returns `string` - The [Data URL][data-url] of the image.
#### `image.getBitmap([options])` _Deprecated_ #### `image.getBitmap([options])`
* `options` Object (optional) * `options` Object (optional)
* `scaleFactor` Number (optional) - Defaults to 1.0. * `scaleFactor` Number (optional) - Defaults to 1.0.
Legacy alias for `image.toBitmap()`. Returns `Buffer` - A [Buffer][buffer] that contains the image's raw bitmap pixel data.
The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does not
copy the bitmap data, so you have to use the returned Buffer immediately in
current event loop tick; otherwise the data might be changed or destroyed.
#### `image.getNativeHandle()` _macOS_ #### `image.getNativeHandle()` _macOS_

View File

@@ -63,14 +63,6 @@ Your application should then always use `shouldUseDarkColors` to determine what
A `boolean` for if the OS / Chromium currently has high-contrast mode enabled A `boolean` for if the OS / Chromium currently has high-contrast mode enabled
or is being instructed to show a high-contrast UI. 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_ ### `nativeTheme.shouldUseInvertedColorScheme` _macOS_ _Windows_ _Readonly_
A `boolean` for if the OS / Chromium currently has an inverted color scheme A `boolean` for if the OS / Chromium currently has an inverted color scheme

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -46,6 +46,10 @@ An [`IpcMainServiceWorker`](ipc-main-service-worker.md) instance scoped to the s
A `string` representing the scope URL of the service worker. A `string` representing the scope URL of the service worker.
#### `serviceWorker.scriptURL` _Readonly_ _Experimental_
A `string` representing the script URL of the service worker.
#### `serviceWorker.versionId` _Readonly_ _Experimental_ #### `serviceWorker.versionId` _Readonly_ _Experimental_
A `number` representing the ID of the specific version of the service worker script in its scope. A `number` representing the ID of the specific version of the service worker script in its scope.

View File

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

View File

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

View File

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

View File

@@ -58,8 +58,8 @@
`false` on macOS. This option is not configurable on other platforms. `false` on macOS. This option is not configurable on other platforms.
* `disableAutoHideCursor` boolean (optional) - Whether to hide cursor when typing. * `disableAutoHideCursor` boolean (optional) - Whether to hide cursor when typing.
Default is `false`. Default is `false`.
* `autoHideMenuBar` boolean (optional) _Linux_ _Windows_ - Auto hide the menu bar * `autoHideMenuBar` boolean (optional) - Auto hide the menu bar unless the `Alt`
unless the `Alt` key is pressed. Default is `false`. key is pressed. Default is `false`.
* `enableLargerThanScreen` boolean (optional) _macOS_ - Enable the window to * `enableLargerThanScreen` boolean (optional) _macOS_ - Enable the window to
be resized larger than screen. Only relevant for macOS, as other OSes be resized larger than screen. Only relevant for macOS, as other OSes
allow larger-than-screen windows by default. Default is `false`. allow larger-than-screen windows by default. Default is `false`.
@@ -95,7 +95,6 @@
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color. * `color` String (optional) _Windows_ _Linux_ - The CSS color of 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. * `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. * `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
* `accentColor` boolean | string (optional) _Windows_ - The accent color for the window. By default, follows user preference in System Settings. Set to `false` to explicitly disable, or set the color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha values will be ignored.
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ - * `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
Set a custom position for the traffic light buttons in frameless windows. Set a custom position for the traffic light buttons in frameless windows.
* `roundedCorners` boolean (optional) _macOS_ _Windows_ - Whether frameless window * `roundedCorners` boolean (optional) _macOS_ _Windows_ - Whether frameless window

View File

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

View File

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

View File

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

View File

@@ -25,9 +25,8 @@
and URL responses. and URL responses.
* `method` string (optional) - The HTTP `method`. This is only used for file * `method` string (optional) - The HTTP `method`. This is only used for file
and URL responses. and URL responses.
* `session` Session (optional) - The session used for requesting URL, by default * `session` Session (optional) - The session used for requesting URL.
the HTTP request will reuse the current session. Setting `session` to `null` The HTTP request will reuse the current session by default.
would use a random independent session. This is only used for URL responses.
* `uploadData` [ProtocolResponseUploadData](protocol-response-upload-data.md) (optional) - The data used as upload data. This is only * `uploadData` [ProtocolResponseUploadData](protocol-response-upload-data.md) (optional) - The data used as upload data. This is only
used for URL responses when `method` is `"POST"`. used for URL responses when `method` is `"POST"`.

View File

@@ -4,9 +4,8 @@
> from Chromium at the space indicated by the proxy. By default, this proxy is added > from Chromium at the space indicated by the proxy. By default, this proxy is added
> to each TouchBar at the end of the input. For more information, see the AppKit docs on > to each TouchBar at the end of the input. For more information, see the AppKit docs on
> [NSTouchBarItemIdentifierOtherItemsProxy](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy) > [NSTouchBarItemIdentifierOtherItemsProxy](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy)
>
> [!NOTE] > Note: Only one instance of this class can be added per TouchBar.
> Only one instance of this class can be added per TouchBar.
Process: [Main](../glossary.md#main-process)<br /> Process: [Main](../glossary.md#main-process)<br />
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._ _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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