Commit graph

3336 commits

Author SHA1 Message Date
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 2e888368199317d67f6ad931a7e9eff0295c4b1b.

* 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
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
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: 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: 6287609
2025-03-25 15:01:17 -05: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
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
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
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
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
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
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
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
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
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 6325710

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

Refs 6342514

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

Refs 6344040

* chore: update patches

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

Refs 6349218

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

Refs 6349395

* 6331510: Migrate views::Background class to ui::ColorVariant | 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
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
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
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

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