| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
fix: apply the certificate SPKI blocklist to Node and add entries (#55126) Chromium carries a compiled-in list of SubjectPublicKeyInfo hashes that must never appear in a verified chain. Electron's Node had no equivalent, so the same chain could fail in a renderer and succeed in tls/https/fetch from the main or a utility process. - Node: wrap X509_verify_cert on every SecureContext and report CERT_REVOKED when a chain contains a blocked SPKI. - Chromium: add entries that Chrome distributes via CRLSet, which Electron does not consume, to the compiled-in list; Node's list mirrors them. - Testing binding hooks let the new spec extend Node's list at runtime and exercise the hook against the fixture chain. | 18 小时前 | |
fix: handle non-ASCII asar paths without a UTF-8 locale (#54655) * fix: handle non-ASCII asar paths without a UTF-8 locale IsArchivePrefix() built its FilePath with FromUTF8Unsafe(), which on Linux decodes through the C library locale and returns an empty path for non-ASCII input when that locale is not UTF-8. An archive under such a folder was then not recognized, so a main process started with no locale or LC_ALL=C could not load its app, and ELECTRON_RUN_AS_NODE children such as child_process.fork() could not read the archive under any locale. Use the path bytes directly on POSIX. Assisted-By: Claude Opus 5.5, Claude Code * Apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> | 8 天前 | |
chore: bump chromium to 157.0.8091.0 (main) (#54740) * chore: bump chromium in DEPS to 157.0.8091.0 * chore: update siso revision * 8518399: [Fullscreen] Reject requestFullscreen() when FullscreenAllowed is false Upstream moved the kFullscreenAllowed pref check into a new IsFullscreenAllowedByPref() helper that is now consulted from both CanEnterFullscreenModeForTab() and EnterFullscreenModeInternal(). Electron has no Profile (ExclusiveAccessContext::GetProfile() returns nullptr), so guarding only the old call site would now reject every fullscreen request on non-Mac platforms. Disable the pref lookup inside the helper instead so it always allows fullscreen. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8518399 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 7867823: [android] Add a feature to propagate occlusion to viz DisplayPrivate::SetDisplayVisible() now takes a viz::mojom::DisplayVisibility enum instead of a bool. Keep the display kVisible whenever background throttling is disabled, and kInvisible only when throttling is enabled and the compositor is hidden. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7867823 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8510323: Use C++20 std::numbers::e and std::numbers::sqrt2 in blink Remove the cherry-pick patch now that the upstream change has rolled in. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8510323 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8403316: [content] Add ContentClient::Schemes::code_cache_schemes Upstream landed the embedder code cache scheme list that feat_allow_code_cache_in_custom_schemes.patch added (it cites the patch's earlier CL 5019665), so the patch is removed. The upstream version records the schemes in blink::CommonSchemeRegistry rather than in url::SchemeRegistry, so: - RegisterSchemesAsPrivileged() now calls CommonSchemeRegistry::RegisterURLSchemeAsSupportingCodeCache() for custom schemes with codeCache enabled. The browser process registers these after RegisterContentSchemes() has already run, so it cannot rely on ContentClient::Schemes for them. Renderers keep registering them as CodeCacheWithHashing from the --code-cache-schemes switch. - ElectronContentClient lists chrome-extension in Schemes::code_cache_schemes, matching ChromeContentClient, since the browser-side checks no longer special-case IsExtensionScheme(). - feat_allow_enabling_extensions_on_custom_protocols.patch loses the removed url::AddCodeCacheScheme() lines from its context. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8403316 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: update patches * 8362417: content: Add CopyFromSurfaceSecure and plumb is_secure to capturer RenderWidgetHostViewBase::CopyFromSurface() is now final and dispatches to CopyFromSurfaceImpl(), which takes is_copy_request_secure and must pass it on to DelegatedFrameHost::CopyFromCompositingSurface(). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8362417 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8499040: Decisions API: Add Blink IDL, Mojo interfaces, Echo impl, and WPTs Stub the new AIManager decision model methods as unavailable, like the other unsupported AI APIs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8499040 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8349225: Decouple Cookies API from Profile via CookiesApiDelegate ExtensionsBrowserClient::GetBrowserContextLifetimeTracker() is now pure virtual. Electron has no off-the-record sibling contexts to track, so return nullptr, which the cookies API handles. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8349225 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8285500: hid: Restrict WebHID access in guest and partitioned contexts HidDelegate::IsHidAllowedForFrame() is now pure virtual and gates HidService creation. Mirror ElectronUsbDelegate::PageMayUseUsb(): deny WebViewGuests and HTTP(S) pages in non-default storage partitions. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8285500 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8488316: [Linux] Query XDG portal versions per interface RequestXdgDesktopPortal() now takes the portal interface whose version to report; pass the FileChooser interface. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8488316 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8508466: Remove duplicate DownloadManager::CreateDownloadItem() overload Pass an empty display_name, as the removed overload did. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8508466 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8357569: Move Cookies API implementation to //extensions Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8357569 * 8485746: gin: Use v8::CppHeapExternal for CallbackHolderBase Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8485746 * fix: re-enable v8 metagen Skip-Lint: enabling a feature with cherry picked CL. * fixup! 8499040: Decisions API: Add Blink IDL, Mojo interfaces, Echo impl, and WPTs * 8526928: Reland "Mac: Activate the widget when focusing a View in an inactive widget" FocusManager::SetFocusedViewWithReason() now activates an inactive widget before focusing a View in it on macOS, and NativeWidgetMacNSWindowHost::OnIsFirstResponderChanged() no longer restores focus while the window is not key. Forward both notifications to super so the views host tracks the window's key status. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8526928 * fix: stop the remote debugging HTTP server on shutdown DevToolsHttpHandler keeps a raw_ptr to the DevToolsManagerDelegate owned by the DevToolsManager singleton, which is destroyed at exit. Electron never stopped the HTTP server, so the delegate was freed while the handler still pointed at it. Skip-Lint: raw_ptr shutdown crash fix --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: electron-claude[bot] <279139701+electron-claude[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> | 10 天前 | |
chore: bump chromium to 158.0.8107.0 (main) (#55013) * chore: bump chromium in DEPS to 158.0.8106.0 * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * 8526232: media: Group capture-related fields into CaptureMetadata Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8526232 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8525546: [api] Advance deprecation of callback data APIs Upstream advanced FunctionCallbackInfo::Data() and PropertyCallbackInfo::Data() from V8_DEPRECATE_SOON to V8_DEPRECATED, which Electron builds with -Werror. Switched all call sites to DataV2(), casting through v8::Value where the target type's Cast() only accepts v8::Value. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/8525546 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. Unload handlers no longer run on http(s) pages unless the page opts in via Permissions-Policy. The detached-frame specs observe IPC sent from an unload handler during cross-origin navigation, so serve their test pages with `Permissions-Policy: unload=*`. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8577897 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * fixup! 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. docs: add breaking change for unload deprecation Document that unload handlers no longer run in http(s) documents, how to migrate to pagehide/visibilitychange, and how to opt back in. Mention pagehide alongside unload in the webFrameMain `frame.detached` docs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8577897 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * fixup! 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. docs: drop DeprecateUnloadByBucket note from unload breaking change Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * chore: bump chromium in DEPS to 158.0.8107.0 * 8527334: [Linux] Fix GlobalShortcuts portal binding issues Upstream restructured GlobalAcceleratorListenerLinux's bind state machine around the set of IDs to bind and only binds when that set changes. Adapted the registration-resolved patch to it: - ListShortcuts failures no longer abort binding upstream, so they no longer resolve registrations as failed. - Groups in a bind request are collected from the IDs being bound. - Resolve as bound when a version 1 portal already lists every shortcut, and when a group's shortcuts are already bound in the current session (upstream no longer re-binds then). - Keep closing the session on a failed bind so the failed IDs are not recorded as bound in the session. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8527334 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * chore: update patches * 8574624: [Linux] Prevent QT from loading GTK3 when GSettings schemas are invalid The GSettings schema check moved from ui/gtk to ui/base/glib/gsettings.cc, so the warning for the missing font-antialiasing key now reads "Invalid GSettings schema org.gnome.desktop.interface for key font-antialiasing: missing" instead of "Schema org.gnome.desktop.interface does not have key font-antialiasing". Accept either wording in the "creates and refreshes a menu when GTK cannot initialize" spec, since the CL was reverted and relanded. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8574624 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: electron-claude[bot] <279139701+electron-claude[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> | 1 天前 | |
chore: bump chromium to 158.0.8107.0 (main) (#55013) * chore: bump chromium in DEPS to 158.0.8106.0 * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * 8526232: media: Group capture-related fields into CaptureMetadata Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8526232 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8525546: [api] Advance deprecation of callback data APIs Upstream advanced FunctionCallbackInfo::Data() and PropertyCallbackInfo::Data() from V8_DEPRECATE_SOON to V8_DEPRECATED, which Electron builds with -Werror. Switched all call sites to DataV2(), casting through v8::Value where the target type's Cast() only accepts v8::Value. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/8525546 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. Unload handlers no longer run on http(s) pages unless the page opts in via Permissions-Policy. The detached-frame specs observe IPC sent from an unload handler during cross-origin navigation, so serve their test pages with `Permissions-Policy: unload=*`. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8577897 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * fixup! 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. docs: add breaking change for unload deprecation Document that unload handlers no longer run in http(s) documents, how to migrate to pagehide/visibilitychange, and how to opt back in. Mention pagehide alongside unload in the webFrameMain `frame.detached` docs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8577897 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * fixup! 8577897: Enable DeprecateUnload and DeprecateUnloadByBucket by default. docs: drop DeprecateUnloadByBucket note from unload breaking change Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * chore: bump chromium in DEPS to 158.0.8107.0 * 8527334: [Linux] Fix GlobalShortcuts portal binding issues Upstream restructured GlobalAcceleratorListenerLinux's bind state machine around the set of IDs to bind and only binds when that set changes. Adapted the registration-resolved patch to it: - ListShortcuts failures no longer abort binding upstream, so they no longer resolve registrations as failed. - Groups in a bind request are collected from the IDs being bound. - Resolve as bound when a version 1 portal already lists every shortcut, and when a group's shortcuts are already bound in the current session (upstream no longer re-binds then). - Keep closing the session on a failed bind so the failed IDs are not recorded as bound in the session. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8527334 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX * chore: update patches * 8574624: [Linux] Prevent QT from loading GTK3 when GSettings schemas are invalid The GSettings schema check moved from ui/gtk to ui/base/glib/gsettings.cc, so the warning for the missing font-antialiasing key now reads "Invalid GSettings schema org.gnome.desktop.interface for key font-antialiasing: missing" instead of "Schema org.gnome.desktop.interface does not have key font-antialiasing". Accept either wording in the "creates and refreshes a menu when GTK cannot initialize" spec, since the CL was reverted and relanded. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8574624 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01We3DwyzcxvA6LqGJdoeHAX --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: electron-claude[bot] <279139701+electron-claude[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> | 1 天前 | |
fix: use audit token instead of PID for parent code-signature check (#50907) | 6 个月前 | |
fix: disable MallocNanoZone on mac (#33704) | 4 年前 | |
feat: add app shims on macOS (#54932) * feat: add app shims on macOS An app shim is a small app, in a bundle of its own, that shows windows on behalf of a host Electron app. The host still creates each window, loads its page and handles its events, but the NSWindow belongs to the shim's process, so the Dock, the app switcher, Mission Control and Stage Manager attribute the window to the shim and not to the host. - `app.startAppShimServer()` / `app.stopAppShimServer()` and the `app-shim-connected` event, which hands over an `AppShimHost`. - A `BaseWindow` / `BrowserWindow` created with the `appShim` option has its native window made in that shim's process, through Chromium's remote_cocoa. Such a window is a new NativeWindow implementation that only goes through views::Widget; what remote_cocoa has no call for is a no-op (see docs/api/app-shim-host.md). - The shim's executable is `Helpers/app_shim_loader` from the framework bundle. It links nothing from Electron: it loads the host's framework and calls the new `ElectronAppShimMain` export, which runs an `app-shim` process that connects back to the host over a Mach bootstrap server. - Electron Framework gains an rpath to the folder it is in, so that it finds its sibling frameworks when an executable in another bundle loads it. Not available in Mac App Store builds. Co-Authored-By: Claude <noreply@anthropic.com> * feat: app shim menus, dialogs, window chrome and review fixes Follow-up to the first app shim commit. Fixes from review: - A window torn down from one of its own listeners (shim.quit() or win.destroy() in `show`) no longer frees the native host that is notifying. - The native close button no longer leaves the shim waiting on an answer that was dropped with the window. - Keys the page does not handle go back to the shim, whose menu they are shortcuts of, and not to the host's menu. - stopAppShimServer() drops shims that have connected and not said hello. - Quitting a shim asks the host without blocking and without cancelling a logout; quit-requested can now be answered with "no". - Size limits and useContentSize are in content sizes; restore() and unmaximize() each do one thing; webContents.isFocused() works. New: - shim.setMenu(): a menu bar of the shim's own, built in the shim from a description of the Menu, with clicks sent back. - Message boxes and open and save dialogs are sheets of the window in the shim's process. - titleBarStyle, traffic light position and visibility, vibrancy, tabs and Quick Look, applied in the shim to the NSWindow that remote_cocoa made. - A Chromium patch for what remote_cocoa has no call for: movable, closable, minimizable and fullscreenable, clearing an aspect ratio, and yielding activation to the hosting process by pid. - A shim that loaded another build of Electron than the running host tells the host and quits: app-shim-version-mismatch. The API is marked experimental in the docs. Co-Authored-By: Claude <noreply@anthropic.com> * fix: address review of app shims - A window in an app shim can't be given a parent, at construction or with setParentWindow(), as the docs say. - shim.setMenu() is now shim.setApplicationMenu(). - A message box that is showing under an id makes way for a new one with that id, whichever process shows it. - Mac App Store builds no longer export the shim's entry point; they already had no loader. - setProgressBar() and setHasShadow() are listed among what does nothing on a window in a shim. - The spec no longer asserts inside an event listener. Co-Authored-By: Claude <noreply@anthropic.com> * fix: clang-tidy findings in app shim code * docs: reword the app shim docs for clarity * chore: update patches Re-exported after rebasing onto Chromium 158.0.8105.0; only line offsets changed. Co-Authored-By: Claude <noreply@anthropic.com> * test: use vitest matchers in the app shim spec --------- Co-authored-by: Claude <noreply@anthropic.com> | 3 天前 | |
feat: add app shims on macOS (#54932) * feat: add app shims on macOS An app shim is a small app, in a bundle of its own, that shows windows on behalf of a host Electron app. The host still creates each window, loads its page and handles its events, but the NSWindow belongs to the shim's process, so the Dock, the app switcher, Mission Control and Stage Manager attribute the window to the shim and not to the host. - `app.startAppShimServer()` / `app.stopAppShimServer()` and the `app-shim-connected` event, which hands over an `AppShimHost`. - A `BaseWindow` / `BrowserWindow` created with the `appShim` option has its native window made in that shim's process, through Chromium's remote_cocoa. Such a window is a new NativeWindow implementation that only goes through views::Widget; what remote_cocoa has no call for is a no-op (see docs/api/app-shim-host.md). - The shim's executable is `Helpers/app_shim_loader` from the framework bundle. It links nothing from Electron: it loads the host's framework and calls the new `ElectronAppShimMain` export, which runs an `app-shim` process that connects back to the host over a Mach bootstrap server. - Electron Framework gains an rpath to the folder it is in, so that it finds its sibling frameworks when an executable in another bundle loads it. Not available in Mac App Store builds. Co-Authored-By: Claude <noreply@anthropic.com> * feat: app shim menus, dialogs, window chrome and review fixes Follow-up to the first app shim commit. Fixes from review: - A window torn down from one of its own listeners (shim.quit() or win.destroy() in `show`) no longer frees the native host that is notifying. - The native close button no longer leaves the shim waiting on an answer that was dropped with the window. - Keys the page does not handle go back to the shim, whose menu they are shortcuts of, and not to the host's menu. - stopAppShimServer() drops shims that have connected and not said hello. - Quitting a shim asks the host without blocking and without cancelling a logout; quit-requested can now be answered with "no". - Size limits and useContentSize are in content sizes; restore() and unmaximize() each do one thing; webContents.isFocused() works. New: - shim.setMenu(): a menu bar of the shim's own, built in the shim from a description of the Menu, with clicks sent back. - Message boxes and open and save dialogs are sheets of the window in the shim's process. - titleBarStyle, traffic light position and visibility, vibrancy, tabs and Quick Look, applied in the shim to the NSWindow that remote_cocoa made. - A Chromium patch for what remote_cocoa has no call for: movable, closable, minimizable and fullscreenable, clearing an aspect ratio, and yielding activation to the hosting process by pid. - A shim that loaded another build of Electron than the running host tells the host and quits: app-shim-version-mismatch. The API is marked experimental in the docs. Co-Authored-By: Claude <noreply@anthropic.com> * fix: address review of app shims - A window in an app shim can't be given a parent, at construction or with setParentWindow(), as the docs say. - shim.setMenu() is now shim.setApplicationMenu(). - A message box that is showing under an id makes way for a new one with that id, whichever process shows it. - Mac App Store builds no longer export the shim's entry point; they already had no loader. - setProgressBar() and setHasShadow() are listed among what does nothing on a window in a shim. - The spec no longer asserts inside an event listener. Co-Authored-By: Claude <noreply@anthropic.com> * fix: clang-tidy findings in app shim code * docs: reword the app shim docs for clarity * chore: update patches Re-exported after rebasing onto Chromium 158.0.8105.0; only line offsets changed. Co-Authored-By: Claude <noreply@anthropic.com> * test: use vitest matchers in the app shim spec --------- Co-authored-by: Claude <noreply@anthropic.com> | 3 天前 | |
feat: add app shims on macOS (#54932) * feat: add app shims on macOS An app shim is a small app, in a bundle of its own, that shows windows on behalf of a host Electron app. The host still creates each window, loads its page and handles its events, but the NSWindow belongs to the shim's process, so the Dock, the app switcher, Mission Control and Stage Manager attribute the window to the shim and not to the host. - `app.startAppShimServer()` / `app.stopAppShimServer()` and the `app-shim-connected` event, which hands over an `AppShimHost`. - A `BaseWindow` / `BrowserWindow` created with the `appShim` option has its native window made in that shim's process, through Chromium's remote_cocoa. Such a window is a new NativeWindow implementation that only goes through views::Widget; what remote_cocoa has no call for is a no-op (see docs/api/app-shim-host.md). - The shim's executable is `Helpers/app_shim_loader` from the framework bundle. It links nothing from Electron: it loads the host's framework and calls the new `ElectronAppShimMain` export, which runs an `app-shim` process that connects back to the host over a Mach bootstrap server. - Electron Framework gains an rpath to the folder it is in, so that it finds its sibling frameworks when an executable in another bundle loads it. Not available in Mac App Store builds. Co-Authored-By: Claude <noreply@anthropic.com> * feat: app shim menus, dialogs, window chrome and review fixes Follow-up to the first app shim commit. Fixes from review: - A window torn down from one of its own listeners (shim.quit() or win.destroy() in `show`) no longer frees the native host that is notifying. - The native close button no longer leaves the shim waiting on an answer that was dropped with the window. - Keys the page does not handle go back to the shim, whose menu they are shortcuts of, and not to the host's menu. - stopAppShimServer() drops shims that have connected and not said hello. - Quitting a shim asks the host without blocking and without cancelling a logout; quit-requested can now be answered with "no". - Size limits and useContentSize are in content sizes; restore() and unmaximize() each do one thing; webContents.isFocused() works. New: - shim.setMenu(): a menu bar of the shim's own, built in the shim from a description of the Menu, with clicks sent back. - Message boxes and open and save dialogs are sheets of the window in the shim's process. - titleBarStyle, traffic light position and visibility, vibrancy, tabs and Quick Look, applied in the shim to the NSWindow that remote_cocoa made. - A Chromium patch for what remote_cocoa has no call for: movable, closable, minimizable and fullscreenable, clearing an aspect ratio, and yielding activation to the hosting process by pid. - A shim that loaded another build of Electron than the running host tells the host and quits: app-shim-version-mismatch. The API is marked experimental in the docs. Co-Authored-By: Claude <noreply@anthropic.com> * fix: address review of app shims - A window in an app shim can't be given a parent, at construction or with setParentWindow(), as the docs say. - shim.setMenu() is now shim.setApplicationMenu(). - A message box that is showing under an id makes way for a new one with that id, whichever process shows it. - Mac App Store builds no longer export the shim's entry point; they already had no loader. - setProgressBar() and setHasShadow() are listed among what does nothing on a window in a shim. - The spec no longer asserts inside an event listener. Co-Authored-By: Claude <noreply@anthropic.com> * fix: clang-tidy findings in app shim code * docs: reword the app shim docs for clarity * chore: update patches Re-exported after rebasing onto Chromium 158.0.8105.0; only line offsets changed. Co-Authored-By: Claude <noreply@anthropic.com> * test: use vitest matchers in the app shim spec --------- Co-authored-by: Claude <noreply@anthropic.com> | 3 天前 | |
feat: add app shims on macOS (#54932) * feat: add app shims on macOS An app shim is a small app, in a bundle of its own, that shows windows on behalf of a host Electron app. The host still creates each window, loads its page and handles its events, but the NSWindow belongs to the shim's process, so the Dock, the app switcher, Mission Control and Stage Manager attribute the window to the shim and not to the host. - `app.startAppShimServer()` / `app.stopAppShimServer()` and the `app-shim-connected` event, which hands over an `AppShimHost`. - A `BaseWindow` / `BrowserWindow` created with the `appShim` option has its native window made in that shim's process, through Chromium's remote_cocoa. Such a window is a new NativeWindow implementation that only goes through views::Widget; what remote_cocoa has no call for is a no-op (see docs/api/app-shim-host.md). - The shim's executable is `Helpers/app_shim_loader` from the framework bundle. It links nothing from Electron: it loads the host's framework and calls the new `ElectronAppShimMain` export, which runs an `app-shim` process that connects back to the host over a Mach bootstrap server. - Electron Framework gains an rpath to the folder it is in, so that it finds its sibling frameworks when an executable in another bundle loads it. Not available in Mac App Store builds. Co-Authored-By: Claude <noreply@anthropic.com> * feat: app shim menus, dialogs, window chrome and review fixes Follow-up to the first app shim commit. Fixes from review: - A window torn down from one of its own listeners (shim.quit() or win.destroy() in `show`) no longer frees the native host that is notifying. - The native close button no longer leaves the shim waiting on an answer that was dropped with the window. - Keys the page does not handle go back to the shim, whose menu they are shortcuts of, and not to the host's menu. - stopAppShimServer() drops shims that have connected and not said hello. - Quitting a shim asks the host without blocking and without cancelling a logout; quit-requested can now be answered with "no". - Size limits and useContentSize are in content sizes; restore() and unmaximize() each do one thing; webContents.isFocused() works. New: - shim.setMenu(): a menu bar of the shim's own, built in the shim from a description of the Menu, with clicks sent back. - Message boxes and open and save dialogs are sheets of the window in the shim's process. - titleBarStyle, traffic light position and visibility, vibrancy, tabs and Quick Look, applied in the shim to the NSWindow that remote_cocoa made. - A Chromium patch for what remote_cocoa has no call for: movable, closable, minimizable and fullscreenable, clearing an aspect ratio, and yielding activation to the hosting process by pid. - A shim that loaded another build of Electron than the running host tells the host and quits: app-shim-version-mismatch. The API is marked experimental in the docs. Co-Authored-By: Claude <noreply@anthropic.com> * fix: address review of app shims - A window in an app shim can't be given a parent, at construction or with setParentWindow(), as the docs say. - shim.setMenu() is now shim.setApplicationMenu(). - A message box that is showing under an id makes way for a new one with that id, whichever process shows it. - Mac App Store builds no longer export the shim's entry point; they already had no loader. - setProgressBar() and setHasShadow() are listed among what does nothing on a window in a shim. - The spec no longer asserts inside an event listener. Co-Authored-By: Claude <noreply@anthropic.com> * fix: clang-tidy findings in app shim code * docs: reword the app shim docs for clarity * chore: update patches Re-exported after rebasing onto Chromium 158.0.8105.0; only line offsets changed. Co-Authored-By: Claude <noreply@anthropic.com> * test: use vitest matchers in the app shim spec --------- Co-authored-by: Claude <noreply@anthropic.com> | 3 天前 | |
chore: bump chromium to 157.0.8100.0 (main) (#54810) * chore: bump chromium in DEPS to 157.0.8095.0 * chore: remove upstreamed patches Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8512441 Ref: https://chromium-review.googlesource.com/c/v8/v8/+/8535626 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: update patches * 8522656: mojo: Clean up miscellaneous legacy Mojo Core leftovers Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8522656 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8527946: gpu: Remove GpuSwitchingManager Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8527946 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8507429: Move BuildUserAgentFromProduct() to anonymous namespace Upstream made BuildUserAgentFromProduct() private and points external embedders at BuildUnifiedPlatformUserAgentFromProduct(), which is what Chrome itself reports by default under User-Agent reduction. The remaining public helpers do not expose the OS/CPU info needed to rebuild the old string, so switch to the unified platform variant. The result is identical on x64 macOS, Windows and Linux; on ARM builds the platform token now reads x86_64 / Win64; x64, matching Chrome. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8507429 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8504744: LanguageModel.prompt() returns a sequence<LanguageModelMessageContent> if expecting tool call output Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8504744 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8451262: Move predictor traffic annotations from header to .cc files The loading predictor's preconnect annotation is now defined in loading_predictor.cc, which Electron does not build, so define an Electron-specific annotation for session.preconnect instead. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8451262 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: bump chromium in DEPS to 157.0.8096.0 * chore: update patches * 8498256: Shared Storage: Remove API stubs and interfaces Upstream removed SharedStorageWorkletGlobalScope and the ExecutionContext::IsSharedStorageWorkletGlobalScope() predicate, so the pooled-worklet check in WebWorkerObserver no longer needs it. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8498256 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: bump chromium in DEPS to 157.0.8098.0 * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * chore: bump chromium in DEPS to 157.0.8100.0 * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * 8504019: Move NotificationImageRetainer to //chrome/browser/notifications/win Electron adopts the ScopedTempFile lifecycle introduced by the preceding macOS notification change. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8504019 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8504017#nolint Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * 8533026: Test and fix for ShadowRealm last resort full gc crash ref: https://chromium-review.googlesource.com/c/chromium/src/+/8533026 Remove cherry-picked patch --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: electron-claude[bot] <279139701+electron-claude[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> | 7 天前 | |
perf: build the application user agent once (#54206) session.getUserAgent(), and every request that asks the browser client for a user agent, rebuilt the whole string on every call: read the application name (which on Linux opens the .desktop file), read the version, format the product string, then build the Mozilla/5.0 header around it. Cache it, and drop the cache when the name, version or desktop name it was built from changes. A value built while an invalidation lands is returned but not stored. Testing build: session.getUserAgent() 1399 ns -> 562 ns. | 26 天前 | |
chore: bump chromium to 137.0.7149.0 (main) (#46777) * chore: bump chromium in DEPS to 137.0.7144.0 * chore: bump chromium in DEPS to 137.0.7145.0 * chore: bump chromium in DEPS to 137.0.7147.0 * chore: update patches * Remove deprecated GetVar(std::string_view, std::string*) overload Refs https://chromium-review.googlesource.com/c/chromium/src/+/6468873 * fixup! Remove deprecated GetVar(std::string_view, std::string*) overload * fixup! Remove deprecated GetVar(std::string_view, std::string*) overload * chore: bump chromium in DEPS to 137.0.7149.0 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> | 1 年前 | |
chore: bump chromium to 118.0.5975.0 (main) (#39531) * chore: bump chromium in DEPS to 118.0.5951.0 * chore: update printing.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4727894 No logic changes, but patch needed to be manually re-applied due to upstream code shear * chore: update port_autofill_colors_to_the_color_pipeline.patch No manual changes; patch applied with fuzz * chore: update patches * chore: bump chromium in DEPS to 118.0.5953.0 * chore: update patches * chore: bump chromium in DEPS to 118.0.5955.0 * chore: update patches * chore: bump chromium in DEPS to 118.0.5957.0 * chore: update patches * chore: include path of native_web_keyboard_event.h Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689 * chore: remove reference to eextensions/browser/notification-types.h Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4771627 * chore: update references to renamed upstream field NativeWebKeyboardEvent.skip_if_unhandled (formerly known as skip_in_browser Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689 Need a second pair of eyes on this commit. In particular the reference in content_converter.cc, skipInBrowser, seems to not be set or documented anywhere? Is this unused/vestigal code? * chore: sync signature of ElectronExtensionsBrowserClient::IsValidContext() to upstream change Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4784198 * chore: add auto_pip_setting_helper.[cc,h] to chromium_src build Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4688277 Exiting upstream code used by chromium_src now depends on this new upstream class * chore: bump chromium in DEPS to 118.0.5959.0 * chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch Xref: add_maximized_parameter_to_linuxui_getwindowframeprovider.patch manually adjust patch to minor upstream chagnes * chore: update patches * chore: bump chromium in DEPS to 118.0.5961.0 * chore: bump chromium in DEPS to 118.0.5963.0 * chore: update patches * 4780994: Rename various base files to "apple" since iOS uses them too https://chromium-review.googlesource.com/c/chromium/src/+/4780994 * Many files moved from `mac` -> `apple` This commit follows a handful of CLs that simply rename files/symbols to change `mac` to `apple` to signify their use across both macOS and iOS: - 4784010: Move scoped_nsautorelease_pool to base/apple, leave a forwarding header - 4790744: Move foundation_util to base/apple, leave a forwarding header - 4790741: Move scoped_cftypreref to base/apple, leave a forwarding header - 4787627: Move and rename macOS+iOS base/ files in PA to "apple" - 4780399: Move OSStatus logging to base/apple - 4787387: Remove forwarding headers - 4781113: Rename message_pump_mac to "apple" because iOS uses it too * fixup minor patch update error A function param got dropped from this patch somewhere earlier * chore: bump chromium in DEPS to 118.0.5965.2 * chore: update patches * 4799213: Move ScopedTypeRef and ScopedCFTypeRef into base::apple:: https://chromium-review.googlesource.com/c/chromium/src/+/4799213 * Fix removed include to BrowserContext In crrev.com/c/4767962 an include to BrowserContext was removed, which was necessary for compilation. This broke only for us because "chrome/browser/profiles/profile.h" includes that class, but we remove all references to profiles. * chore: bump chromium in DEPS to 118.0.5967.0 * chore: update patches * chore: bump chromium in DEPS to 118.0.5969.0 * chore: update patches * chore: bump chromium in DEPS to 118.0.5971.0 * chore: bump chromium in DEPS to 118.0.5973.0 * chore: update patches * 4772121: [OOPIF PDF] Replace PDFWebContentsHelper with PDFDocumentHelper https://chromium-review.googlesource.com/c/chromium/src/+/4772121 * 4811164: [Extensions] Do some cleanup in ChromeManagementAPIDelegate. https://chromium-review.googlesource.com/c/chromium/src/+/4811164 * 4809488: Remove duplicate dnd functionality between Web and Renderer prefs https://chromium-review.googlesource.com/c/chromium/src/+/4809488 Given that this is no longer an option of web preferences, we should consider deprecating this option and then removing it. * chore: bump chromium in DEPS to 118.0.5975.0 * chore: update patches * fixup! chore: add auto_pip_settings_helper.{cc|h} to chromium_src build * Reland "[windows] Remove RegKey::DeleteEmptyKey" Refs https://chromium-review.googlesource.com/c/chromium/src/+/4813255 * Ensure StrCat means StrCat Refs https://chromium-review.googlesource.com/c/chromium/src/+/1117180 * fixup! Remove RegKey::DeleteEmptyKey * Consistently reject large p and large q in DH Refs https://boringssl-review.googlesource.com/c/boringssl/+/62226 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: clavin <clavin@electronjs.org> Co-authored-by: deepak1556 <hop2deep@gmail.com> | 3 年前 | |
refactor: remove electron::ScopedHString in favor of base::win::ScopedHString (#53941) Assisted-by: GPT-6 Astra | 1 个月前 | |
refactor: remove `base::AdaptCallbackForRepeating` patch (#48774) refactor: remove base::AdaptCallbackForRepeating patch | 11 个月前 | |
fix: report the system accent colour consistently on Windows (#54353) * fix: report the system accent colour consistently on Windows systemPreferences read HKCU\...\DWM\AccentColor directly for getAccentColor() but emitted 'accent-color-changed' with the DWM *colorization* colour from WM_DWMCOLORIZATIONCOLORCHANGED, formatted by a separate lowercase helper, so the event's newColor did not match getAccentColor() and the change de-duplication never matched on the first event. NativeWindowViews kept two more registry readers for the same key. Use ui::AccentColorObserver for all of it: it watches the DWM key, prefers the UISettings value Windows actually applies, and exposes ShouldUseAccentColorForWindowFrame(). This removes systemPreferences' hidden WS_POPUP broadcast window. * fix: refresh the frame accent colour from AccentColorObserver notifications NativeWindowViews read the observer's cached colour from the WM_DWMCOLORIZATIONCOLORCHANGED / WM_SETTINGCHANGE handlers, which can run before the observer's registry watch has refreshed that cache, and nothing reapplied the colour afterwards. Subscribe to the observer instead and drop the message handlers. Also emit systemPreferences' accent-color-changed from a posted task rather than from inside the observer's notification. | 25 天前 | |
fix: report the system accent colour consistently on Windows (#54353) * fix: report the system accent colour consistently on Windows systemPreferences read HKCU\...\DWM\AccentColor directly for getAccentColor() but emitted 'accent-color-changed' with the DWM *colorization* colour from WM_DWMCOLORIZATIONCOLORCHANGED, formatted by a separate lowercase helper, so the event's newColor did not match getAccentColor() and the change de-duplication never matched on the first event. NativeWindowViews kept two more registry readers for the same key. Use ui::AccentColorObserver for all of it: it watches the DWM key, prefers the UISettings value Windows actually applies, and exposes ShouldUseAccentColorForWindowFrame(). This removes systemPreferences' hidden WS_POPUP broadcast window. * fix: refresh the frame accent colour from AccentColorObserver notifications NativeWindowViews read the observer's cached colour from the WM_DWMCOLORIZATIONCOLORCHANGED / WM_SETTINGCHANGE handlers, which can run before the observer's registry watch has refreshed that cache, and nothing reapplied the colour afterwards. Subscribe to the observer instead and drop the message handlers. Also emit systemPreferences' accent-color-changed from a posted task rather than from inside the observer's notification. | 25 天前 | |
refactor: remove unused `#include "third_party/..."` calls (#52642) * refactor: remove unused `#include "third_party/..."` * chore: iwyu electron/buildflags/buildflags.h * refactor: remove unused `#include "third_party/..."` in .cc, .mm | 2 个月前 | |
chore: used nested namespaces (#34737) | 4 年前 | |
chore: bump chromium to 141.0.7390.7 (main) (#48212) * chore: bump chromium in DEPS to 141.0.7381.3 * chore: update patches * chore: bump chromium in DEPS to 141.0.7382.0 * chore: update patches * chore: bump chromium in DEPS to 141.0.7384.0 * chore: bump chromium in DEPS to 141.0.7386.0 * [Extensions] Move devtools_page and chrome_url_overrides handlers Refs https://chromium-review.googlesource.com/c/chromium/src/+/6862700 * Reland "[api] Advance deprecation of GetIsolate" Refs https://chromium-review.googlesource.com/c/v8/v8/+/6875273 * Move "system integrated UI" concept out of NativeTheme. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6867375 * chore: update patches * Reland "[PermissionOptions] Return PermissionResult in callback for requests" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6851838 * Reland "[exit-time-destructors] Enable by default" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6859042 * chore: update patches * [FSA] Revoke Read access after removing file via FileSystemAccess API Refs https://chromium-review.googlesource.com/c/chromium/src/+/6677249 * chore: IWYU * [DevToolsUIBindings] Accept an object for `dispatchHttpRequest` params Refs https://chromium-review.googlesource.com/c/chromium/src/+/6877528 * chore: IWYU * Pass navigation UI parameters on EnterFullscreen in EAM Refs https://chromium-review.googlesource.com/c/chromium/src/+/6874923 * chore: rm band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch * Remove unused PreHandleMouseEvent Refs https://chromium-review.googlesource.com/c/chromium/src/+/6880411 * 6878583: siso: update to version 1.4.1 https://chromium-review.googlesource.com/c/chromium/src/+/6878583 * Fold native_theme_browser into native_theme. https://chromium-review.googlesource.com/c/chromium/src/+/6882627 * fixup: Reland "[exit-time-destructors] Enable by default https://chromium-review.googlesource.com/c/chromium/src/+/6859042 * chore: update filenames.libcxx.gni * chore: IWYU * fixup: chore: IWYU * fixup: Reland "[exit-time-destructors] Enable by default * fixup: Reland "[exit-time-destructors] Enable by default * Remove common_theme.*; place its method in NativeTheme instead. https://chromium-review.googlesource.com/c/chromium/src/+/6886029 * fixup: Reland "[exit-time-destructors] Enable by default * Better track when WebPreferences need updates for color-related changes. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6886797 * chore: bump chromium in DEPS to 141.0.7390.7 * 6904664: Reland "Make BrowserContext::GetPath() const" https://chromium-review.googlesource.com/c/chromium/src/+/6904664 * Restore read access after certain file modification operations https://chromium-review.googlesource.com/c/chromium/src/+/6861041 * fixup: Move "system integrated UI" concept out of NativeTheme. * fixup: Reland "[exit-time-destructors] Enable by default * chore: update patches * 6906096: Remove GetSysSkColor(). https://chromium-review.googlesource.com/c/chromium/src/+/6906096 * Inline implementation of SysColorChangeListener into the lone user. https://chromium-review.googlesource.com/c/chromium/src/+/6905083 Also 6906096: Remove GetSysSkColor(). | https://chromium-review.googlesource.com/c/chromium/src/+/6906096 * fixup: 6906096: Remove GetSysSkColor() --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> | 1 年前 | |
chore: bump chromium to 141.0.7390.7 (main) (#48212) * chore: bump chromium in DEPS to 141.0.7381.3 * chore: update patches * chore: bump chromium in DEPS to 141.0.7382.0 * chore: update patches * chore: bump chromium in DEPS to 141.0.7384.0 * chore: bump chromium in DEPS to 141.0.7386.0 * [Extensions] Move devtools_page and chrome_url_overrides handlers Refs https://chromium-review.googlesource.com/c/chromium/src/+/6862700 * Reland "[api] Advance deprecation of GetIsolate" Refs https://chromium-review.googlesource.com/c/v8/v8/+/6875273 * Move "system integrated UI" concept out of NativeTheme. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6867375 * chore: update patches * Reland "[PermissionOptions] Return PermissionResult in callback for requests" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6851838 * Reland "[exit-time-destructors] Enable by default" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6859042 * chore: update patches * [FSA] Revoke Read access after removing file via FileSystemAccess API Refs https://chromium-review.googlesource.com/c/chromium/src/+/6677249 * chore: IWYU * [DevToolsUIBindings] Accept an object for `dispatchHttpRequest` params Refs https://chromium-review.googlesource.com/c/chromium/src/+/6877528 * chore: IWYU * Pass navigation UI parameters on EnterFullscreen in EAM Refs https://chromium-review.googlesource.com/c/chromium/src/+/6874923 * chore: rm band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch * Remove unused PreHandleMouseEvent Refs https://chromium-review.googlesource.com/c/chromium/src/+/6880411 * 6878583: siso: update to version 1.4.1 https://chromium-review.googlesource.com/c/chromium/src/+/6878583 * Fold native_theme_browser into native_theme. https://chromium-review.googlesource.com/c/chromium/src/+/6882627 * fixup: Reland "[exit-time-destructors] Enable by default https://chromium-review.googlesource.com/c/chromium/src/+/6859042 * chore: update filenames.libcxx.gni * chore: IWYU * fixup: chore: IWYU * fixup: Reland "[exit-time-destructors] Enable by default * fixup: Reland "[exit-time-destructors] Enable by default * Remove common_theme.*; place its method in NativeTheme instead. https://chromium-review.googlesource.com/c/chromium/src/+/6886029 * fixup: Reland "[exit-time-destructors] Enable by default * Better track when WebPreferences need updates for color-related changes. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6886797 * chore: bump chromium in DEPS to 141.0.7390.7 * 6904664: Reland "Make BrowserContext::GetPath() const" https://chromium-review.googlesource.com/c/chromium/src/+/6904664 * Restore read access after certain file modification operations https://chromium-review.googlesource.com/c/chromium/src/+/6861041 * fixup: Move "system integrated UI" concept out of NativeTheme. * fixup: Reland "[exit-time-destructors] Enable by default * chore: update patches * 6906096: Remove GetSysSkColor(). https://chromium-review.googlesource.com/c/chromium/src/+/6906096 * Inline implementation of SysColorChangeListener into the lone user. https://chromium-review.googlesource.com/c/chromium/src/+/6905083 Also 6906096: Remove GetSysSkColor(). | https://chromium-review.googlesource.com/c/chromium/src/+/6906096 * fixup: 6906096: Remove GetSysSkColor() --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> | 1 年前 | |
feat: add save/restore window state API (#51510) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test * feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: clear and restore window state (#47781) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: restore window state * feat: flush display modes on show * refactor: move utility functions to common area * feat: clear window state * fix: wait for the prefs to update * test: clearWindowState extra test * test: refine clear window state tests * test: single monitor restore window tests chore: rebase on gsoc-2025 * refactor: refine clearWindowState test * fix: revert default_app back to original * docs: add comment linking AdjustBoundsToBeVisibleOnDisplay to Chromium code * fix: add correct permalink * refactor: ci friendly * fix: disable windowStatePersistence when no display * refactor: use reference instead pointer * fix: skip window state persistence for invalid/fake displays * refactor: better flag placement * test: add test to verify window state is not saved when no display * fix: restore display mode inside show() * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: clear sharedUserPath before and test * refactor: hasInvalidDisplay function * debug: add display info logging for CI * fix: do not save/restore when window is 0x0 * test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test * feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: remove invalid display test --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> * test: multi monitor tests for save/restore window state (#48048) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: restore window state * feat: flush display modes on show * refactor: move utility functions to common area * feat: clear window state * fix: wait for the prefs to update * test: clearWindowState extra test * test: refine clear window state tests * test: single monitor restore window tests chore: rebase on gsoc-2025 * refactor: refine clearWindowState test * fix: revert default_app back to original * docs: add comment linking AdjustBoundsToBeVisibleOnDisplay to Chromium code * fix: add correct permalink * refactor: ci friendly * fix: disable windowStatePersistence when no display * refactor: use reference instead pointer * fix: skip window state persistence for invalid/fake displays * refactor: better flag placement * test: add test to verify window state is not saved when no display * fix: restore display mode inside show() * feat: support for multimonitor tests * fix: update yarn.lock file * feat: support any resolution for new displays * feat: support display positioning * docs: multi-monitor tests * test: remove dummy test * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: clear sharedUserPath before and test * refactor: hasInvalidDisplay function * debug: add display info logging for CI * fix: do not save/restore when window is 0x0 * test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test * fix: native-addon forceCleanup * docs: add forceCleanup description * test: add two basic multi-monitor tests * fix: find the closest display for non-overlapping saved bounds * test: windowStatePersistence multi-monitor tests * docs: add note on display APIs in CI * fix: remove duplicate destroy registration * feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * docs: remove inaccurate comment * fix: move expect blocks outside beforeEach * test: exclude macOS-x64 for now * test: remove invalid display test * test: remove invalid display test * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test * feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: clear and restore window state (#47781) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: restore window state * feat: flush display modes on show * refactor: move utility functions to common area * feat: clear window state * fix: wait for the prefs to update * test: clearWindowState extra test * test: refine clear window state tests * test: single monitor restore window tests chore: rebase on gsoc-2025 * refactor: refine clearWindowState test * fix: revert default_app back to original * docs: add comment linking AdjustBoundsToBeVisibleOnDisplay to Chromium code * fix: add correct permalink * refactor: ci friendly * fix: disable windowStatePersistence when no display * refactor: use reference instead pointer * fix: skip window state persistence for invalid/fake displays * refactor: better flag placement * test: add test to verify window state is not saved when no display * fix: restore display mode inside show() * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: clear sharedUserPath before and test * refactor: hasInvalidDisplay function * debug: add display info logging for CI * fix: do not save/restore when window is 0x0 * test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test * feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: remove invalid display test --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> * feat: add 'restored-persisted-state' event to BaseWindow (#50516) * docs: add note on display APIs in CI * docs: remove inaccurate comment * test: set show to true * docs: restored-window-state event * feat: add 'restored-window-state' event to BaseWindow * test: add tests for 'restored-window-state' event emission * test: move createWindowAndSave * docs: differentiate between name and title * test: add checks for virtual display creation * docs: tutorial for windowStatePersistence * fix: ensure only single display before multi monitor tests * docs: better docs for virtual display addon * docs: better docs for virtual display addon * refactor: rename event restored-window-state to restored-persisted-state * refactor: rename BaseWindow.clearWindowState to clearPersistedState * docs: improve docs for name property and fix typos * build: run yarn install * fix: update base::Value::Dict -> base::DictValue * fix: add install script to virtual-display native addon The virtual-display fixture was missing an "install" script, so node-gyp never compiled it during `yarn install`. This caused "Cannot find module '../build/Release/virtual_display.node'" in CI. Also removed unused dependencies (bindings, @types/jest, node-gyp) to match the pattern of other native addon fixtures. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> --------- Co-authored-by: Nilay Arya <nilay2014@gmail.com> Co-authored-by: Claude <svc-devxp-claude@slack-corp.com> * chore: fixup yarn.lock, lint * chore: fix build errors after rebase onto main Remove stale `#include "shell/browser/native_window_features.h"` (header was deleted in #51160) and add the required `animate` parameter to the `SetBounds` call in `RestoreBounds` (signature changed on main). * fix: rewrite virtual-display addon in Objective-C, removing Swift dependency The CI runner's Xcode 16.4 has a broken Swift toolchain where swift-frontend cannot load lib_CompilerSwiftIDEUtils.dylib. Since the addon only uses CoreGraphics private C/ObjC APIs (CGVirtualDisplay, CGVirtualDisplayDescriptor, etc.), rewrite the implementation entirely in Objective-C to eliminate the Swift compilation step. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * chore: remove nut-js dependent tests * test: fix macos display tests * Update docs/api/base-window.md Co-authored-by: Sam Maddock <samuelmaddock@electronjs.org> * Update docs/tutorial/window-state-persistence.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * Update docs/tutorial/window-state-persistence.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: defer is_being_restored reset and persisted-state-restored to display-mode callback Resetting is_being_restored_ synchronously at the end of RestoreWindowState let the deferred display-mode callback (kiosk/fullscreen/maximize) fire from Show() with the flag already false, so the resize/move events it produced scheduled DebouncedSaveWindowState and persisted transitional bounds over the user's saved bounds. Also rename the BaseWindow event to persisted-state-restored consistently across the C++ emit, tutorial, and spec, and move the 25s busy-loop spec into a spawned Electron fixture so the spec runner main thread isn't blocked. * test: bump main-thread-busy spec timeout to 60s Spawned Electron fixture sleeps 25s plus startup, exceeding mocha's 30s default. * fix: emit persisted-state-restored synchronously, not in deferred callback The previous fix moved NotifyWindowStateRestored() into the deferred display-mode callback to keep it ordered after the kiosk/fullscreen/ maximize change. But that callback only fires from Show() via FlushPendingDisplayMode(), so windows constructed with show: false (and restore_display_mode_ true, which is the default) never emitted the event - including the spec coverage. Restore the synchronous emit and keep the is_being_restored_ deferral, since only the flag reset needs to straddle the deferred resize/move events that schedule DebouncedSaveWindowState. * fix: tie window-state restore guard to display-mode transition lifecycle The is_being_restored_ guard was reset on the deferred display-mode callback invocation rather than the actual restoration lifecycle, which caused three defects: 1. A window created with show:false and destroyed before show() left the guard stuck true, so the close-time FlushWindowState save no-op'd and state changes made while hidden were dropped. 2. showInactive() never flushed the deferred display mode, so a persisted hidden window shown inactive did not re-apply saved fullscreen/ maximize/kiosk and left the guard stuck true. 3. On macOS the guard was reset synchronously after the async SetFullScreen/Maximize/SetKiosk calls, so a flush during the transition persisted transitional bounds over the saved state. Reset the guard from the NotifyWindowEnterFullScreen/NotifyWindowMaximize observers once the transition completes, drain a never-run callback in FlushWindowState, flush the pending display mode from ShowInactive on both backends, and skip saves while a fullscreen transition is in flight. --------- Co-authored-by: Nilay Arya <84241885+nilayarya@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Nilay Arya <nilay2014@gmail.com> Co-authored-by: Claude <svc-devxp-claude@slack-corp.com> Co-authored-by: George Xu <33054982+georgexu99@users.noreply.github.com> Co-authored-by: Sam Maddock <samuelmaddock@electronjs.org> Co-authored-by: George Xu <george.xu@slack-corp.com> | 3 个月前 | |
refactor: run sandboxed preload scripts without an Electron JavaScript bundle (#53974) Sandboxed renderers and service worker preload realms ran a webpack bundle (sandbox_bundle / preload_realm_bundle) that built the preload scripts' `process` object and `require`, assembled the `electron` module from the JavaScript API wrappers, registered the <webview> element and then compiled and ran each preload script. With the API modules now provided by their bindings, the rest moves to C++ (shell/renderer/preload_environment.cc): - `process` is a native EventEmitter carrying the same properties as before, plus getProcessMemoryInfo(); 'loaded', 'exit', 'document-start' and 'document-end' are emitted on it directly. - `require('electron')` returns a module object whose properties load their binding on first access. - Preload scripts are compiled with CreatePreloadScript() and called with (require, process, exports, module, global); failures are logged and reported as 'preload-error' as before. The only JavaScript Electron still evaluates in a sandboxed renderer is the <webview> element implementation, now its own `webview_bundle`, and only in renderers that enable `webviewTag`. The `process` npm polyfill is no longer needed. | 1 个月前 | |
feat: use Downloads folder as default path for file dialogs (#49868) * fix: use Downloads folder as default path for file dialogs Co-authored-by: Sourav Bera <sbera987654321@gmail.com> * chore: improve breaking change description --------- Co-authored-by: Sourav Bera <sbera987654321@gmail.com> | 6 个月前 | |
feat: use Downloads folder as default path for file dialogs (#49868) * fix: use Downloads folder as default path for file dialogs Co-authored-by: Sourav Bera <sbera987654321@gmail.com> * chore: improve breaking change description --------- Co-authored-by: Sourav Bera <sbera987654321@gmail.com> | 6 个月前 | |
chore: bump chromium to 157.0.8085.0 (main) (#54590) * chore: bump chromium in DEPS to 157.0.8079.0 * chore: update patches * 8426044: Deduplicate notifications for find-in-page Upstream removed WebContentsDelegate::FindReply() in favor of WebContentsObserver::DidReceiveFindReply(). Moved Electron's found-in-page handling from the delegate forwarder to the observer forwarder on the NativeLifecycle peer. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8426044 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8471431: siso: don't include optional LLVM tools in clang inputs https://crrev.com/c/8471431 narrowed the third_party/llvm-build/Release+Asserts:headers filegroup glob from bin/clang-* to bin/clang-cl, bin/clang-cl.exe and bin/clang-[0-9]*. siso uploads that filegroup as a precomputed subtree and drops other inputs under it, so bin/clang-tidy no longer reached the RBE workers and the clang-tidy steps failed with exit 127. build-tools now adds bin/clang-tidy back to that filegroup: https://github.com/electron/build-tools/pull/910 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8471431 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V38FjDEdZgMvFpf5Fmp65m * chore: bump chromium in DEPS to 157.0.8081.0 * 8469895: [VideoCapture] Remove unsafe lifetime assumptions in InProcessVideoCaptureDeviceLauncher Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8469895 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8261571: dbus: Let desktop Linux end the session instead of crashing when a bus is lost Upstream landed Bus::Options::disconnected_callback and a reworked dbus_thread_linux that takes the embedder's callback via Initialize(), which supersedes both the backport patch and the downstream SetDisconnectedCallback() shim. Removed both patches and switched ElectronBrowserMainParts to dbus_thread_linux::Initialize(). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8261571 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8470272: [find-in-page] Fix endless frame traversal around an inner WebContents Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8470272 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: update patches * 8424588: [mojo] (Mostly) ban untyped `handle` use TakeHeapSnapshot now takes handle<platform>, so the browser passes the mojo::PlatformHandle directly and the renderer receives it without unwrapping. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8424588 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8465643: Forward proxy auth for requests without login prompts Plumb the new do_not_prompt_for_login flag through URLLoaderNetworkObserver, SimpleURLLoaderClient and CreateLoginDelegate. Electron keeps routing these challenges to the 'login' event, which is its non-UI credential source, mirroring how Chrome still consults extensions for them. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8465643 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8422739: Enforce cross-origin access control in WebUIURLLoaderFactory CreateWebUIURLLoaderFactory now requires a request initiator origin lock. Pass the frame's initiator origin that content already hands to RegisterNonNetworkSubresourceURLLoaderFactories; the lock only gates chrome-untrusted:// initiators, so component extensions keep their access to chrome://resources. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8422739 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: bump chromium in DEPS to 157.0.8083.0 * 8497008: CATransaction: Clean up old flags Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8497008 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8499815: Ruff: reformat third_party/blink. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8499815 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8455902: gin: Mark Invoker as stack allocated and drop raw_ptr for its Arguments Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8455902 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: update patches * 8469168: Change DataPipeGetter::Read to return result as base::expected Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8469168 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8480632: Ignore stale UpdateDragOperation replies from non-current RWH on Android Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8480632 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: bump chromium in DEPS to 157.0.8085.0 * chore: update patches * 8463605: [Clear-Site-Data] Prevent cross-site fetch clearing unpartitioned data Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8463605 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8448270: [Linux] Support XDG NetworkMonitor portal in NetworkChangeNotifierLinux The browser process now opens a private session bus for the portal, with no Bus::Options::disconnected_callback, so it aborts when the session bus is lost. That is what fails "when a D-Bus bus goes away > exits cleanly instead of crashing" on Linux. Carry the upstream fix until it rolls in. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8448270 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8512441#nolint * 8465423: Use C++20 std::numbers::pi in blink Backport the upstream fix for Windows math constants. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8465423 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8510323#nolint * 8489251: Exit tab fullscreen when the held-Esc timer fires under keyboard lock Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8489251 * 8366647: [snapshot] Optional SHA256 code cache source hashing Ref: https://chromium-review.googlesource.com/c/v8/v8/+/8366647 * fix: disable V8 metagen feature Refs https://issues.chromium.org/issues/531344950 Skip-Lint: General feature disablement, no specific to a particular CL. * 8503816: Enable AperitifHelpers by default Disable AperitifHelpers on macOS until Electron adopts the new helpers. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8503816 * build: pin build-tools to merged siso clang-tidy fix electron/build-tools#910 squash-merged as 32e2253f7c5696d85a77fe19d54d284cf9a62322; re-pin from the PR branch commit a411ee5 so CI no longer depends on the deleted branch. Skip-Lint: build-tools pin, not a Chromium CL adaptation Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V38FjDEdZgMvFpf5Fmp65m --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: electron-claude[bot] <279139701+electron-claude[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> | 12 天前 | |
fix: enable blink gc plugin (#50465) chore: address blink gc plugin errors Key fixes: - Replace `base::WeakPtrFactory` with `gin::WeakCellFactory` in MenuMac, MenuViews, and NetLog, since weak pointers to cppgc-managed objects must go through weak cells - Replace `v8::Global<v8::Value>` with `cppgc::Persistent<Menu>` for the menu reference in BaseWindow - Stop using `gin_helper::Handle<T>` with cppgc types; use raw `T*` and add a `static_assert` to prevent future misuse - Add proper `Trace()` overrides for Menu, MenuMac, MenuViews, and NetLog to ensure cppgc members are visited during garbage collection - Replace `SelfKeepAlive` prevent-GC mechanism in Menu with a `cppgc::Persistent` prevent-GC captured in `BindSelfToClosure` - Introduce `GC_PLUGIN_IGNORE` macro to suppress known-safe violations: mojo::Remote fields, ObjC bridging pointers, and intentional persistent self-references - Mark `ArgumentHolder` as `CPPGC_STACK_ALLOCATED()` in both Electron's and gin's function_template.h to silence raw-pointer-to-GC-type warnings | 6 个月前 | |
refactor: use `base::as_bytes()` in `WriteAsciiChunk()` (#45724) refactor: use base::as_bytes() in WriteAsciiChunk() this avoids a reinterpret_cast and a static_cast | 1 年前 | |
chore: add ELECTRON_ prefix to C++ include guards (#31925) | 4 年前 | |
test: rename spec files from -spec.ts to .spec.ts (#54258) * test: rename spec files from -spec.ts to .spec.ts Renames every spec/*-spec.ts file to spec/*.spec.ts and updates the mocha file filter in spec/index.js, the glob in script/split-tests.js, script/spec-weights.json, the macOS and Wayland spec allowlists, and comments/docs that refer to spec files by name, so mocha and CI shard splitting still pick up every spec file. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EoGAobkKTt7KNqEiajK2Gm * test: fail spec runs on files still named -spec.ts The spec runner only loads *.spec.ts, so a spec file still named *-spec.ts (for example from a PR opened before the rename) would silently never run. spec/index.js now throws before mocha starts if one is present in spec/, so the test jobs go red instead. This is a temporary guard for the transition. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EoGAobkKTt7KNqEiajK2Gm --------- Co-authored-by: Claude <noreply@anthropic.com> | 26 天前 | |
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 | 1 年前 | |
refactor: remove unused `#include "third_party/..."` calls (#52642) * refactor: remove unused `#include "third_party/..."` * chore: iwyu electron/buildflags/buildflags.h * refactor: remove unused `#include "third_party/..."` in .cc, .mm | 2 个月前 | |
chore: migrate base::StringPiece to std::string_view (#40915) * chore: migrate from base::StringPiece to std::string_view in keyboard_util.cc * chore: migrate from base::StringPiece to std::string_view in error_thrower.cc * chore: migrate from base::StringPiece to std::string_view in electron_api_web_contents.cc * chore: migrate from base::StringPiece to std::string_view in gin_helper/dictionary.h * chore: migrate from base::StringPiece to std::string_view in electron_api_url_loader.cc * chore: phase out internal use of base:::StringPiece `base::StringPiece` is being phased out upstream. Its code has been removed upstream and it's just a typedef for `std::string_view`. They haven't removed the typedef yet, so this PR tries to get ahead of future breakage by migrating "internal" use (i.e. leaving alone the places where the `base::StringPiece` name is coming from an upstream method that we override). Xref: https://bugs.chromium.org/p/chromium/issues/detail?id=691162 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4294483 Xref: https://docs.google.com/document/d/1d4RnD1uAE2t4iANR0nXy82ASIPGsPuw2mpO6v6T7JKs | 2 年前 | |
chore: add ELECTRON_ prefix to C++ include guards (#31925) | 4 年前 | |
chore: bump chromium to 137.0.7128.1 (main) (#46482) * chore: bump chromium in DEPS to 137.0.7107.0 * chore: bump chromium in DEPS to 137.0.7109.0 * chore: bump chromium in DEPS to 137.0.7111.0 * chore: bump chromium in DEPS to 137.0.7113.0 * 6384240: Remove double-declaration for accessibility on macOS | https://chromium-review.googlesource.com/c/chromium/src/+/6384240 * 6422872: Remove unused includes in isolation_info_mojom_traits.h | https://chromium-review.googlesource.com/c/chromium/src/+/6422872 * chore: update patches * 6400733: Avoid ipc_message_macros.h usage in some foo_param_traits_macros.h files | https://chromium-review.googlesource.com/c/chromium/src/+/6400733 * chore: update patches * 6423410: Enable unsafe buffer warnings for chromium, try #3. | https://chromium-review.googlesource.com/c/chromium/src/+/6423410 * chore: iwyu * refactor: prefer value initialization over memset() From the looks up upstream commits in base/, it looks like memset() could trigger `-Wunsafe-buffer-usage` warnings soon? Value initialization is more C++ish and less error-prone anyway, due to memset()'s easily swappable parameters. * refactor: NotifyIcon::InitIconData() returns a NOTIFYICONDATA This follows F.20 in the C++ Core Guidelines and also removes the need for memset() * 6423410: Enable unsafe buffer warnings for chromium, try #3. | https://chromium-review.googlesource.com/c/chromium/src/+/6423410 remove all uses of: - strcmp() * fixup! 6423410: Enable unsafe buffer warnings for chromium, try #3. | https://chromium-review.googlesource.com/c/chromium/src/+/6423410 * 6433203: Add a PassKey to RegisterDeleteDelegateCallback(). | https://chromium-review.googlesource.com/c/chromium/src/+/6433203 * chore: bump chromium in DEPS to 137.0.7115.0 * 6387077: [PermissionOptions] Generalize PermissionRequestDescription | https://chromium-review.googlesource.com/c/chromium/src/+/6387077 * chore: update patches * 6387077: [PermissionOptions] Generalize PermissionRequestDescription | https://chromium-review.googlesource.com/c/chromium/src/+/6387077 * fix: add pragma for MacSDK unsafe buffers | 6423410: Enable unsafe buffer warnings for chromium, try #3. | https://chromium-review.googlesource.com/c/chromium/src/+/6423410 * chore: bump chromium in DEPS to 137.0.7117.0 * chore: update patches * chore: update filesnames.libcxx.gni * 6431756: Replace SetOwnedByWidget() bool arg with a PassKey. | https://chromium-review.googlesource.com/c/chromium/src/+/6431756 * 6387077: [PermissionOptions] Generalize PermissionRequestDescription | https://chromium-review.googlesource.com/c/chromium/src/+/6387077 * 6428345: Remove ExtensionService usage from ChromeExtensionRegistrarDelegate | https://chromium-review.googlesource.com/c/chromium/src/+/6428345 * 6384315: Migrate extensions_enabled from ExtensionService to Registrar | https://chromium-review.googlesource.com/c/chromium/src/+/6384315 * 6428749: [extensions] Refactor ExtensionService for AddNewAndUpdateExtension. | https://chromium-review.googlesource.com/c/chromium/src/+/6428749 * chore: bump chromium in DEPS to 137.0.7119.0 * 6440290: corner-shape: support inset shadow | https://chromium-review.googlesource.com/c/chromium/src/+/6440290 * 6429230: FSA: Move blocked paths to the PermissionContext class | https://chromium-review.googlesource.com/c/chromium/src/+/6429230 * chore: update patches * chore: bump chromium in DEPS to 137.0.7121.0 * chore: update patches * fix: partially revert 6443473: Remove ItemDelete from the Mac version of AppleKeychain | https://chromium-review.googlesource.com/c/chromium/src/+/6443473 * fix: update filenames.libcxx.gni * chore: bump chromium in DEPS to 137.0.7123.0 * chore: update patches * chore: "grandfather in" electron views too Lock further access to View::set_owned_by_client() | https://chromium-review.googlesource.com/c/chromium/src/+/6448510 * chore: update feat_corner_smoothing_css_rule_and_blink_painting.patch corner-shape: support inset shadow | https://chromium-review.googlesource.com/c/chromium/src/+/6440290 * refactor: grandfather in AutofillPopupView as a subclass of WidgetDelegateView Add a PassKey for std::make_unique<WidgetDelegateView>() | https://chromium-review.googlesource.com/c/chromium/src/+/6442265 * Provide dbus appmenu information on Wayland | https://chromium-review.googlesource.com/c/chromium/src/+/6405535 * [extensions] Move OnExtensionInstalled out of ExtensionService. | https://chromium-review.googlesource.com/c/chromium/src/+/6443325 * refactor: grandfather in NativeWindowViews for delete callbacks 6433203: Add a PassKey to RegisterDeleteDelegateCallback(). | https://chromium-review.googlesource.com/c/chromium/src/+/6433203 * chore: merge the four "grandfather" patches into one * [A11yPerformance] Remove IsAccessibilityAllowed() | 6404386: [A11yPerformance] Remove IsAccessibilityAllowed() | https://chromium-review.googlesource.com/c/chromium/src/+/6404386 NB: the changes here are copied from the upstream changes in chrome/browser/ui/webui/accessibility/accessibility_ui.cc * 6420753: [PermissionOptions] Use PermissionDescriptorPtr in PermissionController | https://chromium-review.googlesource.com/c/chromium/src/+/6420753 * 6429573: [accessibility] Move mode change out of AccessibilityNotificationWaiter | https://chromium-review.googlesource.com/c/chromium/src/+/6429573 * chore: e patches all * 6419936: [win] Change ScreenWin public static methods to virtual | https://chromium-review.googlesource.com/c/chromium/src/+/6419936 * 6423410: Enable unsafe buffer warnings for chromium, try #3. | https://chromium-review.googlesource.com/c/chromium/src/+/6423410 remove all uses of: - fprintf() - fputs() - snprintf() - vsnprintf() * fix: size conversion FTBFS on Win * 6423410: Enable unsafe buffer warnings for chromium, try #3. | https://chromium-review.googlesource.com/c/chromium/src/+/6423410 remove all uses of: - wcscpy_s() * 6423410: Enable unsafe buffer warnings for chromium, try #3. | https://chromium-review.googlesource.com/c/chromium/src/+/6423410 remove all uses of: - wcsncpy_s() * chore: update mas_avoid_private_macos_api_usage.patch.patch 6394283: Remove double-declaration for accessibility on iOS | https://chromium-review.googlesource.com/c/chromium/src/+/6394283 Lots of context shear in this commit but the only interesting part is: -+ return nullptr; ++ return {}; Which is needed because the return type is sometimes not a pointer. * chore: e patches all * chore: disable -Wmacro-redefined warning in electron_main_win.cc * chore: bump chromium in DEPS to 137.0.7123.5 * refactor: patch electron PermissionTypes into blink 6387077: [PermissionOptions] Generalize PermissionRequestDescription | https://chromium-review.googlesource.com/c/chromium/src/+/6387077 * chore: e patches all * chore: remove the box_painter_base.cc part of feat_corner_smoothing_css_rule_and_blink_painting.patch as per code review @ https://github.com/electron/electron/pull/46482#pullrequestreview-2777338370 * test: enable window-smaller-than-64x64 test on Linux * chore: bump chromium in DEPS to 137.0.7124.1 * chore: bump chromium in DEPS to 137.0.7125.1 * chore: bump chromium in DEPS to 137.0.7127.3 * 6459201: [Extensions] Remove ExtensionSystem::FinishDelayedInstallationIfReady() | https://chromium-review.googlesource.com/c/chromium/src/+/6459201 * 6454796: [Extensions] Move (most) registrar delayed install logic to //extensions | https://chromium-review.googlesource.com/c/chromium/src/+/6454796 * chore: bump chromium in DEPS to 137.0.7128.1 * chore: e patches all * chore: node ./script/gen-libc++-filenames.js * [views] Gate DesktopWindowTreeHostWin::window_enlargement_ behind flag Refs https://chromium-review.googlesource.com/c/chromium/src/+/6428649 * feat: allow opt-out animated_content_sampler. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6438681 * Trigger CI --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> | 1 年前 | |
fix: respect system language preferences on Win/macOS (#23247) This commit fixes https://github.com/electron/electron/issues/18829 Previously the full preferences set to OS was not given to Chromium. Also, this commit improves fallback font selection for CJK text. Chromium uses browser languages to determine fallback fonts on Windows, especially kanji/han characters in CJK. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language was given to Accept-Language on Electron. This patch is based on https://github.com/electron/electron/pull/15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> | 6 年前 | |
chore: bump chromium to 155.0.8046.0 (main) (#53427) * chore: bump chromium in DEPS to 155.0.8039.0 * chore: bump chromium in DEPS to 155.0.8040.0 * 8158519: Reland "Fix offset contours for concave corners" Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8158519 Co-Authored-By: GitHub Copilot <copilot@github.com> * 8246240: views: Fix UAF in MenuController and simplify teardown Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8246240 Co-Authored-By: GitHub Copilot <copilot@github.com> * 8223163: [dcheck-to-check] Convert DCHECKs in content/browser/ [10/n] Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8223163 Co-Authored-By: GitHub Copilot <copilot@github.com> * chore: update patches * 8290608: Move update-rename tasks earlier in startup Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8290608 Co-Authored-By: GitHub Copilot <copilot@github.com> * chore: bump chromium in DEPS to 155.0.8042.0 * chore: bump chromium in DEPS to 155.0.8043.0 * chore: bump chromium in DEPS to 155.0.8044.0 * chore: bump chromium in DEPS to 155.0.8046.0 * chore: update siso revision * 8298520: [ExtensionTracker] Keep track of extension ids Upstream replaced the trailing `bool is_injected_extension_script` parameter of WebLocalFrame/LocalFrame::RequestExecuteScript and PausableScriptExecutor with `const String& script_injector_id`. Keep the Electron `raw_callback` parameter ahead of the new trailing parameter and update Electron's callers in electron_api_web_frame.cc to pass an empty WebString. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8298520 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8340629: [dcheck-to-check] Convert DCHECKs in content/browser/ [21/n] Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8340629 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: update patches * 8336255: [api] Remove non-CppGC v8::MicrotaskQueue implementation V8 removed the v8_cppgc_microtask_queue GN arg and the V8_CPPGC_MICROTASK_QUEUE define; v8::MicrotaskQueue is now always CppGC-managed and MicrotaskQueue::New() only returns a raw pointer. Drop the flag plumbing from BUILD.gn and generate-config-gypi.py, make the Node.js contextify code use the CppGC form unconditionally in v8_prepare_for_migrating_v8_microtaskqueue_to_cppgc.patch, and remove v8_propagate_v8_cppgc_microtask_queue_flag_to_common_gypi.patch since native addons no longer need a define to match the V8 ABI. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/8336255 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8342150: Change GetProductInfo_ExportThunk to use trivially constructable param Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8342150 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8354524: [Extensions] Move dynamic resource handling to ExtensionConfigProvider ExtensionURLLoader now asks the extension's ExtensionConfigProvider for dynamic resources such as strings.m.js directly, so the IsDynamicComponentExtensionResource and GetDynamicResourceContent overrides no longer exist on ComponentExtensionResourceManager. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8354524 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8310116: Make fontconfig global config creation synchronous gfx::InitializeGlobalFontConfigAsync() was removed; fontconfig is now initialized synchronously on first use, so drop the eager call. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8310116 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8341194: Improve Reporting API crash reason attribution for hung renderers Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8341194 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8362702: [deps] Remove Rollup, Terser, and associated dependencies Refs https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/8362702 * 8283010: SeparateRendererBinary: Remove GetChildProcessSuffix on macOS Refs https://chromium-review.googlesource.com/c/chromium/src/+/8283010 Assisted-by: GPT-6 Astra * 8312453: Move windows i18n code into base:i18n target Refs https://chromium-review.googlesource.com/c/chromium/src/+/8312453 * 8313832: Use LanguageTag for preferred languages in windows Refs https://chromium-review.googlesource.com/c/chromium/src/+/8313832 * fixup! 8313832: Use LanguageTag for preferred languages in windows Refs https://chromium-review.googlesource.com/c/chromium/src/+/8313832 * chore: remove empty patches directory Skip-Lint: Merge left this directory empty * fixup! chore: remove empty patches directory Skip-Lint: Forgot to remove the config --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: GitHub Copilot <copilot@github.com> Co-authored-by: electron-claude[bot] <279139701+electron-claude[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> | 1 个月前 | |
ci: send child-process logging to a file on the Windows test legs (#54356) * ci: send child-process logging to a file on the Windows test legs Child processes cannot write to the test runner's stderr pipe on Windows; with plain --enable-logging each of them fails AttachConsole() and AllocConsole()s its own window, which lands on top of the desktop and can occlude the windows the specs create. Run the Windows legs with --enable-logging=file so children log through an inherited handle, and let testing builds honour ELECTRON_ALSO_LOG_TO_STDERR (previously debug builds only) so the main process keeps logging to the job output. The log files are uploaded with the test artifacts; reruns get their own file. * test: drop the stderr mirror spec | 25 天前 | |
chore: add ELECTRON_ prefix to C++ include guards (#31925) | 4 年前 | |
chore: bump node to v24.22.0 (main) (#55006) * chore: bump node in DEPS to v24.22.0 * fix(patch): enable the V8 sandbox in shared-cage builds Upstream now enables the V8 sandbox only for shared-cage builds. Keep Electron's behaviour of enabling it whenever pointer compression is on, matching Chromium's V8. The unofficial.gni x86 hunk landed upstream. Ref: https://github.com/nodejs/node/pull/62237 Ref: https://github.com/nodejs/node/pull/65491 * fix(patch): use names for asymmetric key algorithms Upstream dropped the BoringSSL guard in DhKeyGenTraits::Setup(), removed ReadASN1Element() from ncrypto, and no longer includes <openssl/evp.h> from env.h, so those hunks are no longer needed. Ref: https://github.com/nodejs/node/pull/65966 Ref: https://github.com/nodejs/node/pull/66108 Ref: https://github.com/nodejs/node/pull/65484 * fix(patch): skip RSA-PSS keygen deprecation tests with BoringSSL The skip is now upstream. Ref: https://github.com/nodejs/node/pull/65808 * fix(patch): detach cppgc wrappers from their Realm before it is freed Upstream's CppgcWrapperList::Cleanup() now pops nodes itself and the wrapper owns and frees its list node, so the local PopFront/delete hunk is dropped. Ref: https://github.com/nodejs/node/pull/65778 * fix(patch): gate jspi flag on V8_ENABLE_WEBASSEMBLY Ref: https://github.com/nodejs/node/pull/66082 * chore: remove upstreamed patches - https://github.com/nodejs/node/pull/63985 - https://github.com/nodejs/node/pull/65630 - https://github.com/nodejs/node/pull/64453 - https://github.com/nodejs/node/pull/65778 * chore: update patches (trivial only) * chore: update filenames.auto.gni * fix(patch): discover hashes from OpenSSL providers ncrypto's DigestCache::aliases() now has a function-local static, so ncrypto needs the no_exit_time_destructors config too. Ref: https://github.com/nodejs/node/pull/65484 * fix(patch): read the peer certificate chain without consuming it sk_X509_num() returns size_t in BoringSSL. Ref: https://github.com/nodejs/node/pull/65602 * fix(patch): fix shared buffer growability validation Ref: https://github.com/nodejs/node/pull/65845 * chore: update patches (trivial only) * node#65820: src: fix null pointer call when running without a startup snapshot SnapshotData::AsEmbedderWrapper() was removed. Both call sites wrap the embedded snapshot, so use EmbedderSnapshotData::BuiltinSnapshotData(). Ref: https://github.com/nodejs/node/pull/65820 * node#65407: src: apply IsolateSettings when using a snapshot node::CreateEnvironment() no longer installs the per-isolate message listener when it builds the environment from a snapshot, so stop compensating for that and let SetIsolateUpForNode() add it. Ref: https://github.com/nodejs/node/pull/65407 * test: drop removed wasm rab integration flag from webidl buffer source test Chromium's V8 removed --experimental-wasm-rab-integration after shipping it; the new test-internal-webidl-buffer-source.js passes it. Ref: https://github.com/nodejs/node/pull/65845 Ref: https://chromium-review.googlesource.com/c/v8/v8/+/7708297 * test: skip new rmSync permission error test when the Node suite runs as root test-fs-rmSync-special-char-additional-error.js is new in v24.22.0 and relies on a read-only directory blocking removal, which root bypasses; the Linux Node.js test job runs as root. Ref: https://github.com/nodejs/node/pull/64453 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Sam Attard <sattard@anthropic.com> | 4 天前 | |
build: enable dangling raw_ptr checks (#54619) * fix: clear vibrancy view before destruction Keep the removed NativeViewHost alive until vibrant_native_view_host_ has been cleared. Memory was freed at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8ea86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012b996bcc void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)8>(void*) + 5392 4 Electron Framework 0x00000001335fe8f4 views::NativeViewHost::~NativeViewHost() + 16 5 Electron Framework 0x0000000124916004 ___ZN8electron15NativeWindowMac11SetVibrancyERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi_block_invoke + 140 6 Electron Framework 0x0000000124915a74 electron::NativeWindowMac::SetVibrancy(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, int) + 1048 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8eb158 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)1, (base::features::DanglingPtrType)0>(unsigned long) + 92 3 Electron Framework 0x000000012b93c3b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x0000000124916058 ___ZN8electron15NativeWindowMac11SetVibrancyERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi_block_invoke + 224 5 Electron Framework 0x0000000124915a74 electron::NativeWindowMac::SetVibrancy(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, int) + 1048 * fix: clear notification delegate before callback Release delegate_ before NotificationDestroyed() can synchronously delete the delegate. Memory was freed at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8ea86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012b9aa080 void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 5928 4 Electron Framework 0x000000012b99f940 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 1324 5 Electron Framework 0x000000012b9c3a50 allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)6>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x00000001247f797c electron::Notification::~Notification() + 72 7 Electron Framework 0x0000000124919fbc electron::CocoaNotification::~CocoaNotification() + 220 8 Electron Framework 0x000000012491a014 electron::CocoaNotification::~CocoaNotification() + 12 9 Electron Framework 0x00000001247f81cc electron::NotificationPresenter::RemoveNotification(electron::Notification*) + 200 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012b8e4940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012b8cfa00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x000000012b8eb158 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)1, (base::features::DanglingPtrType)0>(unsigned long) + 92 3 Electron Framework 0x000000012b93c3b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x00000001247f7a50 electron::Notification::~Notification() + 284 5 Electron Framework 0x0000000124919fbc electron::CocoaNotification::~CocoaNotification() + 220 6 Electron Framework 0x000000012491a014 electron::CocoaNotification::~CocoaNotification() + 12 7 Electron Framework 0x00000001247f81cc electron::NotificationPresenter::RemoveNotification(electron::Notification*) + 200 * fix: erase notifications before destruction Remove each raw_ptr from notifications_ before deleting the Notification it references. Memory was freed at: 0 Electron Framework 0x000000012cacd6e0 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012cab6968 base::debug::StackTrace::StackTrace(unsigned long) + 168 2 Electron Framework 0x000000012cad3a24 base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x000000012cbbb9ac void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 5868 4 Electron Framework 0x000000012cbb1264 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)22>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)22)>::Type) + 1324 5 Electron Framework 0x000000012cbd522c allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)6>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x00000001258ed394 electron::NotificationPresenter::~NotificationPresenter() + 72 7 Electron Framework 0x0000000125a0ee60 electron::NotificationPresenterMac::~NotificationPresenterMac() + 356 8 Electron Framework 0x0000000125a0ef00 electron::NotificationPresenterMac::~NotificationPresenterMac() + 12 9 Electron Framework 0x0000000125868dfc electron::ElectronBrowserClient::~ElectronBrowserClient() + 500 The dangling raw_ptr was released at: 0 Electron Framework 0x000000012cacd6e0 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x000000012cab6968 base::debug::StackTrace::StackTrace(unsigned long) + 168 2 Electron Framework 0x000000012cad3aec void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)0, (base::features::DanglingPtrType)0>(unsigned long) + 84 3 Electron Framework 0x000000012cb27fc8 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x00000001258b87c8 void std::__Cr::__destroy_at[abi:sqn240000]<base::raw_ptr<DraggableRegionProvider, (partition_alloc::internal::RawPtrTraits)0>>(base::raw_ptr<DraggableRegionProvider, (partition_alloc::internal::RawPtrTraits)0>*) + 136 5 Electron Framework 0x00000001258eda14 std::__Cr::__tree<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>, std::__Cr::less<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>>, std::__Cr::allocator<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>>>::__tree_deleter::operator()[abi:sqn240000](std::__Cr::__tree_node<base::raw_ptr<electron::Notification, (partition_alloc::internal::RawPtrTraits)0>, void*>*) + 52 6 Electron Framework 0x00000001258ed3d4 electron::NotificationPresenter::~NotificationPresenter() + 136 7 Electron Framework 0x0000000125a0ee60 electron::NotificationPresenterMac::~NotificationPresenterMac() + 356 8 Electron Framework 0x0000000125a0ef00 electron::NotificationPresenterMac::~NotificationPresenterMac() + 12 9 Electron Framework 0x0000000125868dfc electron::ElectronBrowserClient::~ElectronBrowserClient() + 500 * fix: clear Node environment before teardown Clear NodeBindings::uv_env_ before NodeService releases the node::Environment. Memory was freed at: 0 Electron Framework 0x0000000129b78940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x0000000129b63a00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x0000000129b7e86c base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 764 3 Electron Framework 0x0000000129c3c93c void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)18>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)18)>::Type) + 8480 4 Electron Framework 0x0000000129c33390 void partition_alloc::PartitionRoot::FreeInUnknownRoot<(partition_alloc::internal::FreeFlags)18>(void*, partition_alloc::FreeHint<partition_alloc::internal::FreeFlags partition_alloc::internal::FreeHintFlags<partition_alloc::internal::FreeFlags>(partition_alloc::internal::FreeFlags)((partition_alloc::internal::FreeFlags)18)>::Type) + 1324 5 Electron Framework 0x0000000129c56ce8 allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)2>::FreeWithSize(void*, unsigned long, void*) + 200 6 Electron Framework 0x0000000122c4bd24 node::FreeEnvironment(node::Environment*) + 248 7 Electron Framework 0x0000000122b3a74c _ZNSt4__Cr20__shared_ptr_pointerB9sqn240000IPN4node11EnvironmentEZN8electron12NodeBindings17CreateEnvironmentEPN2v87IsolateENS6_5LocalINS6_7ContextEEEPNS1_20MultiIsolatePlatformEmNS_6vectorINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENSI_ISK_EEEESM_NS_8optionalIN4base17RepeatingCallbackIFvvEEEEEE3$_0NSI_IS2_EEE16__on_zero_sharedEv + 188 8 Electron Framework 0x0000000122b7ee40 electron::NodeService::~NodeService() + 416 9 Electron Framework 0x0000000122b7ef2c electron::NodeService::~NodeService() + 12 The dangling raw_ptr was released at: 0 Electron Framework 0x0000000129b78940 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 24 1 Electron Framework 0x0000000129b63a00 base::debug::StackTrace::StackTrace(unsigned long) + 128 2 Electron Framework 0x0000000129b7e934 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)0, (base::features::DanglingPtrType)0>(unsigned long) + 84 3 Electron Framework 0x0000000129bd03b4 base::internal::RawPtrBackupRefImpl<false>::ReleaseInternal(unsigned long) + 480 4 Electron Framework 0x0000000122b34b94 electron::NodeBindings::~NodeBindings() + 372 5 Electron Framework 0x0000000122bde08c electron::NodeBindingsMac::~NodeBindingsMac() + 12 6 Electron Framework 0x0000000122b7edf8 electron::NodeService::~NodeService() + 344 7 Electron Framework 0x0000000122b7ef2c electron::NodeService::~NodeService() + 12 * fix: enable dangling raw_ptr checks * fix: avoid retaining isolate in PromiseBase Resolve PromiseHandle traced references with the currently entered isolate instead of retaining a raw pointer that can outlive IsolateHolder. Promise operations already require execution on their creation thread with the isolate entered. ``` gin::IsolateHolder::~IsolateHolder -> JavascriptEnvironment::~JavascriptEnvironment -> isolate free static Promise<void> destruction -> PromiseBase::~PromiseBase -> isolate_ raw_ptr release ``` * fix: annotate additional dangling raw pointers * fix(win): annotate additional dangling raw_ptr | 16 天前 | |
fix: illegal access errors when a same-process child window or subframe closes (#52964) * fix: give each renderer Node.js environment its own uv loop Same-process child windows and node-integrated subframes each get a Node.js environment, and until now all of them shared uv_default_loop() on the renderer main thread. Freeing one (FreeEnvironment runs the loop until that environment's handles close, with JavaScript disallowed on the isolate) therefore dispatched the other environments' pending immediates, timers, fs and threadpool callbacks in that window, which threw "Uncaught illegal access" in the surviving page or aborted the renderer (InternalCallbackScope / ToLocalChecked checks). NodeBindings can now integrate a given loop or own a fresh one (as the worker path already did), and the renderer keeps one NodeBindings + ElectronBindings pair per frame environment: the first borrows the process-lifetime uv_default_loop() integration so native modules that use the default loop keep working, later ones own their loop. Tearing an environment down parks that loop's embed thread and frees it without touching anyone else's handles. This also replaces the uv_env hand-off between main-frame environments and the injected-frames bookkeeping with a RenderFrame-keyed map, and gives each new environment its first loop run from a fresh task since child contexts can be created from inside a script. Fixes https://github.com/electron/electron/issues/36858 Fixes https://github.com/electron/electron/issues/40607 * fix: don't stack an error message listener per renderer environment CreateEnvironment adds Electron's V8 message listener for renderer and worker environments, and V8 keeps every listener it is given, so each navigation or child frame added another copy and uncaught errors ran the async-hook cleanup once per environment ever created on the isolate. Remove the previous registration before adding. Also restate why about:blank subframes are skipped for Node.js integration: freeing their environment is no longer a problem, but they commit synchronously in the renderer and so never receive the preload startup data the sandboxed bundle needs. * test: cover child-window loops, opener reloads and napi work across renderer environments Adds an async export to the echo fixture (a libuv threadpool round trip that calls back into JS, the napi path that aborted in InternalCallbackScope when it completed under another environment's context) and uses it to check that same-process child windows, including a synchronously created about:blank one, run immediates, fs and napi work on their own loop, that a child keeps working while its opener reloads, and that the survivor's napi callbacks still arrive when a sibling environment is freed. * test: cover napi thread-safe functions in child window environments A thread-safe function called from another thread reaches JS through a uv_async_t on its environment's loop and an AsyncResource::CallbackScope, so in a same-process child window it used to run under the opener's context and abort in InternalCallbackScope. Give the echo fixture a thread-safe variant and exercise it alongside the async work. Refs https://github.com/electron/electron/issues/33868 * refactor: set the isolate up for Node.js once per isolate Pull the IsolateSettings / SetIsolateUpForNode / host-import-callback block out of NodeBindings::CreateEnvironment into NodeBindings::SetUpIsolate, and call it once from each owner: the renderer client's one-time init, the WebWorkerObserver for its thread's isolate, and the browser and utility processes right after their single CreateEnvironment (node's snapshot path resets the isolate error handlers inside CreateEnvironment, so it has to follow it there). Renderer frames no longer re-run isolate setup or stack a message listener per environment. * fix: only lend uv_default_loop() to main frame environments Subframe environments always get a loop of their own; a main frame borrows the process's uv_default_loop() integration while no other environment holds it, so native modules that use the default loop see a consistent main-frame environment. * fix: free a frame's environment under the explicit microtasks policy Restore the explicit microtasks policy around freeing a frame's Node.js environment (its loop runs during teardown, see #33280), and only tear down when the released context is the environment's own. Teardown can now be reached from inside script (an iframe removed with element.remove()), so ExplicitMicrotasksScope no longer asserts a zero microtasks scope depth in the renderer; explicit checkpoints are no-ops there until the enclosing scope unwinds. | 1 个月前 | |
fix: illegal access errors when a same-process child window or subframe closes (#52964) * fix: give each renderer Node.js environment its own uv loop Same-process child windows and node-integrated subframes each get a Node.js environment, and until now all of them shared uv_default_loop() on the renderer main thread. Freeing one (FreeEnvironment runs the loop until that environment's handles close, with JavaScript disallowed on the isolate) therefore dispatched the other environments' pending immediates, timers, fs and threadpool callbacks in that window, which threw "Uncaught illegal access" in the surviving page or aborted the renderer (InternalCallbackScope / ToLocalChecked checks). NodeBindings can now integrate a given loop or own a fresh one (as the worker path already did), and the renderer keeps one NodeBindings + ElectronBindings pair per frame environment: the first borrows the process-lifetime uv_default_loop() integration so native modules that use the default loop keep working, later ones own their loop. Tearing an environment down parks that loop's embed thread and frees it without touching anyone else's handles. This also replaces the uv_env hand-off between main-frame environments and the injected-frames bookkeeping with a RenderFrame-keyed map, and gives each new environment its first loop run from a fresh task since child contexts can be created from inside a script. Fixes https://github.com/electron/electron/issues/36858 Fixes https://github.com/electron/electron/issues/40607 * fix: don't stack an error message listener per renderer environment CreateEnvironment adds Electron's V8 message listener for renderer and worker environments, and V8 keeps every listener it is given, so each navigation or child frame added another copy and uncaught errors ran the async-hook cleanup once per environment ever created on the isolate. Remove the previous registration before adding. Also restate why about:blank subframes are skipped for Node.js integration: freeing their environment is no longer a problem, but they commit synchronously in the renderer and so never receive the preload startup data the sandboxed bundle needs. * test: cover child-window loops, opener reloads and napi work across renderer environments Adds an async export to the echo fixture (a libuv threadpool round trip that calls back into JS, the napi path that aborted in InternalCallbackScope when it completed under another environment's context) and uses it to check that same-process child windows, including a synchronously created about:blank one, run immediates, fs and napi work on their own loop, that a child keeps working while its opener reloads, and that the survivor's napi callbacks still arrive when a sibling environment is freed. * test: cover napi thread-safe functions in child window environments A thread-safe function called from another thread reaches JS through a uv_async_t on its environment's loop and an AsyncResource::CallbackScope, so in a same-process child window it used to run under the opener's context and abort in InternalCallbackScope. Give the echo fixture a thread-safe variant and exercise it alongside the async work. Refs https://github.com/electron/electron/issues/33868 * refactor: set the isolate up for Node.js once per isolate Pull the IsolateSettings / SetIsolateUpForNode / host-import-callback block out of NodeBindings::CreateEnvironment into NodeBindings::SetUpIsolate, and call it once from each owner: the renderer client's one-time init, the WebWorkerObserver for its thread's isolate, and the browser and utility processes right after their single CreateEnvironment (node's snapshot path resets the isolate error handlers inside CreateEnvironment, so it has to follow it there). Renderer frames no longer re-run isolate setup or stack a message listener per environment. * fix: only lend uv_default_loop() to main frame environments Subframe environments always get a loop of their own; a main frame borrows the process's uv_default_loop() integration while no other environment holds it, so native modules that use the default loop see a consistent main-frame environment. * fix: free a frame's environment under the explicit microtasks policy Restore the explicit microtasks policy around freeing a frame's Node.js environment (its loop runs during teardown, see #33280), and only tear down when the released context is the environment's own. Teardown can now be reached from inside script (an iframe removed with element.remove()), so ExplicitMicrotasksScope no longer asserts a zero microtasks scope depth in the renderer; explicit checkpoints are no-ops there until the enclosing scope unwinds. | 1 个月前 | |
fix: illegal access errors when a same-process child window or subframe closes (#52964) * fix: give each renderer Node.js environment its own uv loop Same-process child windows and node-integrated subframes each get a Node.js environment, and until now all of them shared uv_default_loop() on the renderer main thread. Freeing one (FreeEnvironment runs the loop until that environment's handles close, with JavaScript disallowed on the isolate) therefore dispatched the other environments' pending immediates, timers, fs and threadpool callbacks in that window, which threw "Uncaught illegal access" in the surviving page or aborted the renderer (InternalCallbackScope / ToLocalChecked checks). NodeBindings can now integrate a given loop or own a fresh one (as the worker path already did), and the renderer keeps one NodeBindings + ElectronBindings pair per frame environment: the first borrows the process-lifetime uv_default_loop() integration so native modules that use the default loop keep working, later ones own their loop. Tearing an environment down parks that loop's embed thread and frees it without touching anyone else's handles. This also replaces the uv_env hand-off between main-frame environments and the injected-frames bookkeeping with a RenderFrame-keyed map, and gives each new environment its first loop run from a fresh task since child contexts can be created from inside a script. Fixes https://github.com/electron/electron/issues/36858 Fixes https://github.com/electron/electron/issues/40607 * fix: don't stack an error message listener per renderer environment CreateEnvironment adds Electron's V8 message listener for renderer and worker environments, and V8 keeps every listener it is given, so each navigation or child frame added another copy and uncaught errors ran the async-hook cleanup once per environment ever created on the isolate. Remove the previous registration before adding. Also restate why about:blank subframes are skipped for Node.js integration: freeing their environment is no longer a problem, but they commit synchronously in the renderer and so never receive the preload startup data the sandboxed bundle needs. * test: cover child-window loops, opener reloads and napi work across renderer environments Adds an async export to the echo fixture (a libuv threadpool round trip that calls back into JS, the napi path that aborted in InternalCallbackScope when it completed under another environment's context) and uses it to check that same-process child windows, including a synchronously created about:blank one, run immediates, fs and napi work on their own loop, that a child keeps working while its opener reloads, and that the survivor's napi callbacks still arrive when a sibling environment is freed. * test: cover napi thread-safe functions in child window environments A thread-safe function called from another thread reaches JS through a uv_async_t on its environment's loop and an AsyncResource::CallbackScope, so in a same-process child window it used to run under the opener's context and abort in InternalCallbackScope. Give the echo fixture a thread-safe variant and exercise it alongside the async work. Refs https://github.com/electron/electron/issues/33868 * refactor: set the isolate up for Node.js once per isolate Pull the IsolateSettings / SetIsolateUpForNode / host-import-callback block out of NodeBindings::CreateEnvironment into NodeBindings::SetUpIsolate, and call it once from each owner: the renderer client's one-time init, the WebWorkerObserver for its thread's isolate, and the browser and utility processes right after their single CreateEnvironment (node's snapshot path resets the isolate error handlers inside CreateEnvironment, so it has to follow it there). Renderer frames no longer re-run isolate setup or stack a message listener per environment. * fix: only lend uv_default_loop() to main frame environments Subframe environments always get a loop of their own; a main frame borrows the process's uv_default_loop() integration while no other environment holds it, so native modules that use the default loop see a consistent main-frame environment. * fix: free a frame's environment under the explicit microtasks policy Restore the explicit microtasks policy around freeing a frame's Node.js environment (its loop runs during teardown, see #33280), and only tear down when the released context is the environment's own. Teardown can now be reached from inside script (an iframe removed with element.remove()), so ExplicitMicrotasksScope no longer asserts a zero microtasks scope depth in the renderer; explicit checkpoints are no-ops there until the enclosing scope unwinds. | 1 个月前 | |
fix: illegal access errors when a same-process child window or subframe closes (#52964) * fix: give each renderer Node.js environment its own uv loop Same-process child windows and node-integrated subframes each get a Node.js environment, and until now all of them shared uv_default_loop() on the renderer main thread. Freeing one (FreeEnvironment runs the loop until that environment's handles close, with JavaScript disallowed on the isolate) therefore dispatched the other environments' pending immediates, timers, fs and threadpool callbacks in that window, which threw "Uncaught illegal access" in the surviving page or aborted the renderer (InternalCallbackScope / ToLocalChecked checks). NodeBindings can now integrate a given loop or own a fresh one (as the worker path already did), and the renderer keeps one NodeBindings + ElectronBindings pair per frame environment: the first borrows the process-lifetime uv_default_loop() integration so native modules that use the default loop keep working, later ones own their loop. Tearing an environment down parks that loop's embed thread and frees it without touching anyone else's handles. This also replaces the uv_env hand-off between main-frame environments and the injected-frames bookkeeping with a RenderFrame-keyed map, and gives each new environment its first loop run from a fresh task since child contexts can be created from inside a script. Fixes https://github.com/electron/electron/issues/36858 Fixes https://github.com/electron/electron/issues/40607 * fix: don't stack an error message listener per renderer environment CreateEnvironment adds Electron's V8 message listener for renderer and worker environments, and V8 keeps every listener it is given, so each navigation or child frame added another copy and uncaught errors ran the async-hook cleanup once per environment ever created on the isolate. Remove the previous registration before adding. Also restate why about:blank subframes are skipped for Node.js integration: freeing their environment is no longer a problem, but they commit synchronously in the renderer and so never receive the preload startup data the sandboxed bundle needs. * test: cover child-window loops, opener reloads and napi work across renderer environments Adds an async export to the echo fixture (a libuv threadpool round trip that calls back into JS, the napi path that aborted in InternalCallbackScope when it completed under another environment's context) and uses it to check that same-process child windows, including a synchronously created about:blank one, run immediates, fs and napi work on their own loop, that a child keeps working while its opener reloads, and that the survivor's napi callbacks still arrive when a sibling environment is freed. * test: cover napi thread-safe functions in child window environments A thread-safe function called from another thread reaches JS through a uv_async_t on its environment's loop and an AsyncResource::CallbackScope, so in a same-process child window it used to run under the opener's context and abort in InternalCallbackScope. Give the echo fixture a thread-safe variant and exercise it alongside the async work. Refs https://github.com/electron/electron/issues/33868 * refactor: set the isolate up for Node.js once per isolate Pull the IsolateSettings / SetIsolateUpForNode / host-import-callback block out of NodeBindings::CreateEnvironment into NodeBindings::SetUpIsolate, and call it once from each owner: the renderer client's one-time init, the WebWorkerObserver for its thread's isolate, and the browser and utility processes right after their single CreateEnvironment (node's snapshot path resets the isolate error handlers inside CreateEnvironment, so it has to follow it there). Renderer frames no longer re-run isolate setup or stack a message listener per environment. * fix: only lend uv_default_loop() to main frame environments Subframe environments always get a loop of their own; a main frame borrows the process's uv_default_loop() integration while no other environment holds it, so native modules that use the default loop see a consistent main-frame environment. * fix: free a frame's environment under the explicit microtasks policy Restore the explicit microtasks policy around freeing a frame's Node.js environment (its loop runs during teardown, see #33280), and only tear down when the released context is the environment's own. Teardown can now be reached from inside script (an iframe removed with element.remove()), so ExplicitMicrotasksScope no longer asserts a zero microtasks scope depth in the renderer; explicit checkpoints are no-ops there until the enclosing scope unwinds. | 1 个月前 | |
fix: illegal access errors when a same-process child window or subframe closes (#52964) * fix: give each renderer Node.js environment its own uv loop Same-process child windows and node-integrated subframes each get a Node.js environment, and until now all of them shared uv_default_loop() on the renderer main thread. Freeing one (FreeEnvironment runs the loop until that environment's handles close, with JavaScript disallowed on the isolate) therefore dispatched the other environments' pending immediates, timers, fs and threadpool callbacks in that window, which threw "Uncaught illegal access" in the surviving page or aborted the renderer (InternalCallbackScope / ToLocalChecked checks). NodeBindings can now integrate a given loop or own a fresh one (as the worker path already did), and the renderer keeps one NodeBindings + ElectronBindings pair per frame environment: the first borrows the process-lifetime uv_default_loop() integration so native modules that use the default loop keep working, later ones own their loop. Tearing an environment down parks that loop's embed thread and frees it without touching anyone else's handles. This also replaces the uv_env hand-off between main-frame environments and the injected-frames bookkeeping with a RenderFrame-keyed map, and gives each new environment its first loop run from a fresh task since child contexts can be created from inside a script. Fixes https://github.com/electron/electron/issues/36858 Fixes https://github.com/electron/electron/issues/40607 * fix: don't stack an error message listener per renderer environment CreateEnvironment adds Electron's V8 message listener for renderer and worker environments, and V8 keeps every listener it is given, so each navigation or child frame added another copy and uncaught errors ran the async-hook cleanup once per environment ever created on the isolate. Remove the previous registration before adding. Also restate why about:blank subframes are skipped for Node.js integration: freeing their environment is no longer a problem, but they commit synchronously in the renderer and so never receive the preload startup data the sandboxed bundle needs. * test: cover child-window loops, opener reloads and napi work across renderer environments Adds an async export to the echo fixture (a libuv threadpool round trip that calls back into JS, the napi path that aborted in InternalCallbackScope when it completed under another environment's context) and uses it to check that same-process child windows, including a synchronously created about:blank one, run immediates, fs and napi work on their own loop, that a child keeps working while its opener reloads, and that the survivor's napi callbacks still arrive when a sibling environment is freed. * test: cover napi thread-safe functions in child window environments A thread-safe function called from another thread reaches JS through a uv_async_t on its environment's loop and an AsyncResource::CallbackScope, so in a same-process child window it used to run under the opener's context and abort in InternalCallbackScope. Give the echo fixture a thread-safe variant and exercise it alongside the async work. Refs https://github.com/electron/electron/issues/33868 * refactor: set the isolate up for Node.js once per isolate Pull the IsolateSettings / SetIsolateUpForNode / host-import-callback block out of NodeBindings::CreateEnvironment into NodeBindings::SetUpIsolate, and call it once from each owner: the renderer client's one-time init, the WebWorkerObserver for its thread's isolate, and the browser and utility processes right after their single CreateEnvironment (node's snapshot path resets the isolate error handlers inside CreateEnvironment, so it has to follow it there). Renderer frames no longer re-run isolate setup or stack a message listener per environment. * fix: only lend uv_default_loop() to main frame environments Subframe environments always get a loop of their own; a main frame borrows the process's uv_default_loop() integration while no other environment holds it, so native modules that use the default loop see a consistent main-frame environment. * fix: free a frame's environment under the explicit microtasks policy Restore the explicit microtasks policy around freeing a frame's Node.js environment (its loop runs during teardown, see #33280), and only tear down when the released context is the environment's own. Teardown can now be reached from inside script (an iframe removed with element.remove()), so ExplicitMicrotasksScope no longer asserts a zero microtasks scope depth in the renderer; explicit checkpoints are no-ops there until the enclosing scope unwinds. | 1 个月前 | |
fix: illegal access errors when a same-process child window or subframe closes (#52964) * fix: give each renderer Node.js environment its own uv loop Same-process child windows and node-integrated subframes each get a Node.js environment, and until now all of them shared uv_default_loop() on the renderer main thread. Freeing one (FreeEnvironment runs the loop until that environment's handles close, with JavaScript disallowed on the isolate) therefore dispatched the other environments' pending immediates, timers, fs and threadpool callbacks in that window, which threw "Uncaught illegal access" in the surviving page or aborted the renderer (InternalCallbackScope / ToLocalChecked checks). NodeBindings can now integrate a given loop or own a fresh one (as the worker path already did), and the renderer keeps one NodeBindings + ElectronBindings pair per frame environment: the first borrows the process-lifetime uv_default_loop() integration so native modules that use the default loop keep working, later ones own their loop. Tearing an environment down parks that loop's embed thread and frees it without touching anyone else's handles. This also replaces the uv_env hand-off between main-frame environments and the injected-frames bookkeeping with a RenderFrame-keyed map, and gives each new environment its first loop run from a fresh task since child contexts can be created from inside a script. Fixes https://github.com/electron/electron/issues/36858 Fixes https://github.com/electron/electron/issues/40607 * fix: don't stack an error message listener per renderer environment CreateEnvironment adds Electron's V8 message listener for renderer and worker environments, and V8 keeps every listener it is given, so each navigation or child frame added another copy and uncaught errors ran the async-hook cleanup once per environment ever created on the isolate. Remove the previous registration before adding. Also restate why about:blank subframes are skipped for Node.js integration: freeing their environment is no longer a problem, but they commit synchronously in the renderer and so never receive the preload startup data the sandboxed bundle needs. * test: cover child-window loops, opener reloads and napi work across renderer environments Adds an async export to the echo fixture (a libuv threadpool round trip that calls back into JS, the napi path that aborted in InternalCallbackScope when it completed under another environment's context) and uses it to check that same-process child windows, including a synchronously created about:blank one, run immediates, fs and napi work on their own loop, that a child keeps working while its opener reloads, and that the survivor's napi callbacks still arrive when a sibling environment is freed. * test: cover napi thread-safe functions in child window environments A thread-safe function called from another thread reaches JS through a uv_async_t on its environment's loop and an AsyncResource::CallbackScope, so in a same-process child window it used to run under the opener's context and abort in InternalCallbackScope. Give the echo fixture a thread-safe variant and exercise it alongside the async work. Refs https://github.com/electron/electron/issues/33868 * refactor: set the isolate up for Node.js once per isolate Pull the IsolateSettings / SetIsolateUpForNode / host-import-callback block out of NodeBindings::CreateEnvironment into NodeBindings::SetUpIsolate, and call it once from each owner: the renderer client's one-time init, the WebWorkerObserver for its thread's isolate, and the browser and utility processes right after their single CreateEnvironment (node's snapshot path resets the isolate error handlers inside CreateEnvironment, so it has to follow it there). Renderer frames no longer re-run isolate setup or stack a message listener per environment. * fix: only lend uv_default_loop() to main frame environments Subframe environments always get a loop of their own; a main frame borrows the process's uv_default_loop() integration while no other environment holds it, so native modules that use the default loop see a consistent main-frame environment. * fix: free a frame's environment under the explicit microtasks policy Restore the explicit microtasks policy around freeing a frame's Node.js environment (its loop runs during teardown, see #33280), and only tear down when the released context is the environment's own. Teardown can now be reached from inside script (an iframe removed with element.remove()), so ExplicitMicrotasksScope no longer asserts a zero microtasks scope depth in the renderer; explicit checkpoints are no-ops there until the enclosing scope unwinds. | 1 个月前 | |
refactor: look up internalBinding and linked bindings without patching Node (#53528) * refactor: look up internalBinding and linked bindings without patching Node asar-fs-wrapper takes internalBinding from require('internal/bootstrap/realm'); sandboxed preloads resolve linked bindings through NodeBindings::GetLinkedBinding(), backed by accessors the NODE_LINKED_BINDING_CONTEXT_AWARE macro now emits. Drops the two Node patches that exposed process.internalBinding and node::binding::get_linked_module(). * chore: clang-format * fix: only run the node_init preload in the principal realm Node runs the embedder preload for ShadowRealms too. The bundle used to bail there by accident (process.internalBinding was undefined); now that internalBinding resolves it got as far as require('child_process') and hit the PipeWrap template CHECK. Skip non-principal realms explicitly, which also lets parallel/test-shadow-realm-custom-loaders run again. * chore: clang-format | 1 个月前 | |
perf: boot every Node.js-hosting process from the Node snapshot / code cache (#52873) Since #51703 the browser process boots from the embedded Node.js startup snapshot on native builds, but every other process that hosts Node.js -- renderers with Node integration or an unsandboxed preload, Node-enabled web workers, the utility-process node service, and ELECTRON_RUN_AS_NODE / child_process.fork() children -- still ran the full bootstrap, compiling the ~120-140 builtins it loads from source on every start (and then serializing a fresh code cache for each of them that nothing consumed). Three pieces: 1. Build-time code cache for Node's own builtins in every process flavor. The electron_natives_codecache tool now also emits a V8 code cache for Node's lib/ builtins (all but internal/deps/*) for the flavors whose processes bootstrap Node from scratch, compiled against that flavor's isolate and flag set like the electron/js2c/* bundles already were. The cache has to be in place before node::NewContext and node::CreateEnvironment run the bootstrap, i.e. before Electron can reach env->builtin_loader(), so it is installed as a process-wide default every BuiltinLoader is seeded with (new BuiltinLoader::SetProcessDefaultCodeCache() hook in the js2c code-cache node patch), from JavascriptEnvironment / NodeBindings::Initialize / the web-worker path. GN decides per flavor whether Node's builtins are embedded (always for the renderer flavor; utility/browser only on builds without a Node snapshot), so native builds pay for one copy. 2. ELECTRON_RUN_AS_NODE children and the utility-process node service create their isolate from the embedded Node snapshot too. Each has exactly one JavascriptEnvironment isolate (worker threads inherit the snapshot through IsolateData), so JavascriptEnvironment hands them the snapshot like the browser process, CreateIsolateData gets its EmbedderSnapshotData, CreateEnvironment an empty context, the deserialized context is entered, and the duplicate per-isolate message listener the snapshot path already installed is skipped. Cross builds and custom-V8-snapshot setups keep the from-scratch path. The js2c cache flavor now follows what the isolate was actually created from (ELECTRON_RUN_AS_NODE children were previously fed the browser flavor keyed to the Node-snapshot isolate, so even their node_init cache was silently rejected). 3. A node_platform fix this exposed: WorkerThreadsTaskRunner's DelayedTaskScheduler drains its queue through a TaskQueue, which is a std::priority_queue treating plain v8::Tasks as equal, so a StopTask can run before an earlier-queued ScheduleTask; that then arms a timer on the stopped loop and NodePlatform::Shutdown() waits it out -- observed as ~10 % of forked children stalling exactly 8 s (V8's memory-reducer delay) at exit in release builds. New patch drops ScheduleTasks that arrive after StopTask; upstreamable. The DCHECK-only cache-status record now covers all builtins, and the js2c code-cache spec asserts that browser / renderer / utility / run-as-node compile no Node builtin without consuming a cache entry, once as built and once from a copy of the app with the LoadBrowserProcessSpecificV8Snapshot fuse enabled. Whether a process may use the Node snapshot is decided by comparing the blob it loaded with the built-in one alone, so the fuse only affects the process whose blob it actually swaps. spec/node-spec.ts, utility-process, net, modules, asar, esm, context-bridge, ipc-renderer specs pass locally. Linux x64 release build (official, ThinLTO, PGO), interleaved A/B vs main, n=40 fresh processes per cell: ELECTRON_RUN_AS_NODE=1 electron -e 0 82.5 -> 37.0 ms child_process.fork(noop) -> 'exit' 89.4 -> 41.1 ms utilityProcess.fork -> first message 86.1 -> 39.7 ms nodeIntegration renderer, timeOrigin -> first preload statement 90.9 -> 64.7 ms stripped binary +2.0 MB | 2 个月前 | |
refactor: register Electron's js2c bundles as internal Node builtins (#53547) Emit the bundles under gen/internal/electron/js2c so js2c gives them internal/electron/js2c/* ids: they leave module.builtinModules, cannot be required or fetched with process.getBuiltinModule() from app code (which crashed under ELECTRON_RUN_AS_NODE), and parallel/test-process-get-builtin is re-enabled. | 1 个月前 | |
perf: build-time V8 code cache for the electron/js2c framework bundles (#51697) * build: dedupe get-intrinsic to shrink the sandboxed renderer bundle The hoisted get-intrinsic resolved to 1.2.1 (satisfying the older ^1.0.2..^1.2.0 consumers), so side-channel-weakmap, side-channel-map, call-bound and es-set-tostringtag — which need ^1.2.5/^1.3.0 — each pulled a nested get-intrinsic@1.3.0 copy. webpack bundled three of those nested copies into sandbox_bundle.js (~16.5 KB each). 1.3.0 satisfies every range in the tree (all ^1.x), so pin it via resolutions to collapse to a single copy. Drops sandbox_bundle.js from 364,762 to 323,116 bytes (-41,646, -11.4%) — that bundle is parsed/preparsed in every sandboxed renderer before the HTML parser, so this is a direct per-renderer startup win on top of the IPC and code-cache changes. * perf: build-time V8 code cache for the electron/js2c framework bundles Generate a V8 code cache for Electron's embedded electron/js2c/* bundles at build time and embed it in the binary, so each process deserializes its framework bundle (kConsumeCodeCache) instead of parsing and compiling it from source at startup. V8's code-cache key includes FlagList::Hash() over non-default flags and the snapshot's read-only checksum, both of which differ per process type, so one cache variant is generated per flavor and each process consumes the matching one: sandbox : sandboxed renderer, no Node env (+SAB) renderer : normal renderer, has Node env (+SAB +rehash +no-freeze) browser : main process (+rehash +no-freeze) utility : utility process (+rehash +no-freeze) worker : node/web worker (+rehash +no-freeze) All flavors create their isolate from the v8 context snapshot. The flag deltas are deterministic; --no-freeze-flags-after-init (present iff the process has a Node Environment) lets V8 recompute the flag-hash after init, so the consume-time hash of every node-env process includes --rehash-snapshot. A sandboxed renderer has no Node env (flags stay frozen) so it is a distinct flavor, discriminated at runtime by node::Environment::GetCurrent(context). The generator compiles each bundle with kEagerCompile so the cache covers the inner functions, not just the top-level wrapper -- the framework bundles run in full at startup, so this front-loads the lazy compiles to build time. Cross-arch is supported (the generator is built in v8_snapshot_toolchain so it links V8 with V8_TARGET_ARCH set to the target and reads the target's snapshot blob); cross-OS is untested and gated off. - electron_natives_codecache_main.cc: per-flavor build-time generator compiling each bundle through the same BuiltinLoader path its runtime consumer uses. - shell/common/js2c_bundle_ids.h: shared bundle ids and wrapper-function param names used by the generator and the runtime CompileAndCall call sites, so the source/params hash matches by construction. - node_util.cc feeds the standalone loader; FeedEnvironmentCodeCache feeds the per-Environment loader before LoadEnvironment so the *_init bundles are consumed. - Test-only (DCHECK builds, compiled out of production): a per-process id->accepted status map exposed via v8_util.getJs2cCodeCacheStatus, a sandboxed-preload shim, and spec/api-js2c-code-cache-spec.ts which spawns a clean app and asserts every bundle is consumed in browser/sandbox/renderer/utility. DidClearWindowObject (sandboxed renderer, pre-HTML-parser): ~9.8 ms (cache rejected/absent) -> ~6.4 ms (eager cache consumed), a ~3.4 ms / ~35% cold-start win on every launch. No V8 patch. * chore: export node patch for the js2c build-time code cache | 4 个月前 | |
perf: build-time V8 code cache for the electron/js2c framework bundles (#51697) * build: dedupe get-intrinsic to shrink the sandboxed renderer bundle The hoisted get-intrinsic resolved to 1.2.1 (satisfying the older ^1.0.2..^1.2.0 consumers), so side-channel-weakmap, side-channel-map, call-bound and es-set-tostringtag — which need ^1.2.5/^1.3.0 — each pulled a nested get-intrinsic@1.3.0 copy. webpack bundled three of those nested copies into sandbox_bundle.js (~16.5 KB each). 1.3.0 satisfies every range in the tree (all ^1.x), so pin it via resolutions to collapse to a single copy. Drops sandbox_bundle.js from 364,762 to 323,116 bytes (-41,646, -11.4%) — that bundle is parsed/preparsed in every sandboxed renderer before the HTML parser, so this is a direct per-renderer startup win on top of the IPC and code-cache changes. * perf: build-time V8 code cache for the electron/js2c framework bundles Generate a V8 code cache for Electron's embedded electron/js2c/* bundles at build time and embed it in the binary, so each process deserializes its framework bundle (kConsumeCodeCache) instead of parsing and compiling it from source at startup. V8's code-cache key includes FlagList::Hash() over non-default flags and the snapshot's read-only checksum, both of which differ per process type, so one cache variant is generated per flavor and each process consumes the matching one: sandbox : sandboxed renderer, no Node env (+SAB) renderer : normal renderer, has Node env (+SAB +rehash +no-freeze) browser : main process (+rehash +no-freeze) utility : utility process (+rehash +no-freeze) worker : node/web worker (+rehash +no-freeze) All flavors create their isolate from the v8 context snapshot. The flag deltas are deterministic; --no-freeze-flags-after-init (present iff the process has a Node Environment) lets V8 recompute the flag-hash after init, so the consume-time hash of every node-env process includes --rehash-snapshot. A sandboxed renderer has no Node env (flags stay frozen) so it is a distinct flavor, discriminated at runtime by node::Environment::GetCurrent(context). The generator compiles each bundle with kEagerCompile so the cache covers the inner functions, not just the top-level wrapper -- the framework bundles run in full at startup, so this front-loads the lazy compiles to build time. Cross-arch is supported (the generator is built in v8_snapshot_toolchain so it links V8 with V8_TARGET_ARCH set to the target and reads the target's snapshot blob); cross-OS is untested and gated off. - electron_natives_codecache_main.cc: per-flavor build-time generator compiling each bundle through the same BuiltinLoader path its runtime consumer uses. - shell/common/js2c_bundle_ids.h: shared bundle ids and wrapper-function param names used by the generator and the runtime CompileAndCall call sites, so the source/params hash matches by construction. - node_util.cc feeds the standalone loader; FeedEnvironmentCodeCache feeds the per-Environment loader before LoadEnvironment so the *_init bundles are consumed. - Test-only (DCHECK builds, compiled out of production): a per-process id->accepted status map exposed via v8_util.getJs2cCodeCacheStatus, a sandboxed-preload shim, and spec/api-js2c-code-cache-spec.ts which spawns a clean app and asserts every bundle is consumed in browser/sandbox/renderer/utility. DidClearWindowObject (sandboxed renderer, pre-HTML-parser): ~9.8 ms (cache rejected/absent) -> ~6.4 ms (eager cache consumed), a ~3.4 ms / ~35% cold-start win on every launch. No V8 patch. * chore: export node patch for the js2c build-time code cache | 4 个月前 | |
chore: bump chromium to 156.0.8076.0 (main) (#54318) * chore: bump chromium in DEPS to 156.0.8073.0 * 8409748: Update RenderWidgetHostViewBase::host_ lifetime Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8409748 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8410048: [dcheck-to-check] Convert DCHECKs in content/browser/ [34/n] Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8410048 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8401889: [Win] Read GetLastError() right after CreateFile() in ProcessSingleton Upstream now reads GetLastError() inside the TRACE_EVENT0 scope, which is the same fix this patch carried, so drop that hunk. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8401889 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8293899: Android: Enable ThemeService for WebUI NTP Upstream moved the //chrome/browser/themes dependency from a per-platform conditional into the unconditional deps of the mixers target, so the patch now removes it from that list instead. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8293899 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8412026: [mac] Support video capture lock on macOS Keep the compositor unsuspended when the window is headless, visible, or has an active video capture lock. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8412026 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8404074: [posix] Don't call SetNonBlocking() inside DCHECK() in ProcessSingleton Upstream made the same change, so drop the hunk from this patch. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8404074 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8421647: media: Move GPU/graphics client utilities to media/gfx/ Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8421647 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8361191: [api] Add MicrotaskQueue::SetMicrotasksPolicy()/GetMicrotasksPolicy() V8 now exposes the per-queue microtasks policy on v8::MicrotaskQueue, so remove the patch that added it and switch node_util.cc to the upstream SetMicrotasksPolicy()/GetMicrotasksPolicy() names. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/8361191 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: remove upstreamed patches Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8455783 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8455325 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8431509 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8402403 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8402402 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: update patches * chore: update siso revision * 8426326: Linux: Rename DarkModeManagerLinux to PortalSettingsLinux Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8426326 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8278613: Plumb navigation IDs to MIME handler streams Pass the navigation ID through StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent to the MIME handler stream manager, and only create the plugin response interceptor throttle for navigation requests, matching the upstream ChromeContentBrowserClient change. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8278613 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8403343: Bump clang revision The new clang package ships the raw_ptr plugin change from crrev.com/c/8358382, after which [chromium-containers] rejects T* template arguments in std::list, std::set and std::vector fields. Store raw_ptr<T> in those Electron containers instead. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8403343 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8362297: viz: Add `is_secure` flag to CopyOutputRequest and friends The new is_secure member brings VideoCaptureParams, together with the use_native_picker field this patch adds, over the chromium-style complexity threshold, so the implicit inline copy constructor is now rejected. Declare out-of-line copy and move constructors and assignment operators for the struct in the patch. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8362297 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8442576: Remove id from ChildProcessData Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8442576 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8421383: [RWS] Remove unused RWS cookie exclusion reason Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8421383 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8240331: Support targeting a network in NetworkService's WebSockets Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8240331 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8426064: Remove flag for restrict frame destinations to navigate The frame-destination check is now unconditional upstream, so drop the feature flag check in net.request. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8426064 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8292633: [atmemory] Add `blink::mojom::ScrollType` to the Autofill scroll callstack Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8292633 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8405125: FSA: rename UserAction to AccessTrigger and add programmatic triggers The former UserAction::kNone case is now split into AccessTrigger::kProgrammaticRead and kProgrammaticWrite; both keep the previous behavior of not granting access automatically and of replying to sensitive entry checks without prompting. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8405125 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8399046: Add chrome:// host and path mapping for component extensions ExtensionConfigMap::GetConfigProvider() now takes an Extension; use the new GetConfigProviderByExtensionId() for the id-based lookup. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8399046 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8445301: [Linux] Decouple //components/dbus from //ui/base and //net The //components/dbus component no longer depends on //components/dbus/menu, so depend on it directly for status_icon_linux_dbus.cc. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8445301 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8360557: [Extensions] Make generated features immutable FeatureProvider::AddFeature() no longer replaces an existing feature, so the entries Electron's feature files used to override core ones now fail a CHECK at startup. Drop the ones that duplicate the core definitions, or differ only in ChromeOS-only branches. Keep chrome.webstorePrivate unavailable by moving its delegated availability check into the core definition with a patch. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8360557 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * 8427384: Generate CDP TypeScript definitions directly from in-tree PDL files Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8427384 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fixup! 8403343: Bump clang revision * chore: update patches Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * 8397345: Move titlebar_config.h to chrome/browser/win The move switched the color mixers' Windows dependency from the narrow titlebar_config target to all of //chrome/browser/win, although the mixer uses nothing from it. On Windows that pulls //chrome/browser/profiles into Electron's link, where its ProfileKeyedServiceFactory collides with the one Electron provides for the spellchecker. Patch the unused dependency out. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8397345 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * 8403320: [WebUI] Disallow devtools:// scheme for WebUI data sources by default URL data sources are no longer served to devtools:// unless they opt in, so DevTools failed to load its frontend. Opt Electron's bundle data source in, and let its theme data source serve colors.css to devtools:// as Chrome's ThemeSource does. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8403320 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * 8394377: Migrate RefCountedDeleteOnSequence to start-from-one ref counting (4/4) Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8394377 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: bump chromium in DEPS to 156.0.8075.0 * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * 8467669: [zoom] Key host-less zoom levels on the URL without its fragment Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8467669 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: update patches Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: bump chromium in DEPS to 156.0.8076.0 * 8468407: [gtk] Don't leave GDK_BACKEND set in the environment after GTK init Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8468407 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8457646: [snapshot] Include embedder string in version hash Upstream moved Version::Hash() out of line and now builds it with base::Hasher over the version number and embedder string. Fold the v8_version_hash_salt into that hasher the same way instead of carrying a separate FNV-1a helper and hash_combine() call. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/8457646 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: update patches * 8459447: gin: Mark the stack-only helper classes STACK_ALLOCATED() gin::Dictionary is now STACK_ALLOCATED(), and the find-bad-constructs plugin conservatively treats any template instantiated with a stack-allocated type argument as stack-allocated too. Mark the two gin_helper::Promise<gin_helper::Dictionary> fields with STACK_ALLOCATED_IGNORE, since Promise<T> only names T as its resolve type and never stores one. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8459447 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 8424587: mojo: Remove unused WrapPlatformFile and UnwrapPlatformFile helpers Ref: https://chromium-review.googlesource.com/c/chromium/src/+/8424587 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fixup! 8403343: Bump clang revision notifications_ is now a std::set<raw_ptr<Notification>>, and libc++ has no heterogeneous set::erase, so erasing by key after Dismiss() built a temporary raw_ptr from the notification. On macOS Dismiss() has already destroyed it by then, so that took a BackupRefPtr reference on freed memory. Find it with the transparent comparator, which compares addresses without constructing a raw_ptr, and erase by iterator. Also drop NotifyIconHost::NotifyIcons, unused since notify_icons_ became a std::vector<raw_ptr<NotifyIcon>>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fixup! 8426064: Remove flag for restrict frame destinations to navigate Drop the network features include; its only use was the kRestrictFrameDestinationsToNavigate check this CL removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: electron-claude[bot] <279139701+electron-claude[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: clavin <clavin@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> | 21 天前 | |
fix: cppgc object lifetime follow-ups (#53738) * fix: detach Debugger from its DevToolsAgentHost when it is collected The agent host keeps a raw client pointer. If the Debugger was still attached when cppgc finalized it, a later ForceDetachAllSessions() at quit called AgentHostClosed() on freed memory. * fix: prune DataPipeHolder registry entries on collection The id -> WeakPersistent map was never erased after the cppgc migration, so it grew by one entry per blob upload element for the life of the process. * fix: keep the invoke callback when a handler result cannot be serialized ReplyChannel moved the mojo callback out before serializing, so a non-cloneable ipcMain.handle() result dropped it unrun and the renderer's ipcRenderer.invoke() never settled. Serialize first and leave the callback in place for the error reply. * fix: do not CHECK when emitting a warning from a renderer The isolate-less EmitWarning/EmitDeprecationWarning overloads used JavascriptEnvironment::GetIsolate(), which only exists in the browser and utility processes, so nativeImage.createFromNamedImage(name, [h,s,l]) and long crashReporter.addExtraParameter keys crashed the renderer. Use the current isolate and fall back to logging. * fix: settle shell.openPath() on Linux XDGUtil only ran the callback when waiting for exit, so the promise from shell.openPath() never settled on Linux. Report launch failure and success on the no-wait path too. * fix: keep ServiceWorkerMain registry entries owned by the live instance A destroyed instance waiting for GC re-ran Destroy() from its destructor and erased the version-id entry that a newer instance had registered, and a version that became redundant while already stopped never reached Destroy() so it stayed pinned. Only erase our own entry and destroy immediately when the redundant version is not running. * fix: release UtilityProcess wrappers whose child never launches Constructor failure paths and a child launch failure never reached HandleTermination(), so the wrapper stayed self-pinned and no 'exit' was emitted. Treat both as termination and tolerate a null connector. * fix: unregister portal shortcuts on Linux and ignore stale activations On the xdg GlobalShortcuts portal path unregister()/unregisterAll() never told the portal, so the binding survived and the next key press reached ExecuteCommand() with an empty map and hit NOTREACHED(). * fix: do not orphan a platform notification created by a re-entrant show() Close() can emit 'close' synchronously (macOS), and a listener calling show() from there created a platform notification that the outer Show() then overwrote, leaving it with a delegate pointer that outlived the Notification. * fix: look up the RenderFrame after reading webFrame arguments executeJavaScriptInIsolatedWorld and setSpellCheckProvider cached the RenderFrame and then read JS-supplied properties whose getters can detach the frame, leaving a dangling pointer. * fix: adopt a newly committed RenderFrameHost in WebFrameMain::From() content makes the new host current and can run embedder callbacks (focus/blur from CommitPending) before RenderFrameHostChanged re-keys the existing WebFrameMain, so touching webContents.mainFrame in that window constructed a second instance for the same FrameTreeNode and CHECKed. Also dispose WebFrameMains of a WebContents that api::WebContents stops observing without owning (webview guests, background pages), and replace a stale FrameTreeNode entry instead of CHECKing. * fix: keep gin_helper::Promise on the UI thread in systemPreferences and the MSIX updater promptTouchID, askForMediaAccess and the MSIX autoUpdater moved or destroyed the Promise (a cppgc::Persistent) on LocalAuthentication, AVFoundation, IO and WinRT threads. Bind it into a UI-sequence callback so only that callback crosses threads, and fix the MSIX put_Completed failure branch reading callback data that a temporary had already freed. * fix: release imported shared textures on their owning sequence VideoFrames created from a shared texture co-own it and can be destroyed on any thread, which ran the JS release callback and GPU teardown there. Delete on the owning sequence and post the frame release callback back. * fix: keep Menu alive while native code still references its model Root the menu passed to tray.popUpContextMenu() until it is replaced, remove the tray icon when the Tray constructor throws, and clean up a views MenuRunner that refused to run. On macOS root the installed application menu from the holder that owns its controller; on GTK drop the status icon MenuGtk when the menu is removed; on X11 clear the in-window menu bar when no global menu bar was in use; and record an inserted item before setters that can throw. * fix: fail a chunked net.request upload that the network stack asks to replay A 307/308 redirect or retry calls StartReading again, which re-entered the JS body function, threw, and left the request pinned. A JS stream cannot be replayed, so abort the upload instead. * fix: re-check MessagePortMain entanglement after serializing the message Serialization runs JS that can transfer or close the port being posted from, which left connector_ null for the rest of PostMessage(). * fix: settle the netLog.stopLogging() promise if the exporter pipe disconnects The Stop() reply owns the promise and is dropped unrun on disconnect, so the promise never settled. Wrap it so a dropped reply rejects. * fix: reject foreign receivers in Destroyable destroy() The unsignatured destroy() read internal field 0 of any receiver as a WrappableBase and deleted it, including DeprecatedWrappable and Node objects whose field 0 is something else. * fix: tear down utility-process AI receivers before the isolate UtilityAIManager receivers were self-owned and could outlive NodeService's JavascriptEnvironment; their destructors call into V8. Own them on NodeService and clear them first. | 1 个月前 | |
feat: add app shims on macOS (#54932) * feat: add app shims on macOS An app shim is a small app, in a bundle of its own, that shows windows on behalf of a host Electron app. The host still creates each window, loads its page and handles its events, but the NSWindow belongs to the shim's process, so the Dock, the app switcher, Mission Control and Stage Manager attribute the window to the shim and not to the host. - `app.startAppShimServer()` / `app.stopAppShimServer()` and the `app-shim-connected` event, which hands over an `AppShimHost`. - A `BaseWindow` / `BrowserWindow` created with the `appShim` option has its native window made in that shim's process, through Chromium's remote_cocoa. Such a window is a new NativeWindow implementation that only goes through views::Widget; what remote_cocoa has no call for is a no-op (see docs/api/app-shim-host.md). - The shim's executable is `Helpers/app_shim_loader` from the framework bundle. It links nothing from Electron: it loads the host's framework and calls the new `ElectronAppShimMain` export, which runs an `app-shim` process that connects back to the host over a Mach bootstrap server. - Electron Framework gains an rpath to the folder it is in, so that it finds its sibling frameworks when an executable in another bundle loads it. Not available in Mac App Store builds. Co-Authored-By: Claude <noreply@anthropic.com> * feat: app shim menus, dialogs, window chrome and review fixes Follow-up to the first app shim commit. Fixes from review: - A window torn down from one of its own listeners (shim.quit() or win.destroy() in `show`) no longer frees the native host that is notifying. - The native close button no longer leaves the shim waiting on an answer that was dropped with the window. - Keys the page does not handle go back to the shim, whose menu they are shortcuts of, and not to the host's menu. - stopAppShimServer() drops shims that have connected and not said hello. - Quitting a shim asks the host without blocking and without cancelling a logout; quit-requested can now be answered with "no". - Size limits and useContentSize are in content sizes; restore() and unmaximize() each do one thing; webContents.isFocused() works. New: - shim.setMenu(): a menu bar of the shim's own, built in the shim from a description of the Menu, with clicks sent back. - Message boxes and open and save dialogs are sheets of the window in the shim's process. - titleBarStyle, traffic light position and visibility, vibrancy, tabs and Quick Look, applied in the shim to the NSWindow that remote_cocoa made. - A Chromium patch for what remote_cocoa has no call for: movable, closable, minimizable and fullscreenable, clearing an aspect ratio, and yielding activation to the hosting process by pid. - A shim that loaded another build of Electron than the running host tells the host and quits: app-shim-version-mismatch. The API is marked experimental in the docs. Co-Authored-By: Claude <noreply@anthropic.com> * fix: address review of app shims - A window in an app shim can't be given a parent, at construction or with setParentWindow(), as the docs say. - shim.setMenu() is now shim.setApplicationMenu(). - A message box that is showing under an id makes way for a new one with that id, whichever process shows it. - Mac App Store builds no longer export the shim's entry point; they already had no loader. - setProgressBar() and setHasShadow() are listed among what does nothing on a window in a shim. - The spec no longer asserts inside an event listener. Co-Authored-By: Claude <noreply@anthropic.com> * fix: clang-tidy findings in app shim code * docs: reword the app shim docs for clarity * chore: update patches Re-exported after rebasing onto Chromium 158.0.8105.0; only line offsets changed. Co-Authored-By: Claude <noreply@anthropic.com> * test: use vitest matchers in the app shim spec --------- Co-authored-by: Claude <noreply@anthropic.com> | 3 天前 | |
chore: remove unused `#include "content/..."` calls (#52504) * chore: remove unused #include "content/..." calls in .h files * chore: remove unused #include "content/..." calls in .cc files * chore: remove unused #include "content/..." calls in .mm files | 2 个月前 | |
refactor: have `GetXdgAppId()` return a `std::optional<std::string>` (#49318) * refactor: GetXdgAppId() now returns std::optional<std::string> * refactor: slightly simplify app.setDesktopName() ts calls * refactor: add better documentation for dekstop-entry in XDG notifications | 9 个月前 | |
refactor: remove unused `#include "shell/..."` calls (#52566) * refactor: remove unused `#include "shell/..."` calls from .h files * refactor: remove unused `#include "shell/..."` calls from .cc files | 2 个月前 | |
fix: percent-encode paths passed to org.freedesktop.FileManager1 (#54350) shell.showItemInFolder() built the FileManager1 ShowItems URI as "file://" + path, so a path containing '#', '?' or '%' selected the wrong item or nothing. Percent-encode the raw path bytes with base::EscapePath() (net::FilePathToFileURL() would decode the path through the C library locale first and drop non-ASCII paths under a C/POSIX locale). Also keep every in-flight portal OpenDirectory request instead of only the latest one, and don't fall back to opening the parent folder when the portal request was cancelled by the user. | 25 天前 | |
fix: don't crash on non-UTF8 serviceName in app.setLoginItemSettings (#52773) * test: add coverage for non-UTF8 serviceName in app.setLoginItemSettings * fix: don't crash on non-UTF8 serviceName in app.setLoginItemSettings | 2 个月前 | |
fix: don't let pending shell operations block app exit on Windows (#52888) shell.openExternal(), shell.openPath() and shell.showItemInFolder() run ShellExecuteEx()/SHOpenFolderAndSelectItems() on a COM STA thread-pool task with the default SKIP_ON_SHUTDOWN behaviour. A SKIP_ON_SHUTDOWN task that has already started blocks ThreadPoolInstance::Shutdown(), and ShellExecuteEx() can block inside the OS for as long as Windows is showing UI for the request - for example the "you'll need a new app to open this link" dialog for a URL scheme with no registered handler. The result is that app.quit() never completes (the process lingers after 'quit' has fired) until the user dismisses that system dialog. Post these tasks with CONTINUE_ON_SHUTDOWN instead, matching Chrome's platform_util::OpenItem, which uses that trait for the same reason. The tasks only touch their bound arguments and OS APIs, so letting shutdown proceed while one is still blocked in the shell is safe. Fixes #52141. No-Verification-Needed: Windows-only source not built on this host; verified via Windows CI experiment | 2 个月前 | |
chore: bump chromium to 129.0.6650.0 (main) (#43266) * chore: bump chromium in DEPS to 129.0.6645.0 * chore: update patches * chore: bump chromium in DEPS to 129.0.6646.0 * refactor: remove ppapi dependency PPAPI removal - https://issues.chromium.org/issues/40511450 PDF viewer migration - https://issues.chromium.org/issues/40511452 * chore: update patches * chore: enable `content_enable_legacy_ipc` We were indirectly relying on this via `enable_ppapi=true`, with 633a57d9b62da7850ef7946f6b101ed440d04cdd ppapi is now disabled and this commit makes the dependency explicit. * fix: gn check --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> | 2 年前 | |
refactor: remove unused `#include "third_party/..."` calls (#52642) * refactor: remove unused `#include "third_party/..."` * chore: iwyu electron/buildflags/buildflags.h * refactor: remove unused `#include "third_party/..."` in .cc, .mm | 2 个月前 | |
chore: bump chromium to 144.0.7514.0 (main) (#48840) * chore: bump chromium in DEPS to 144.0.7514.0 * chore: update patches * 7119882: Reorganize //ui/gfx GN build target https://chromium-review.googlesource.com/c/chromium/src/+/7119882 * Replace includes with forward declares in rect_conversions.h https://chromium-review.googlesource.com/c/chromium/src/+/7127098 * Add ssl info to TrustedHeaderClient https://chromium-review.googlesource.com/c/chromium/src/+/7106780 * Replace ContentPluginInfo with WebPluginInfo https://chromium-review.googlesource.com/c/chromium/src/+/7127893 * Reland "[temporal] Unflag Temporal" https://chromium-review.googlesource.com/c/v8/v8/+/7123876 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> | 11 个月前 | |
perf: boot the browser process from an embedded Node startup snapshot (#51703) * perf: boot the browser process from an embedded Node startup snapshot Build a Node startup snapshot at build time (node_mksnapshot, gated to native builds) and create the browser-process isolate from it so the Node bootstrap is deserialized instead of re-parsed and re-compiled at every app start. The snapshot is generated by extending the same V8 startup snapshot the rest of the process uses (snapshot_blob.bin), so the read-only heap is shared and V8's one-snapshot-per-process invariant holds. node_snapshot (a separate source_set in third_party/electron_node:unofficial.gni) provides the strong SnapshotBuilder::GetEmbeddedSnapshotData over a now- weak no-op stub; electron_lib deps it so the shipped framework links the real snapshot while node_mksnapshot (which only links libnode + the weak stub) does not -- avoiding the GN dependency cycle that v8_snapshot_ toolchain == default_toolchain would otherwise force on native builds. Browser process only: - javascript_environment.cc: when the embedded snapshot is present, CreateIsolateHolder feeds its blob + external references into the isolate CreateParams (gin passes nullptr external refs so there is no conflict; the browser process has no blink). The ctor skips node::NewContext -- the main context is materialized from the snapshot inside node::CreateEnvironment. - electron_browser_main_parts.cc: passes an empty context to Initialize/CreateEnvironment in the snapshot path; enters the deserialized context after. - node_bindings.cc: CreateEnvironment defers context-dependent setup until the snapshot's main context exists; CreateIsolateData receives the snapshot's per-isolate data; LoadEnvironment merges the build-time js2c cache for electron/js2c/* with the snapshot's per-builtin cache. Renderer / sandboxed renderer / utility / worker processes are unchanged. Measured impact (Testing build, macOS arm64): V8 compile/parse on the browser-process critical path drops from ~17 ms to ~12 ms top-level (V8.PreParse 1003 -> 24 events, V8.ParseProgram 8 -> 0.7 ms), but the 4.4 MB snapshot adds ~5 ms of deserialize cost (V8.DeserializeContext 2.6 ms + V8.DeserializeIsolate 2.0 ms + V8.CompileDeserialize 1.4 ms), so the net wall-clock change is within run-to-run noise. The Testing build keeps every DCHECK in V8's deserializer hot loop compiled in (dcheck_always_on=true); the snapshot-vs-recompile trade-off is expected to be more favorable in Release builds where those are compiled out and the deserialize is mostly memcpy + relocate. Needs a Release benchmark to determine whether this is a net win. The build-time js2c code cache for the browser process is generated against the embedded snapshot's isolate (a dedicated electron_natives_codecache_snapshot host tool links the real node_snapshot and compiles browser_init/node_init via GetEmbeddedSnapshotData + InitializeIsolateParams). A SnapshotCreator- produced snapshot owns a unique read-only-heap checksum that matches no standalone blob, so this is the only way the browser bundles' code-cache read-only checksum matches the runtime isolate; the other flavors keep using the v8 context snapshot. * fix: restore preventDefault on native events in the snapshot path The eager gin_helper Event-constructor warm-up in NodeBindings::Initialize was guarded out when booting from the embedded Node startup snapshot (the context is empty there), on the mistaken assumption the Event ObjectTemplate would be populated lazily. For gin Constructible classes the template -- which carries preventDefault()/defaultPrevented -- is only ever populated by GetConstructor(), so every native gin event emitted in the snapshot-booted browser process was missing those members (e.g. TypeError: event.preventDefault is not a function on -before-unload-fired, will-navigate, etc.). Run the warm-up in CreateEnvironment once the snapshot's main context has been materialized and entered. The template is cached per-isolate, so a single call covers the isolate lifetime as before. * fix: skip the embedded snapshot in the ELECTRON_RUN_AS_NODE path The ELECTRON_RUN_AS_NODE entry point (shell/app/node_main.cc, used by child_process.fork) runs without a --type switch, so IsBrowserProcess() is true for it and JavascriptEnvironment created its isolate from the embedded Node startup snapshot. But node_main.cc builds its IsolateData without snapshot_data and passes a fresh context, so node's CreateEnvironment tripped CHECK_NOT_NULL(isolate_data->snapshot_data()) and the forked process aborted. Gate the snapshot on a new IsRunningAsNode() helper so only the genuine browser process consumes it; the run-as-node path boots a fresh isolate as before. The run-as-node check is lifted out of crash_keys.cc into process_util so both callers share one definition. * fix: avoid double uncaughtException delivery in the snapshot path When the browser process boots from the embedded Node snapshot, node::CreateEnvironment registers the per-isolate message listener while deserializing the snapshot (SetIsolateErrorHandlers in node's src/api/environment.cc, reached only on the snapshot path). Electron's own SetIsolateUpForNode then registered the same listener again, and because V8 message listeners are additive, every uncaught error -- and the uncaughtException that follows -- was delivered twice. A throwing webContents.setWindowOpenHandler surfaced this (guest-window-manager spec). Skip Electron's duplicate registration when booting from the snapshot: the snapshot-registered PerIsolateMessageListener is identical, and the custom fatal/OOM handlers are setters that still take effect. * chore: address review feedback on the snapshot patch - node_mksnapshot: read the base V8 snapshot blob with node::ReadFileSync instead of ifstream/stringstream, reporting a clear error on a missing or unreadable path rather than silently producing an empty blob. - Fix a misleading comment: the Node startup snapshot's embedded code cache and Electron's build-time js2c cache are NOT disjoint -- both carry the electron/js2c/* bundles node_mksnapshot compiled -- so RefreshCodeCache's insert_or_assign (build-time entry wins) is intentional, not a latent replace-vs-emplace bug. Correct the same claim in LoadEnvironment. * fix: register fast-API CFunction objects as snapshot external references V8 CL 7828135 ("[fastapi] Store v8::CFunction pointer directly in FunctionTemplateInfo", already in our pinned V8) wraps the v8::CFunction in a Foreign instead of a Managed<>, which restores serialization of FunctionTemplateInfo. The snapshot serializer now encodes the CFunction object's address, so ExternalReferenceRegistry::Register(CFunction) must register &c_func alongside GetAddress()/GetTypeInfo(). With that, node_mksnapshot serializes fast-API FunctionTemplates with c_function intact, so the DropCFunctionForSnapshot workaround -- which forced the snapshot's templates onto their slow callbacks -- is removed. The browser process keeps the V8 fast-API paths. | 4 个月前 | |
perf: boot the browser process from an embedded Node startup snapshot (#51703) * perf: boot the browser process from an embedded Node startup snapshot Build a Node startup snapshot at build time (node_mksnapshot, gated to native builds) and create the browser-process isolate from it so the Node bootstrap is deserialized instead of re-parsed and re-compiled at every app start. The snapshot is generated by extending the same V8 startup snapshot the rest of the process uses (snapshot_blob.bin), so the read-only heap is shared and V8's one-snapshot-per-process invariant holds. node_snapshot (a separate source_set in third_party/electron_node:unofficial.gni) provides the strong SnapshotBuilder::GetEmbeddedSnapshotData over a now- weak no-op stub; electron_lib deps it so the shipped framework links the real snapshot while node_mksnapshot (which only links libnode + the weak stub) does not -- avoiding the GN dependency cycle that v8_snapshot_ toolchain == default_toolchain would otherwise force on native builds. Browser process only: - javascript_environment.cc: when the embedded snapshot is present, CreateIsolateHolder feeds its blob + external references into the isolate CreateParams (gin passes nullptr external refs so there is no conflict; the browser process has no blink). The ctor skips node::NewContext -- the main context is materialized from the snapshot inside node::CreateEnvironment. - electron_browser_main_parts.cc: passes an empty context to Initialize/CreateEnvironment in the snapshot path; enters the deserialized context after. - node_bindings.cc: CreateEnvironment defers context-dependent setup until the snapshot's main context exists; CreateIsolateData receives the snapshot's per-isolate data; LoadEnvironment merges the build-time js2c cache for electron/js2c/* with the snapshot's per-builtin cache. Renderer / sandboxed renderer / utility / worker processes are unchanged. Measured impact (Testing build, macOS arm64): V8 compile/parse on the browser-process critical path drops from ~17 ms to ~12 ms top-level (V8.PreParse 1003 -> 24 events, V8.ParseProgram 8 -> 0.7 ms), but the 4.4 MB snapshot adds ~5 ms of deserialize cost (V8.DeserializeContext 2.6 ms + V8.DeserializeIsolate 2.0 ms + V8.CompileDeserialize 1.4 ms), so the net wall-clock change is within run-to-run noise. The Testing build keeps every DCHECK in V8's deserializer hot loop compiled in (dcheck_always_on=true); the snapshot-vs-recompile trade-off is expected to be more favorable in Release builds where those are compiled out and the deserialize is mostly memcpy + relocate. Needs a Release benchmark to determine whether this is a net win. The build-time js2c code cache for the browser process is generated against the embedded snapshot's isolate (a dedicated electron_natives_codecache_snapshot host tool links the real node_snapshot and compiles browser_init/node_init via GetEmbeddedSnapshotData + InitializeIsolateParams). A SnapshotCreator- produced snapshot owns a unique read-only-heap checksum that matches no standalone blob, so this is the only way the browser bundles' code-cache read-only checksum matches the runtime isolate; the other flavors keep using the v8 context snapshot. * fix: restore preventDefault on native events in the snapshot path The eager gin_helper Event-constructor warm-up in NodeBindings::Initialize was guarded out when booting from the embedded Node startup snapshot (the context is empty there), on the mistaken assumption the Event ObjectTemplate would be populated lazily. For gin Constructible classes the template -- which carries preventDefault()/defaultPrevented -- is only ever populated by GetConstructor(), so every native gin event emitted in the snapshot-booted browser process was missing those members (e.g. TypeError: event.preventDefault is not a function on -before-unload-fired, will-navigate, etc.). Run the warm-up in CreateEnvironment once the snapshot's main context has been materialized and entered. The template is cached per-isolate, so a single call covers the isolate lifetime as before. * fix: skip the embedded snapshot in the ELECTRON_RUN_AS_NODE path The ELECTRON_RUN_AS_NODE entry point (shell/app/node_main.cc, used by child_process.fork) runs without a --type switch, so IsBrowserProcess() is true for it and JavascriptEnvironment created its isolate from the embedded Node startup snapshot. But node_main.cc builds its IsolateData without snapshot_data and passes a fresh context, so node's CreateEnvironment tripped CHECK_NOT_NULL(isolate_data->snapshot_data()) and the forked process aborted. Gate the snapshot on a new IsRunningAsNode() helper so only the genuine browser process consumes it; the run-as-node path boots a fresh isolate as before. The run-as-node check is lifted out of crash_keys.cc into process_util so both callers share one definition. * fix: avoid double uncaughtException delivery in the snapshot path When the browser process boots from the embedded Node snapshot, node::CreateEnvironment registers the per-isolate message listener while deserializing the snapshot (SetIsolateErrorHandlers in node's src/api/environment.cc, reached only on the snapshot path). Electron's own SetIsolateUpForNode then registered the same listener again, and because V8 message listeners are additive, every uncaught error -- and the uncaughtException that follows -- was delivered twice. A throwing webContents.setWindowOpenHandler surfaced this (guest-window-manager spec). Skip Electron's duplicate registration when booting from the snapshot: the snapshot-registered PerIsolateMessageListener is identical, and the custom fatal/OOM handlers are setters that still take effect. * chore: address review feedback on the snapshot patch - node_mksnapshot: read the base V8 snapshot blob with node::ReadFileSync instead of ifstream/stringstream, reporting a clear error on a missing or unreadable path rather than silently producing an empty blob. - Fix a misleading comment: the Node startup snapshot's embedded code cache and Electron's build-time js2c cache are NOT disjoint -- both carry the electron/js2c/* bundles node_mksnapshot compiled -- so RefreshCodeCache's insert_or_assign (build-time entry wins) is intentional, not a latent replace-vs-emplace bug. Correct the same claim in LoadEnvironment. * fix: register fast-API CFunction objects as snapshot external references V8 CL 7828135 ("[fastapi] Store v8::CFunction pointer directly in FunctionTemplateInfo", already in our pinned V8) wraps the v8::CFunction in a Foreign instead of a Managed<>, which restores serialization of FunctionTemplateInfo. The snapshot serializer now encodes the CFunction object's address, so ExternalReferenceRegistry::Register(CFunction) must register &c_func alongside GetAddress()/GetTypeInfo(). With that, node_mksnapshot serializes fast-API FunctionTemplates with c_function intact, so the DropCFunctionForSnapshot workaround -- which forced the snapshot's templates onto their slow callbacks -- is removed. The browser process keeps the V8 fast-API paths. | 4 个月前 | |
perf: cut first-window, ipc, contextBridge, Buffer and asar overhead (#52923) * perf: preallocate the file descriptor table before threads start (linux) Linux grows a process's file descriptor table in powers of two on demand and, once the table is shared with other threads, expand_fdtable() waits for a full RCU grace period before freeing the old table. Whichever open()/socket()/memfd call crosses the 64-descriptor boundary in an already multi-threaded process eats that wait; in the browser process it lands inside the first `new BrowserWindow` (the renderer's channel and shared memory setup) and measured 55-115 ms of uninterruptible sleep in openat() on a 64-vCPU host, 10-30 ms being typical elsewhere. content's zygote already grows the table of every child it forks for this reason (content/zygote/zygote_linux.cc). Do the same in main() for the browser and the exec'd children: one F_DUPFD_CLOEXEC to descriptor 512 while the process is still single-threaded leaves a 1024-entry table (8 KB) behind and nothing else. Where RLIMIT_NOFILE is lower the fcntl fails and nothing changes. * perf: stop rebuilding the whole path per component in asar::GetAsarArchivePath GetAsarArchivePath() located the archive by calling DirName() once per path component and MatchesExtension() on each intermediate path (a BaseName() copy every time), then split the result with AppendRelativePath(), which runs GetComponents() over both the parent and the child. For a file inside app.asar that is dozens of string allocations per lookup, and the fs wrapper performs this lookup (asar.splitPath) for every fs call whose path mentions ".asar" - around ten per require()'d module. Scan the component boundaries as offsets into the existing string instead, hand only the candidate component to MatchesExtension(), and build the relative part with Append() from the components after the match. The outputs are byte-identical to before, including the existing corner cases (a real directory named *.asar is not an archive, the deepest matching component wins, doubled separators and a leading "." collapse the way Append() collapses them, a trailing separator on the archive path itself is kept); new asar-spec cases pin those down. * perf: keep context bridge proxy function state in the function's data array The proxy that contextBridge installs for a function carried its target, receiver and dynamic-property flag as three private properties on a state object, so every call through the bridge did three v8::Private::ForApi lookups (each allocating the key string) plus three GetPrivate calls before it could invoke anything. Store the three values in a packed v8::Array handed to v8::Function::New as the callback data and read them back by index. The array is only reachable through the function's data slot, exactly like the old state object, so nothing new becomes visible to either world; the original-function marker on the proxy itself stays a private property because that one has to live on a script-visible object. * perf: trim per-value work when the context bridge copies objects and arrays Copying a plain object or array across the bridge visits every value, and each visit paid for a trace event, three Blink wrapper probes (WebElement, WebBlob, VideoFrame) that can only ever match API wrapper objects, and, for object properties, an extra destination Context::Scope enter/exit on top of the source one. Arrays were also filled with one Set() per element. Skip the Blink probes unless the value is an API wrapper object, drop the inner trace event (the entry points keep theirs), read each property under the source scope and define it under the destination scope that is already active, and build array clones with the bulk v8::Array::New. The values produced, the object cache and the recursion order are unchanged. * perf: give V8's in-sandbox allocator a PartitionAlloc backend outside renderers Node allocates Buffer.allocUnsafe(), Buffer.allocUnsafeSlow() and the 64 KB Buffer pool refill through ArrayBuffer::Allocator::NewDefaultAllocator() (Electron's sandboxed-pointers patch), which under the V8 sandbox forwards to V8's built-in in-sandbox allocator. V8 documents that allocator as a slow placeholder embedders are expected to replace: it hands out page-granular regions under a global mutex and zero-fills even "uninitialized" requests. Blink replaces it for renderers (V8Initializer::InitializeInSandboxAllocator); the browser, utility and ELECTRON_RUN_AS_NODE processes never did, so every unpooled Buffer there paid a map/unmap round trip: Buffer.allocUnsafe of 1 MB ~300 us against ~12 us in a stock Node build, 64 KB ~30 us against ~2 us, and fs.readFile of a 1 MB file was several times slower than reading into a preallocated buffer. JavascriptEnvironment now installs an allocator with v8::V8::SetInSandboxAllocator() before the isolate is created, backed by gin's array buffer partition (which already lives inside the sandbox) the same way Blink's is backed by its ArrayBufferContents partition. PartitionAlloc refuses single allocations of ~2 GiB and more while the placeholder had no such cap, so requests above PartitionAlloc's limit go to the sandbox's address space directly (checked up front, so V8 never sees a failed allocation to retry) and Buffer.allocUnsafe of 2 GiB and more keeps working. Measured in the main process: allocUnsafe 64 KB 33 -> 5.6 us, 1 MB 297 -> 36 us, 4 MB 1691 -> 41 us, allocUnsafeSlow 1 MB 218 -> 13 us, fs.promises.readFile 1 MB 1.2 -> 0.9 ms. Page zeroing moves from the allocator to first touch, so a Buffer that is immediately written end to end pays the same faults later instead. * perf: serialize ipc values straight into the buffer they are sent in Values passed through ipcRenderer.send/invoke/sendSync/sendToHost, webContents.send, webFrameMain.send and their service worker equivalents travel as blink.mojom.CloneableMessage. For payloads above mojo's 64 KB inline limit that costs three fresh multi-megabyte buffers per hop: the V8 serializer grows a zero-filled std::vector, mojo copies that into a newly created shared memory region, and the receiving traits copy the region back out into another vector before V8 reads a byte. In profiles of 1-4 MB messages both main threads spent 30-40% of their time in page faults for those buffers. Electron owns both ends of these interfaces, so give them their own payload type: electron.mojom.SerializedValue is a BigBuffer plus the number of bytes written. The serializer keeps small values on the heap as before and, once V8 asks for more than the inline limit, continues in the shared memory region that will be sent, so the sender never holds a second copy. On the receiving side a renderer parses the region in place; the browser (and any other process) still parses a private copy, because the sender keeps write access to shared memory while it is read. MessagePort/postMessage paths keep blink's TransferableMessage, and the CloneableMessage overloads stay for in-process users (contextBridge, app 'second-instance' data). The serializer moves to shared memory once V8's request shows the value needs more than an inline message (not merely when the doubled request crosses 64 KB), and grows regions 4x from there, so a value written in many small pieces creates two or three regions rather than one per doubling; each region is a brokered round trip for a sandboxed renderer on Linux. Object-heavy payloads (arrays of small records) measure renderer -> main 1 MB 10.2 -> 10.2 ms and 4 MB 41.5 -> 39.9 ms with this, against +8% / +3% with per-doubling regions. * perf: size protocol and asar response pipes to the body Electron's URL loaders created their response data pipes with mojo's 64 KB default (the asar loader with a hard-coded 65536 copied from an old FileURLLoader), so every response larger than that reached the renderer in 64 KB slices, each one a producer wakeup on the browser main thread plus a consumer wakeup in the renderer. Chromium since sized these up: network::GetDataPipeDefaultAllocationSize() is 512 KB for ordinary loads and 2 MB (kLargerSizeIfPossible) for file://. A pipe is a shared memory buffer that base preallocates in full, though, so a uniformly larger pipe makes every small response measurably slower for the sake of the large ones. Instead, where the body size is known up front, size the pipe to the body with the same caps upstream uses: archive entries (file-like) up to the 2 MB file:// size, string/buffer responses and any protocol response that declares a Content-Length up to the 512 KB default. Streams of unknown length keep mojo's default. Small responses keep exactly the pipe they had; a 16 MB archive entry reaches the renderer in 8 slices instead of 256, a 16 MB protocol body with a known length in 32. * perf: remember module stat results for paths inside an archive Module resolution calls internalModuleStat() thousands of times while an app loads from app.asar, and most of those repeat a path it already asked about (parent node_modules directories, extension-less candidates): loading a 1040-module tree issues 6357 calls for 2751 distinct paths, 5065 of them misses. Node's own stat cache only remembers hits and only within one require() chain, so every repeat went back through the archive lookup. An archive's header never changes once it is open, so keep the answers derived from it in a Map keyed by the path (bounded, cleared when it grows past 16k entries). Answers that came from failing to open the archive are not kept, so an archive that appears later is still picked up. | 2 个月前 | |
perf: cut first-window, ipc, contextBridge, Buffer and asar overhead (#52923) * perf: preallocate the file descriptor table before threads start (linux) Linux grows a process's file descriptor table in powers of two on demand and, once the table is shared with other threads, expand_fdtable() waits for a full RCU grace period before freeing the old table. Whichever open()/socket()/memfd call crosses the 64-descriptor boundary in an already multi-threaded process eats that wait; in the browser process it lands inside the first `new BrowserWindow` (the renderer's channel and shared memory setup) and measured 55-115 ms of uninterruptible sleep in openat() on a 64-vCPU host, 10-30 ms being typical elsewhere. content's zygote already grows the table of every child it forks for this reason (content/zygote/zygote_linux.cc). Do the same in main() for the browser and the exec'd children: one F_DUPFD_CLOEXEC to descriptor 512 while the process is still single-threaded leaves a 1024-entry table (8 KB) behind and nothing else. Where RLIMIT_NOFILE is lower the fcntl fails and nothing changes. * perf: stop rebuilding the whole path per component in asar::GetAsarArchivePath GetAsarArchivePath() located the archive by calling DirName() once per path component and MatchesExtension() on each intermediate path (a BaseName() copy every time), then split the result with AppendRelativePath(), which runs GetComponents() over both the parent and the child. For a file inside app.asar that is dozens of string allocations per lookup, and the fs wrapper performs this lookup (asar.splitPath) for every fs call whose path mentions ".asar" - around ten per require()'d module. Scan the component boundaries as offsets into the existing string instead, hand only the candidate component to MatchesExtension(), and build the relative part with Append() from the components after the match. The outputs are byte-identical to before, including the existing corner cases (a real directory named *.asar is not an archive, the deepest matching component wins, doubled separators and a leading "." collapse the way Append() collapses them, a trailing separator on the archive path itself is kept); new asar-spec cases pin those down. * perf: keep context bridge proxy function state in the function's data array The proxy that contextBridge installs for a function carried its target, receiver and dynamic-property flag as three private properties on a state object, so every call through the bridge did three v8::Private::ForApi lookups (each allocating the key string) plus three GetPrivate calls before it could invoke anything. Store the three values in a packed v8::Array handed to v8::Function::New as the callback data and read them back by index. The array is only reachable through the function's data slot, exactly like the old state object, so nothing new becomes visible to either world; the original-function marker on the proxy itself stays a private property because that one has to live on a script-visible object. * perf: trim per-value work when the context bridge copies objects and arrays Copying a plain object or array across the bridge visits every value, and each visit paid for a trace event, three Blink wrapper probes (WebElement, WebBlob, VideoFrame) that can only ever match API wrapper objects, and, for object properties, an extra destination Context::Scope enter/exit on top of the source one. Arrays were also filled with one Set() per element. Skip the Blink probes unless the value is an API wrapper object, drop the inner trace event (the entry points keep theirs), read each property under the source scope and define it under the destination scope that is already active, and build array clones with the bulk v8::Array::New. The values produced, the object cache and the recursion order are unchanged. * perf: give V8's in-sandbox allocator a PartitionAlloc backend outside renderers Node allocates Buffer.allocUnsafe(), Buffer.allocUnsafeSlow() and the 64 KB Buffer pool refill through ArrayBuffer::Allocator::NewDefaultAllocator() (Electron's sandboxed-pointers patch), which under the V8 sandbox forwards to V8's built-in in-sandbox allocator. V8 documents that allocator as a slow placeholder embedders are expected to replace: it hands out page-granular regions under a global mutex and zero-fills even "uninitialized" requests. Blink replaces it for renderers (V8Initializer::InitializeInSandboxAllocator); the browser, utility and ELECTRON_RUN_AS_NODE processes never did, so every unpooled Buffer there paid a map/unmap round trip: Buffer.allocUnsafe of 1 MB ~300 us against ~12 us in a stock Node build, 64 KB ~30 us against ~2 us, and fs.readFile of a 1 MB file was several times slower than reading into a preallocated buffer. JavascriptEnvironment now installs an allocator with v8::V8::SetInSandboxAllocator() before the isolate is created, backed by gin's array buffer partition (which already lives inside the sandbox) the same way Blink's is backed by its ArrayBufferContents partition. PartitionAlloc refuses single allocations of ~2 GiB and more while the placeholder had no such cap, so requests above PartitionAlloc's limit go to the sandbox's address space directly (checked up front, so V8 never sees a failed allocation to retry) and Buffer.allocUnsafe of 2 GiB and more keeps working. Measured in the main process: allocUnsafe 64 KB 33 -> 5.6 us, 1 MB 297 -> 36 us, 4 MB 1691 -> 41 us, allocUnsafeSlow 1 MB 218 -> 13 us, fs.promises.readFile 1 MB 1.2 -> 0.9 ms. Page zeroing moves from the allocator to first touch, so a Buffer that is immediately written end to end pays the same faults later instead. * perf: serialize ipc values straight into the buffer they are sent in Values passed through ipcRenderer.send/invoke/sendSync/sendToHost, webContents.send, webFrameMain.send and their service worker equivalents travel as blink.mojom.CloneableMessage. For payloads above mojo's 64 KB inline limit that costs three fresh multi-megabyte buffers per hop: the V8 serializer grows a zero-filled std::vector, mojo copies that into a newly created shared memory region, and the receiving traits copy the region back out into another vector before V8 reads a byte. In profiles of 1-4 MB messages both main threads spent 30-40% of their time in page faults for those buffers. Electron owns both ends of these interfaces, so give them their own payload type: electron.mojom.SerializedValue is a BigBuffer plus the number of bytes written. The serializer keeps small values on the heap as before and, once V8 asks for more than the inline limit, continues in the shared memory region that will be sent, so the sender never holds a second copy. On the receiving side a renderer parses the region in place; the browser (and any other process) still parses a private copy, because the sender keeps write access to shared memory while it is read. MessagePort/postMessage paths keep blink's TransferableMessage, and the CloneableMessage overloads stay for in-process users (contextBridge, app 'second-instance' data). The serializer moves to shared memory once V8's request shows the value needs more than an inline message (not merely when the doubled request crosses 64 KB), and grows regions 4x from there, so a value written in many small pieces creates two or three regions rather than one per doubling; each region is a brokered round trip for a sandboxed renderer on Linux. Object-heavy payloads (arrays of small records) measure renderer -> main 1 MB 10.2 -> 10.2 ms and 4 MB 41.5 -> 39.9 ms with this, against +8% / +3% with per-doubling regions. * perf: size protocol and asar response pipes to the body Electron's URL loaders created their response data pipes with mojo's 64 KB default (the asar loader with a hard-coded 65536 copied from an old FileURLLoader), so every response larger than that reached the renderer in 64 KB slices, each one a producer wakeup on the browser main thread plus a consumer wakeup in the renderer. Chromium since sized these up: network::GetDataPipeDefaultAllocationSize() is 512 KB for ordinary loads and 2 MB (kLargerSizeIfPossible) for file://. A pipe is a shared memory buffer that base preallocates in full, though, so a uniformly larger pipe makes every small response measurably slower for the sake of the large ones. Instead, where the body size is known up front, size the pipe to the body with the same caps upstream uses: archive entries (file-like) up to the 2 MB file:// size, string/buffer responses and any protocol response that declares a Content-Length up to the 512 KB default. Streams of unknown length keep mojo's default. Small responses keep exactly the pipe they had; a 16 MB archive entry reaches the renderer in 8 slices instead of 256, a 16 MB protocol body with a known length in 32. * perf: remember module stat results for paths inside an archive Module resolution calls internalModuleStat() thousands of times while an app loads from app.asar, and most of those repeat a path it already asked about (parent node_modules directories, extension-less candidates): loading a 1040-module tree issues 6357 calls for 2751 distinct paths, 5065 of them misses. Node's own stat cache only remembers hits and only within one require() chain, so every repeat went back through the archive lookup. An archive's header never changes once it is open, so keep the answers derived from it in a Map keyed by the path (bounded, cleared when it grows past 16k entries). Answers that came from failing to open the archive are not kept, so an archive that appears later is still picked up. | 2 个月前 | |
perf: cut first-window, ipc, contextBridge, Buffer and asar overhead (#52923) * perf: preallocate the file descriptor table before threads start (linux) Linux grows a process's file descriptor table in powers of two on demand and, once the table is shared with other threads, expand_fdtable() waits for a full RCU grace period before freeing the old table. Whichever open()/socket()/memfd call crosses the 64-descriptor boundary in an already multi-threaded process eats that wait; in the browser process it lands inside the first `new BrowserWindow` (the renderer's channel and shared memory setup) and measured 55-115 ms of uninterruptible sleep in openat() on a 64-vCPU host, 10-30 ms being typical elsewhere. content's zygote already grows the table of every child it forks for this reason (content/zygote/zygote_linux.cc). Do the same in main() for the browser and the exec'd children: one F_DUPFD_CLOEXEC to descriptor 512 while the process is still single-threaded leaves a 1024-entry table (8 KB) behind and nothing else. Where RLIMIT_NOFILE is lower the fcntl fails and nothing changes. * perf: stop rebuilding the whole path per component in asar::GetAsarArchivePath GetAsarArchivePath() located the archive by calling DirName() once per path component and MatchesExtension() on each intermediate path (a BaseName() copy every time), then split the result with AppendRelativePath(), which runs GetComponents() over both the parent and the child. For a file inside app.asar that is dozens of string allocations per lookup, and the fs wrapper performs this lookup (asar.splitPath) for every fs call whose path mentions ".asar" - around ten per require()'d module. Scan the component boundaries as offsets into the existing string instead, hand only the candidate component to MatchesExtension(), and build the relative part with Append() from the components after the match. The outputs are byte-identical to before, including the existing corner cases (a real directory named *.asar is not an archive, the deepest matching component wins, doubled separators and a leading "." collapse the way Append() collapses them, a trailing separator on the archive path itself is kept); new asar-spec cases pin those down. * perf: keep context bridge proxy function state in the function's data array The proxy that contextBridge installs for a function carried its target, receiver and dynamic-property flag as three private properties on a state object, so every call through the bridge did three v8::Private::ForApi lookups (each allocating the key string) plus three GetPrivate calls before it could invoke anything. Store the three values in a packed v8::Array handed to v8::Function::New as the callback data and read them back by index. The array is only reachable through the function's data slot, exactly like the old state object, so nothing new becomes visible to either world; the original-function marker on the proxy itself stays a private property because that one has to live on a script-visible object. * perf: trim per-value work when the context bridge copies objects and arrays Copying a plain object or array across the bridge visits every value, and each visit paid for a trace event, three Blink wrapper probes (WebElement, WebBlob, VideoFrame) that can only ever match API wrapper objects, and, for object properties, an extra destination Context::Scope enter/exit on top of the source one. Arrays were also filled with one Set() per element. Skip the Blink probes unless the value is an API wrapper object, drop the inner trace event (the entry points keep theirs), read each property under the source scope and define it under the destination scope that is already active, and build array clones with the bulk v8::Array::New. The values produced, the object cache and the recursion order are unchanged. * perf: give V8's in-sandbox allocator a PartitionAlloc backend outside renderers Node allocates Buffer.allocUnsafe(), Buffer.allocUnsafeSlow() and the 64 KB Buffer pool refill through ArrayBuffer::Allocator::NewDefaultAllocator() (Electron's sandboxed-pointers patch), which under the V8 sandbox forwards to V8's built-in in-sandbox allocator. V8 documents that allocator as a slow placeholder embedders are expected to replace: it hands out page-granular regions under a global mutex and zero-fills even "uninitialized" requests. Blink replaces it for renderers (V8Initializer::InitializeInSandboxAllocator); the browser, utility and ELECTRON_RUN_AS_NODE processes never did, so every unpooled Buffer there paid a map/unmap round trip: Buffer.allocUnsafe of 1 MB ~300 us against ~12 us in a stock Node build, 64 KB ~30 us against ~2 us, and fs.readFile of a 1 MB file was several times slower than reading into a preallocated buffer. JavascriptEnvironment now installs an allocator with v8::V8::SetInSandboxAllocator() before the isolate is created, backed by gin's array buffer partition (which already lives inside the sandbox) the same way Blink's is backed by its ArrayBufferContents partition. PartitionAlloc refuses single allocations of ~2 GiB and more while the placeholder had no such cap, so requests above PartitionAlloc's limit go to the sandbox's address space directly (checked up front, so V8 never sees a failed allocation to retry) and Buffer.allocUnsafe of 2 GiB and more keeps working. Measured in the main process: allocUnsafe 64 KB 33 -> 5.6 us, 1 MB 297 -> 36 us, 4 MB 1691 -> 41 us, allocUnsafeSlow 1 MB 218 -> 13 us, fs.promises.readFile 1 MB 1.2 -> 0.9 ms. Page zeroing moves from the allocator to first touch, so a Buffer that is immediately written end to end pays the same faults later instead. * perf: serialize ipc values straight into the buffer they are sent in Values passed through ipcRenderer.send/invoke/sendSync/sendToHost, webContents.send, webFrameMain.send and their service worker equivalents travel as blink.mojom.CloneableMessage. For payloads above mojo's 64 KB inline limit that costs three fresh multi-megabyte buffers per hop: the V8 serializer grows a zero-filled std::vector, mojo copies that into a newly created shared memory region, and the receiving traits copy the region back out into another vector before V8 reads a byte. In profiles of 1-4 MB messages both main threads spent 30-40% of their time in page faults for those buffers. Electron owns both ends of these interfaces, so give them their own payload type: electron.mojom.SerializedValue is a BigBuffer plus the number of bytes written. The serializer keeps small values on the heap as before and, once V8 asks for more than the inline limit, continues in the shared memory region that will be sent, so the sender never holds a second copy. On the receiving side a renderer parses the region in place; the browser (and any other process) still parses a private copy, because the sender keeps write access to shared memory while it is read. MessagePort/postMessage paths keep blink's TransferableMessage, and the CloneableMessage overloads stay for in-process users (contextBridge, app 'second-instance' data). The serializer moves to shared memory once V8's request shows the value needs more than an inline message (not merely when the doubled request crosses 64 KB), and grows regions 4x from there, so a value written in many small pieces creates two or three regions rather than one per doubling; each region is a brokered round trip for a sandboxed renderer on Linux. Object-heavy payloads (arrays of small records) measure renderer -> main 1 MB 10.2 -> 10.2 ms and 4 MB 41.5 -> 39.9 ms with this, against +8% / +3% with per-doubling regions. * perf: size protocol and asar response pipes to the body Electron's URL loaders created their response data pipes with mojo's 64 KB default (the asar loader with a hard-coded 65536 copied from an old FileURLLoader), so every response larger than that reached the renderer in 64 KB slices, each one a producer wakeup on the browser main thread plus a consumer wakeup in the renderer. Chromium since sized these up: network::GetDataPipeDefaultAllocationSize() is 512 KB for ordinary loads and 2 MB (kLargerSizeIfPossible) for file://. A pipe is a shared memory buffer that base preallocates in full, though, so a uniformly larger pipe makes every small response measurably slower for the sake of the large ones. Instead, where the body size is known up front, size the pipe to the body with the same caps upstream uses: archive entries (file-like) up to the 2 MB file:// size, string/buffer responses and any protocol response that declares a Content-Length up to the 512 KB default. Streams of unknown length keep mojo's default. Small responses keep exactly the pipe they had; a 16 MB archive entry reaches the renderer in 8 slices instead of 256, a 16 MB protocol body with a known length in 32. * perf: remember module stat results for paths inside an archive Module resolution calls internalModuleStat() thousands of times while an app loads from app.asar, and most of those repeat a path it already asked about (parent node_modules directories, extension-less candidates): loading a 1040-module tree issues 6357 calls for 2751 distinct paths, 5065 of them misses. Node's own stat cache only remembers hits and only within one require() chain, so every repeat went back through the archive lookup. An archive's header never changes once it is open, so keep the answers derived from it in a Map keyed by the path (bounded, cleared when it grows past 16k entries). Answers that came from failing to open the archive are not kept, so an archive that appears later is still picked up. | 2 个月前 | |
perf: cut first-window, ipc, contextBridge, Buffer and asar overhead (#52923) * perf: preallocate the file descriptor table before threads start (linux) Linux grows a process's file descriptor table in powers of two on demand and, once the table is shared with other threads, expand_fdtable() waits for a full RCU grace period before freeing the old table. Whichever open()/socket()/memfd call crosses the 64-descriptor boundary in an already multi-threaded process eats that wait; in the browser process it lands inside the first `new BrowserWindow` (the renderer's channel and shared memory setup) and measured 55-115 ms of uninterruptible sleep in openat() on a 64-vCPU host, 10-30 ms being typical elsewhere. content's zygote already grows the table of every child it forks for this reason (content/zygote/zygote_linux.cc). Do the same in main() for the browser and the exec'd children: one F_DUPFD_CLOEXEC to descriptor 512 while the process is still single-threaded leaves a 1024-entry table (8 KB) behind and nothing else. Where RLIMIT_NOFILE is lower the fcntl fails and nothing changes. * perf: stop rebuilding the whole path per component in asar::GetAsarArchivePath GetAsarArchivePath() located the archive by calling DirName() once per path component and MatchesExtension() on each intermediate path (a BaseName() copy every time), then split the result with AppendRelativePath(), which runs GetComponents() over both the parent and the child. For a file inside app.asar that is dozens of string allocations per lookup, and the fs wrapper performs this lookup (asar.splitPath) for every fs call whose path mentions ".asar" - around ten per require()'d module. Scan the component boundaries as offsets into the existing string instead, hand only the candidate component to MatchesExtension(), and build the relative part with Append() from the components after the match. The outputs are byte-identical to before, including the existing corner cases (a real directory named *.asar is not an archive, the deepest matching component wins, doubled separators and a leading "." collapse the way Append() collapses them, a trailing separator on the archive path itself is kept); new asar-spec cases pin those down. * perf: keep context bridge proxy function state in the function's data array The proxy that contextBridge installs for a function carried its target, receiver and dynamic-property flag as three private properties on a state object, so every call through the bridge did three v8::Private::ForApi lookups (each allocating the key string) plus three GetPrivate calls before it could invoke anything. Store the three values in a packed v8::Array handed to v8::Function::New as the callback data and read them back by index. The array is only reachable through the function's data slot, exactly like the old state object, so nothing new becomes visible to either world; the original-function marker on the proxy itself stays a private property because that one has to live on a script-visible object. * perf: trim per-value work when the context bridge copies objects and arrays Copying a plain object or array across the bridge visits every value, and each visit paid for a trace event, three Blink wrapper probes (WebElement, WebBlob, VideoFrame) that can only ever match API wrapper objects, and, for object properties, an extra destination Context::Scope enter/exit on top of the source one. Arrays were also filled with one Set() per element. Skip the Blink probes unless the value is an API wrapper object, drop the inner trace event (the entry points keep theirs), read each property under the source scope and define it under the destination scope that is already active, and build array clones with the bulk v8::Array::New. The values produced, the object cache and the recursion order are unchanged. * perf: give V8's in-sandbox allocator a PartitionAlloc backend outside renderers Node allocates Buffer.allocUnsafe(), Buffer.allocUnsafeSlow() and the 64 KB Buffer pool refill through ArrayBuffer::Allocator::NewDefaultAllocator() (Electron's sandboxed-pointers patch), which under the V8 sandbox forwards to V8's built-in in-sandbox allocator. V8 documents that allocator as a slow placeholder embedders are expected to replace: it hands out page-granular regions under a global mutex and zero-fills even "uninitialized" requests. Blink replaces it for renderers (V8Initializer::InitializeInSandboxAllocator); the browser, utility and ELECTRON_RUN_AS_NODE processes never did, so every unpooled Buffer there paid a map/unmap round trip: Buffer.allocUnsafe of 1 MB ~300 us against ~12 us in a stock Node build, 64 KB ~30 us against ~2 us, and fs.readFile of a 1 MB file was several times slower than reading into a preallocated buffer. JavascriptEnvironment now installs an allocator with v8::V8::SetInSandboxAllocator() before the isolate is created, backed by gin's array buffer partition (which already lives inside the sandbox) the same way Blink's is backed by its ArrayBufferContents partition. PartitionAlloc refuses single allocations of ~2 GiB and more while the placeholder had no such cap, so requests above PartitionAlloc's limit go to the sandbox's address space directly (checked up front, so V8 never sees a failed allocation to retry) and Buffer.allocUnsafe of 2 GiB and more keeps working. Measured in the main process: allocUnsafe 64 KB 33 -> 5.6 us, 1 MB 297 -> 36 us, 4 MB 1691 -> 41 us, allocUnsafeSlow 1 MB 218 -> 13 us, fs.promises.readFile 1 MB 1.2 -> 0.9 ms. Page zeroing moves from the allocator to first touch, so a Buffer that is immediately written end to end pays the same faults later instead. * perf: serialize ipc values straight into the buffer they are sent in Values passed through ipcRenderer.send/invoke/sendSync/sendToHost, webContents.send, webFrameMain.send and their service worker equivalents travel as blink.mojom.CloneableMessage. For payloads above mojo's 64 KB inline limit that costs three fresh multi-megabyte buffers per hop: the V8 serializer grows a zero-filled std::vector, mojo copies that into a newly created shared memory region, and the receiving traits copy the region back out into another vector before V8 reads a byte. In profiles of 1-4 MB messages both main threads spent 30-40% of their time in page faults for those buffers. Electron owns both ends of these interfaces, so give them their own payload type: electron.mojom.SerializedValue is a BigBuffer plus the number of bytes written. The serializer keeps small values on the heap as before and, once V8 asks for more than the inline limit, continues in the shared memory region that will be sent, so the sender never holds a second copy. On the receiving side a renderer parses the region in place; the browser (and any other process) still parses a private copy, because the sender keeps write access to shared memory while it is read. MessagePort/postMessage paths keep blink's TransferableMessage, and the CloneableMessage overloads stay for in-process users (contextBridge, app 'second-instance' data). The serializer moves to shared memory once V8's request shows the value needs more than an inline message (not merely when the doubled request crosses 64 KB), and grows regions 4x from there, so a value written in many small pieces creates two or three regions rather than one per doubling; each region is a brokered round trip for a sandboxed renderer on Linux. Object-heavy payloads (arrays of small records) measure renderer -> main 1 MB 10.2 -> 10.2 ms and 4 MB 41.5 -> 39.9 ms with this, against +8% / +3% with per-doubling regions. * perf: size protocol and asar response pipes to the body Electron's URL loaders created their response data pipes with mojo's 64 KB default (the asar loader with a hard-coded 65536 copied from an old FileURLLoader), so every response larger than that reached the renderer in 64 KB slices, each one a producer wakeup on the browser main thread plus a consumer wakeup in the renderer. Chromium since sized these up: network::GetDataPipeDefaultAllocationSize() is 512 KB for ordinary loads and 2 MB (kLargerSizeIfPossible) for file://. A pipe is a shared memory buffer that base preallocates in full, though, so a uniformly larger pipe makes every small response measurably slower for the sake of the large ones. Instead, where the body size is known up front, size the pipe to the body with the same caps upstream uses: archive entries (file-like) up to the 2 MB file:// size, string/buffer responses and any protocol response that declares a Content-Length up to the 512 KB default. Streams of unknown length keep mojo's default. Small responses keep exactly the pipe they had; a 16 MB archive entry reaches the renderer in 8 slices instead of 256, a 16 MB protocol body with a known length in 32. * perf: remember module stat results for paths inside an archive Module resolution calls internalModuleStat() thousands of times while an app loads from app.asar, and most of those repeat a path it already asked about (parent node_modules directories, extension-less candidates): loading a 1040-module tree issues 6357 calls for 2751 distinct paths, 5065 of them misses. Node's own stat cache only remembers hits and only within one require() chain, so every repeat went back through the archive lookup. An archive's header never changes once it is open, so keep the answers derived from it in a Map keyed by the path (bounded, cleared when it grows past 16k entries). Answers that came from failing to open the archive are not kept, so an archive that appears later is still picked up. | 2 个月前 | |
refactor: remove unused `#include "third_party/..."` calls (#52642) * refactor: remove unused `#include "third_party/..."` * chore: iwyu electron/buildflags/buildflags.h * refactor: remove unused `#include "third_party/..."` in .cc, .mm | 2 个月前 | |
refactor: spanify image utils (#44127) * refactor: electron::util::AddImageSkiaRepFromJPEG() takes a span arg * refactor: electron::util::AddImageSkiaRepFromPNG() takes a span arg * refactor: electron::util::AddImageSkiaRepFromBuffer() takes a span arg * feat: add Node-buffer-to-base-span helper function * refactor: electron::api::NativeImage::CreateFromPNG() now takes a span param * refactor: electron::api::NativeImage::CreateFromJPEG() now takes a span param * refactor: use base::as_byte_span() * fix: -Wunsafe-buffer-usage warning in NativeImage::CreateFromNamedImage() Warning fixed by this commit: ../../electron/shell/common/api/electron_api_native_image_mac.mm:131:11: error: function introduces unsafe buffer manipulation [-Werror,-Wunsafe-buffer-usage] 131 | {reinterpret_cast<const uint8_t*>((char*)[png_data bytes]), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 132 | [png_data length]}); | ~~~~~~~~~~~~~~~~~~ ../../electron/shell/common/api/electron_api_native_image_mac.mm:131:11: note: See //docs/unsafe_buffers.md for help. * chore: add // SAFETY comment for Node-buffer-to-span func * chore: add // SAFETY comment for NSData-to-span func | 1 年前 | |
chore: bump chromium to 110.0.5415.0 (main) (#36186) * chore: bump chromium in DEPS to 109.0.5386.0 * chore: bump chromium in DEPS to 109.0.5388.0 * chore: bump chromium in DEPS to 109.0.5390.0 * chore: bump chromium in DEPS to 109.0.5392.0 * chore: bump chromium in DEPS to 109.0.5394.0 * chore: bump chromium in DEPS to 109.0.5396.0 * chore: bump chromium in DEPS to 109.0.5398.0 * chore: bump chromium in DEPS to 109.0.5400.0 * chore: update galactus * chore: bump chromium in DEPS to 109.0.5402.0 * chore: bump chromium in DEPS to 109.0.5403.0 * chore: bump chromium in DEPS to 109.0.5406.0 * chore: update patches * 4004247: Delete unused DocumentWebContentsDelegate Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4004247 * chore: bump chromium in DEPS to 109.0.5408.1 * chore: update patches * 3949284: Support pkey debug mode without pkey 0 access Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3949284 * chore: bump chromium in DEPS to 109.0.5410.0 * chore: update patches * 4000944: [Extensions] Create an API directory in //chrome/renderer/extensions Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4000944 * 3988524: Remove DocumentOverlayWindowViews | https://chromium-review.googlesource.com/c/chromium/src/+/3988524 Co-authored-by: George Xu <33054982+georgexu99@users.noreply.github.com> * chore: bump chromium in DEPS to 109.0.5412.0 * chore: update patches * 3984022: Add AddChildWindowToBrowser to DisplayClient mojo interface Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3984022 * 3957079: Delete the CryptoToken component extension and internal API Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3957079 * 4004421: Migreate ScopedAllowIO to ScopedAllowBlocking Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4004421 Co-authored-by: George Xu <georgexu99@users.noreply.github.com> * chore: bump chromium in DEPS to 109.0.5414.0 * chore: update patches * 4016180: Split PPAPI Mojo interfaces out of RenderFrameHostImpl. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4016180 * 3970838: [MPArch] Convert HostZoomMap and ZoomController off of RenderViewHost ids Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3970838 * 3997795: Don't add Chromium as a login item Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3997795 * 3993482: Remove RefCountedString::TakeString Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3993482 * 3990749: Allow forward-declared sources in base::ScopedObservation<> Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3990749 * fixup! 3957079: Delete the CryptoToken component extension and internal API * chore: bump chromium in DEPS to 110.0.5415.0 * 3883790: Move devtools_frame_token to the RenderFrameHost, to preserve RFH identity across MPArch activations. https://chromium-review.googlesource.com/c/chromium/src/+/3883790 * 4022205: Move license tooling into //tools/licenses https://chromium-review.googlesource.com/c/chromium/src/+/4022205 * chore: fixup patch indices * fixup! 3957079: Delete the CryptoToken component extension and internal API * 4008687: Finish ScopedAllowIO migration https://chromium-review.googlesource.com/c/chromium/src/+/4008687 * 3991548: Move WindowButtonOrderObserver and WindowFrameAction to LinuxUi https://chromium-review.googlesource.com/c/chromium/src/+/3991548 * fixup! 3984022: Add AddChildWindowToBrowser to DisplayClient mojo interface * 4016595: Migrate non-default ScopedObservation<> instantiations to ScopedObservationTraits<> in chrome/browser/ https://chromium-review.googlesource.com/c/chromium/src/+/4016595 * 4000481: Rename :chromedriver to :chromedriver_server Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4000481 * 4008687: Finish ScopedAllowIO migration https://chromium-review.googlesource.com/c/chromium/src/+/4008687 * 3988524: Remove DocumentOverlayWindowViews https://chromium-review.googlesource.com/c/chromium/src/+/3988524 * fixup! 3997795: Don't add Chromium as a login item * chore: fixup patches * 3996872: Plumb input event task runner to EventFactoryEvdev https://chromium-review.googlesource.com/c/chromium/src/+/3996872 * 4014994: Enable SiteIsolationForGuests by default. https://chromium-review.googlesource.com/c/chromium/src/+/4014994 * chore: adopt new thread restrictions api for //electron (#36357) chore: add thread blocking api * fixup! 4014994: Enable SiteIsolationForGuests by default. * pull parent HWND for dialogs on ui thread * chore: set parent_window in MessageBoxSettings * chore: remove redundant patch * chore: revert accidental deletion * chore: update patches Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@salesforce.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: George Xu <33054982+georgexu99@users.noreply.github.com> Co-authored-by: George Xu <georgexu99@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Robo <hop2deep@gmail.com> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> | 3 年前 | |
chore: cleanup includes of Win32 headers (#52713) * chore: cleanup includes of Win32 headers * chore: work around leaky defines in libuv | 2 个月前 | |
build: update v8_embedder_string from net patch effects (#54618) * fix: derive V8 cache compatibility from net patch effects Replace the custom V8 cache salt and Wasm embedded blob guard from #54234 with embedder string version hashing. Generate -electron.<16-hex fingerprint> during GN configuration from the net committed changes between Chromium's pinned V8 revision and patched HEAD. This requires no release time bookkeeping and preserves cache identities across packaging only changes to the patch series. * build: fix metadata generation and restoration * build: address review follow-ups - Keep code cache hash checks free of process global mutation - Limit the helper to DCHECK enabled builds - Make the fingerprint algorithm self contained and include it in the source cache key - Allow an explicit packager identity - Skip Wasm tests without generated assets - Correct the documentation structure * build: simplify V8 fingerprint regeneration tracking Track Git HEAD and the exported V8 patch series instead of symbolic branch refs, packed-refs, or Git directories. Detached checkout updates and patch exports trigger regeneration, while equivalent re-exports preserve the committed source fingerprint. Reject reftable storage explicitly and provide actionable diagnostics when the checkout does not contain Chromium's pinned V8 revision. * fix: gn check for release builds * chore: convert to vitest imports * chore: cleanup testing binding dependency * chore: update patches * chore: remove redundant dep declaration | 5 天前 | |
build: update v8_embedder_string from net patch effects (#54618) * fix: derive V8 cache compatibility from net patch effects Replace the custom V8 cache salt and Wasm embedded blob guard from #54234 with embedder string version hashing. Generate -electron.<16-hex fingerprint> during GN configuration from the net committed changes between Chromium's pinned V8 revision and patched HEAD. This requires no release time bookkeeping and preserves cache identities across packaging only changes to the patch series. * build: fix metadata generation and restoration * build: address review follow-ups - Keep code cache hash checks free of process global mutation - Limit the helper to DCHECK enabled builds - Make the fingerprint algorithm self contained and include it in the source cache key - Allow an explicit packager identity - Skip Wasm tests without generated assets - Correct the documentation structure * build: simplify V8 fingerprint regeneration tracking Track Git HEAD and the exported V8 patch series instead of symbolic branch refs, packed-refs, or Git directories. Detached checkout updates and patch exports trigger regeneration, while equivalent re-exports preserve the committed source fingerprint. Reject reftable storage explicitly and provide actionable diagnostics when the checkout does not contain Chromium's pinned V8 revision. * fix: gn check for release builds * chore: convert to vitest imports * chore: cleanup testing binding dependency * chore: update patches * chore: remove redundant dep declaration | 5 天前 | |
fix: don't allocate crash keys inside the v8 oom callback (#52591) * fix: don't allocate crash keys inside the v8 oom callback V8OOMErrorCallback records five electron.v8-oom.* crash keys through electron::crash_keys::SetCrashKey, which grows two std::deques and builds std::strings - allocation inside V8's out-of-memory handler, which can also fire on a V8 worker thread. In crash reports this shows up as the process dying inside SetCrashKey instead of at OOM_CRASH(), losing the OOM signature the keys were meant to record. Use statically registered fixed-storage crash_reporter::CrashKeyStrings and format the heap stats into a stack buffer with base::strings::SafeSPrintf, so nothing on the OOM path allocates. * refactor: consolidate v8 oom crash keys under one fixed-storage owner V8OOMErrorCallback recorded its electron.v8-oom.* keys through electron::crash_keys::SetCrashKey, whose registry grows two std::deques and is written from whichever thread reports the OOM, so a V8 worker thread races the main thread inside SetCrashKey. The renderer's near-heap-limit callback writes the same key names through the same registry from every isolate that registers it, so the race is cross-thread even without the OOM callback, and fixed keys added only to the OOM path would duplicate its annotations. Give the whole electron.v8-oom.* set one owner (statically registered crash_reporter::CrashKeyString storage in shell/common/v8_oom_diagnostics) shared by both callbacks, with an atomic first claim: the first isolate to hit an OOM records its diagnostics and later isolates return without writing, so concurrent OOMs cannot interleave and worker diagnostics are kept. The SetCrashKey path is removed from both call sites. * chore: route the heap-info fallback through v8_oom too * chore: fix clang-format * chore: fix format * chore: single-CAS owner claim; gn format filenames.gni | 2 个月前 | |
fix: don't allocate crash keys inside the v8 oom callback (#52591) * fix: don't allocate crash keys inside the v8 oom callback V8OOMErrorCallback records five electron.v8-oom.* crash keys through electron::crash_keys::SetCrashKey, which grows two std::deques and builds std::strings - allocation inside V8's out-of-memory handler, which can also fire on a V8 worker thread. In crash reports this shows up as the process dying inside SetCrashKey instead of at OOM_CRASH(), losing the OOM signature the keys were meant to record. Use statically registered fixed-storage crash_reporter::CrashKeyStrings and format the heap stats into a stack buffer with base::strings::SafeSPrintf, so nothing on the OOM path allocates. * refactor: consolidate v8 oom crash keys under one fixed-storage owner V8OOMErrorCallback recorded its electron.v8-oom.* keys through electron::crash_keys::SetCrashKey, whose registry grows two std::deques and is written from whichever thread reports the OOM, so a V8 worker thread races the main thread inside SetCrashKey. The renderer's near-heap-limit callback writes the same key names through the same registry from every isolate that registers it, so the race is cross-thread even without the OOM callback, and fixed keys added only to the OOM path would duplicate its annotations. Give the whole electron.v8-oom.* set one owner (statically registered crash_reporter::CrashKeyString storage in shell/common/v8_oom_diagnostics) shared by both callbacks, with an atomic first claim: the first isolate to hit an OOM records its diagnostics and later isolates return without writing, so concurrent OOMs cannot interleave and worker diagnostics are kept. The SetCrashKey path is removed from both call sites. * chore: route the heap-info fallback through v8_oom too * chore: fix clang-format * chore: fix format * chore: single-CAS owner claim; gn format filenames.gni | 2 个月前 | |
perf: use plain pointers in stack-only gin_helper types (#54287) refactor: use plain pointers in stack-only gin_helper types gin_helper's Invoker, ErrorThrower, Handle, ObjectBuilder, Promise::SettleScope and the V8 (de)serializer delegates are only ever constructed on the stack, for the duration of one binding call or one conversion. Holding their v8::Isolate / gin::Arguments / wrappable pointers in raw_ptr<> costs a BackupRefPtr acquire and release each time with nothing to protect: mark the types STACK_ALLOCATED() and use plain pointers, matching the upstream gin changes in https://crrev.com/c/8455783 and https://crrev.com/c/8455902. Also take the bound callback by const reference in Invoker::DispatchToCallback, matching https://crrev.com/c/8455325. | 26 天前 | |
perf: cut first-window, ipc, contextBridge, Buffer and asar overhead (#52923) * perf: preallocate the file descriptor table before threads start (linux) Linux grows a process's file descriptor table in powers of two on demand and, once the table is shared with other threads, expand_fdtable() waits for a full RCU grace period before freeing the old table. Whichever open()/socket()/memfd call crosses the 64-descriptor boundary in an already multi-threaded process eats that wait; in the browser process it lands inside the first `new BrowserWindow` (the renderer's channel and shared memory setup) and measured 55-115 ms of uninterruptible sleep in openat() on a 64-vCPU host, 10-30 ms being typical elsewhere. content's zygote already grows the table of every child it forks for this reason (content/zygote/zygote_linux.cc). Do the same in main() for the browser and the exec'd children: one F_DUPFD_CLOEXEC to descriptor 512 while the process is still single-threaded leaves a 1024-entry table (8 KB) behind and nothing else. Where RLIMIT_NOFILE is lower the fcntl fails and nothing changes. * perf: stop rebuilding the whole path per component in asar::GetAsarArchivePath GetAsarArchivePath() located the archive by calling DirName() once per path component and MatchesExtension() on each intermediate path (a BaseName() copy every time), then split the result with AppendRelativePath(), which runs GetComponents() over both the parent and the child. For a file inside app.asar that is dozens of string allocations per lookup, and the fs wrapper performs this lookup (asar.splitPath) for every fs call whose path mentions ".asar" - around ten per require()'d module. Scan the component boundaries as offsets into the existing string instead, hand only the candidate component to MatchesExtension(), and build the relative part with Append() from the components after the match. The outputs are byte-identical to before, including the existing corner cases (a real directory named *.asar is not an archive, the deepest matching component wins, doubled separators and a leading "." collapse the way Append() collapses them, a trailing separator on the archive path itself is kept); new asar-spec cases pin those down. * perf: keep context bridge proxy function state in the function's data array The proxy that contextBridge installs for a function carried its target, receiver and dynamic-property flag as three private properties on a state object, so every call through the bridge did three v8::Private::ForApi lookups (each allocating the key string) plus three GetPrivate calls before it could invoke anything. Store the three values in a packed v8::Array handed to v8::Function::New as the callback data and read them back by index. The array is only reachable through the function's data slot, exactly like the old state object, so nothing new becomes visible to either world; the original-function marker on the proxy itself stays a private property because that one has to live on a script-visible object. * perf: trim per-value work when the context bridge copies objects and arrays Copying a plain object or array across the bridge visits every value, and each visit paid for a trace event, three Blink wrapper probes (WebElement, WebBlob, VideoFrame) that can only ever match API wrapper objects, and, for object properties, an extra destination Context::Scope enter/exit on top of the source one. Arrays were also filled with one Set() per element. Skip the Blink probes unless the value is an API wrapper object, drop the inner trace event (the entry points keep theirs), read each property under the source scope and define it under the destination scope that is already active, and build array clones with the bulk v8::Array::New. The values produced, the object cache and the recursion order are unchanged. * perf: give V8's in-sandbox allocator a PartitionAlloc backend outside renderers Node allocates Buffer.allocUnsafe(), Buffer.allocUnsafeSlow() and the 64 KB Buffer pool refill through ArrayBuffer::Allocator::NewDefaultAllocator() (Electron's sandboxed-pointers patch), which under the V8 sandbox forwards to V8's built-in in-sandbox allocator. V8 documents that allocator as a slow placeholder embedders are expected to replace: it hands out page-granular regions under a global mutex and zero-fills even "uninitialized" requests. Blink replaces it for renderers (V8Initializer::InitializeInSandboxAllocator); the browser, utility and ELECTRON_RUN_AS_NODE processes never did, so every unpooled Buffer there paid a map/unmap round trip: Buffer.allocUnsafe of 1 MB ~300 us against ~12 us in a stock Node build, 64 KB ~30 us against ~2 us, and fs.readFile of a 1 MB file was several times slower than reading into a preallocated buffer. JavascriptEnvironment now installs an allocator with v8::V8::SetInSandboxAllocator() before the isolate is created, backed by gin's array buffer partition (which already lives inside the sandbox) the same way Blink's is backed by its ArrayBufferContents partition. PartitionAlloc refuses single allocations of ~2 GiB and more while the placeholder had no such cap, so requests above PartitionAlloc's limit go to the sandbox's address space directly (checked up front, so V8 never sees a failed allocation to retry) and Buffer.allocUnsafe of 2 GiB and more keeps working. Measured in the main process: allocUnsafe 64 KB 33 -> 5.6 us, 1 MB 297 -> 36 us, 4 MB 1691 -> 41 us, allocUnsafeSlow 1 MB 218 -> 13 us, fs.promises.readFile 1 MB 1.2 -> 0.9 ms. Page zeroing moves from the allocator to first touch, so a Buffer that is immediately written end to end pays the same faults later instead. * perf: serialize ipc values straight into the buffer they are sent in Values passed through ipcRenderer.send/invoke/sendSync/sendToHost, webContents.send, webFrameMain.send and their service worker equivalents travel as blink.mojom.CloneableMessage. For payloads above mojo's 64 KB inline limit that costs three fresh multi-megabyte buffers per hop: the V8 serializer grows a zero-filled std::vector, mojo copies that into a newly created shared memory region, and the receiving traits copy the region back out into another vector before V8 reads a byte. In profiles of 1-4 MB messages both main threads spent 30-40% of their time in page faults for those buffers. Electron owns both ends of these interfaces, so give them their own payload type: electron.mojom.SerializedValue is a BigBuffer plus the number of bytes written. The serializer keeps small values on the heap as before and, once V8 asks for more than the inline limit, continues in the shared memory region that will be sent, so the sender never holds a second copy. On the receiving side a renderer parses the region in place; the browser (and any other process) still parses a private copy, because the sender keeps write access to shared memory while it is read. MessagePort/postMessage paths keep blink's TransferableMessage, and the CloneableMessage overloads stay for in-process users (contextBridge, app 'second-instance' data). The serializer moves to shared memory once V8's request shows the value needs more than an inline message (not merely when the doubled request crosses 64 KB), and grows regions 4x from there, so a value written in many small pieces creates two or three regions rather than one per doubling; each region is a brokered round trip for a sandboxed renderer on Linux. Object-heavy payloads (arrays of small records) measure renderer -> main 1 MB 10.2 -> 10.2 ms and 4 MB 41.5 -> 39.9 ms with this, against +8% / +3% with per-doubling regions. * perf: size protocol and asar response pipes to the body Electron's URL loaders created their response data pipes with mojo's 64 KB default (the asar loader with a hard-coded 65536 copied from an old FileURLLoader), so every response larger than that reached the renderer in 64 KB slices, each one a producer wakeup on the browser main thread plus a consumer wakeup in the renderer. Chromium since sized these up: network::GetDataPipeDefaultAllocationSize() is 512 KB for ordinary loads and 2 MB (kLargerSizeIfPossible) for file://. A pipe is a shared memory buffer that base preallocates in full, though, so a uniformly larger pipe makes every small response measurably slower for the sake of the large ones. Instead, where the body size is known up front, size the pipe to the body with the same caps upstream uses: archive entries (file-like) up to the 2 MB file:// size, string/buffer responses and any protocol response that declares a Content-Length up to the 512 KB default. Streams of unknown length keep mojo's default. Small responses keep exactly the pipe they had; a 16 MB archive entry reaches the renderer in 8 slices instead of 256, a 16 MB protocol body with a known length in 32. * perf: remember module stat results for paths inside an archive Module resolution calls internalModuleStat() thousands of times while an app loads from app.asar, and most of those repeat a path it already asked about (parent node_modules directories, extension-less candidates): loading a 1040-module tree issues 6357 calls for 2751 distinct paths, 5065 of them misses. Node's own stat cache only remembers hits and only within one require() chain, so every repeat went back through the archive lookup. An archive's header never changes once it is open, so keep the answers derived from it in a Map keyed by the path (bounded, cleared when it grows past 16k entries). Answers that came from failing to open the archive are not kept, so an archive that appears later is still picked up. | 2 个月前 | |
refactor: provide the renderer API modules from their bindings (#53973) * refactor: create ipcRenderer natively `ipcRenderer` and the internal `ipcRendererInternal` were JavaScript classes extending EventEmitter that forwarded to an `electron_renderer_ipc` binding object, and a start-up module registered them as the targets for incoming messages. The binding now builds both objects itself when it is loaded into a context: instances of the shared native EventEmitter class with `send`/`sendSync`/`invoke`/`postMessage`/`sendToHost` implemented in C++ on an intermediate prototype (so, as before, they are not own properties and work unbound), and it registers them for incoming messages. The TypeScript modules re-export the binding's objects. gin_helper::GetNodeEventEmitterConstructor() caches one EventEmitter class per context so that these objects and the class exposed to scripts share a prototype. * refactor: create contextBridge natively The `contextBridge` module was a JavaScript wrapper that checked `process.contextIsolated` and forwarded to the `electron_renderer_context_bridge` binding. The binding now exports the module object directly, doing the context isolation check in C++ (the frame's web preference, or always allowed in a service worker preload realm), and in debug builds attaches the `internalContextBridge` helpers the tests use. * refactor: make webFrame an EventEmitter natively The `webFrame` module wrapped the `electron_renderer_web_frame` binding in JavaScript to make `WebFrame` an EventEmitter, to start emitting 'isolated-world-created' when something first listens for it, and to implement the deprecated `routingId` / `findFrameByRoutingId()` with a synchronous internal IPC to the browser. The binding now chains `WebFrame.prototype` to the context's native EventEmitter, hooks `on()` and friends for the lazy 'isolated-world-created' registration, and implements the two deprecated members over a sync call on ElectronWebContentsUtility, so the browser-side IPC handlers go away. The renderer `crashReporter` module likewise re-exports its binding. * refactor: receive transferred shared textures in the renderer natively `sharedTexture.sendSharedTexture()` reached the target frame through an internal IPC round trip answered by the renderer-side `sharedTexture` module, which imported the texture, replied with its sync token and called the receiver registered with `setSharedTextureReceiver()`. That now happens over mojom::ElectronFrame::ReceiveSharedTexture(), implemented by ElectronApiServiceImpl: it imports the texture with the `electron_common_shared_texture` binding in the frame's Electron context, replies with the frame creation sync token (or the error), and invokes the registered receiver with the same `{ importedSharedTexture }` object as before. The receiver is registered natively by the binding, so the renderer module is a plain re-export and the last `invokeInWebFrameMain` helper is removed. * fix: address review comments on the native renderer API modules - Import a transferred shared texture by calling shared_texture::FinishTransferSharedTexture() directly rather than going through the binding's exports object. - WebFrame's listener hooks carry the EventEmitter.prototype method they defer to as callback data instead of looking it up on every call. | 1 个月前 | |
chore: add ELECTRON_ prefix to C++ include guards (#31925) | 4 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 18 小时前 | ||
| 8 天前 | ||
| 10 天前 | ||
| 1 天前 | ||
| 1 天前 | ||
| 6 个月前 | ||
| 4 年前 | ||
| 3 天前 | ||
| 3 天前 | ||
| 3 天前 | ||
| 3 天前 | ||
| 7 天前 | ||
| 26 天前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 1 个月前 | ||
| 11 个月前 | ||
| 25 天前 | ||
| 25 天前 | ||
| 2 个月前 | ||
| 4 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 3 个月前 | ||
| 1 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 12 天前 | ||
| 6 个月前 | ||
| 1 年前 | ||
| 4 年前 | ||
| 26 天前 | ||
| 1 年前 | ||
| 2 个月前 | ||
| 2 年前 | ||
| 4 年前 | ||
| 1 年前 | ||
| 6 年前 | ||
| 1 个月前 | ||
| 25 天前 | ||
| 4 年前 | ||
| 4 天前 | ||
| 16 天前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 21 天前 | ||
| 1 个月前 | ||
| 3 天前 | ||
| 2 个月前 | ||
| 9 个月前 | ||
| 2 个月前 | ||
| 25 天前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 年前 | ||
| 2 个月前 | ||
| 11 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 2 个月前 | ||
| 5 天前 | ||
| 5 天前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 26 天前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 4 年前 |