Repository navigation
Conversation
snackzone
force-pushed
the
zm-caret-browsing-api
branch
3 times, most recently
from
August 6, 2026 22:46
f2289d9 to
001ee73
Compare
…)` (electron#51563) * feat: wire iCloud Keychain into Chromium's FIDO discovery stack Adds ElectronICloudKeychainAuthenticator (FidoAuthenticator adapter) and ElectronICloudKeychainDiscovery (FidoDiscoveryBase) so that navigator.credentials.create() and .get() route through ElectronPasskeyController when iCloud Keychain is enabled via app.configureWebAuthn(). Also refactors ElectronPasskeyController to support conditional mediation and improves the delegate's CreatePlatformDiscoveries() hook. Co-Authored-By: Claude <[email protected]> satisfy linter refactor: rename iCloudKeychain → platformPasskeys and add select-webauthn-authenticator event Delete the ElectronPasskeyController abstraction and fold ASAuthorizationController logic directly into ElectronPlatformPasskeysAuthenticator. Rename all iCloudKeychain references to platformPasskeys since ASAuthorizationController serves any Credential Provider Extension, not just iCloud Keychain. Add a select-webauthn-authenticator session event that fires when both Touch ID and platform passkeys are configured, letting the app choose which authenticator to dispatch to, fixing the dual-prompt bug where both prompts appeared simultaneously. Co-Authored-By: Claude <[email protected]> Fix up copyright headers Guard macOS-only code with build flag, address linting issues fix: override GetPlatformCredentialInfoForRequest to prevent crash on get() The base class FidoAuthenticator hits NOTREACHED() if a platform authenticator doesn't override this method. Return kUnknown since ASAuthorizationController has no pre-flight credential query API. Co-Authored-By: Claude <[email protected]> Prefer GetGlobalFrameToken() over GetGlobalId(), replace manual v8::Array + CreateDataProperty loop with a std::vector<std::string>, documentation improvement Add props directly to the select-webauthn-authenticator event rather than emit additional details object * Fix up unit test and tweak documentation to call out listener requirement for navigator.credentials.get() calls * fix: use ASPublicKeyCredentialClientData SPI so RPs can verify assertions Apple's ASAuthorizationController constructs its own clientDataJSON and signs over it. Without this fix Chromium returned its own (different) JSON to the page, causing signature verification to fail server-side. Changes: - Add Chromium patch: `raw_client_data_json` override field on AuthenticatorMakeCredentialResponse / AuthenticatorGetAssertionResponse, threaded through authenticator_common_impl.cc. - Parse challenge+origin from request.client_data_json and pass them to Apple via ASPublicKeyCredentialClientData (macOS 13.5+). - Capture rawClientDataJSON from the credential response and set it on the FIDO response so the page receives what Apple actually signed. - Reject MakeCredential early when ES256 is not in the RP's algorithm list (platform passkeys only support ES256). - Wrap excludedCredentials in @available(macOS 13.5, *) guard. Verified end-to-end: RP receives assertion where signatureVerifiesAgainstReturnedJSON: true, challengeMatchesIssued: true. Co-Authored-By: Claude <[email protected]> * fix: address PR review nits on authenticator dispatch and isUVPAA - Guard OnAuthenticatorSelected against repeat invocations. The emit callback is a repeating callback, so an app calling it twice would otherwise fall through to the unknown-name branch and cancel a request we had already dispatched. - Override IsUserVerifyingPlatformAuthenticatorAvailableOverride so that isUVPAA() reports true when platform passkeys are enabled and available. The default implementation only reports on Touch ID, so apps with only platform passkeys configured would report false and most sites would hide their passkey UI. Co-Authored-By: Claude <[email protected]> * harden: validate Apple's rawClientDataJSON before returning it to the page The Chromium patch that added raw_client_data_json lets an authenticator substitute the clientDataJSON returned to the RP. That override needs to be trustworthy: WebAuthn's anti-phishing property depends on the origin, challenge, and type in clientDataJSON accurately reflecting the frame's real origin, the RP-issued challenge, and the ceremony type. We build ASPublicKeyCredentialClientData ourselves from Chromium's trusted client_data_json, so the values we hand Apple are safe. But we then take Apple's rawClientDataJSON output and forward it verbatim, which trusts Apple to have echoed those values faithfully. Any framework bug, type confusion, or SPI drift could silently forward JSON with a mismatched origin, wrong ceremony type, or unexpected crossOrigin: true. Add a ValidateAppleClientDataJSON helper that checks Apple's returned JSON against the expected challenge, origin, type, and crossOrigin before accepting it as the override. On mismatch, drop the override and fall back to Chromium's client_data_json — the RP will fail signature verification (as it should) rather than seeing surprising bytes. Stash the expected values on ObjCStorage when the SPI is used so the completion handlers can validate against the same inputs. Co-Authored-By: Claude <[email protected]> * test: cover isUVPAA delegate override for platformPasskeys Add a spec that asserts navigator.credentials.isUserVerifyingPlatform- AuthenticatorAvailable() returns true when platformPasskeys is enabled, which exercises IsUserVerifyingPlatformAuthenticatorAvailableOverride in the delegate. Without the override, Chromium's default only checks Touch ID and returns false when only platform passkeys are configured. Co-Authored-By: Claude <[email protected]> * refactor: use public AuthenticationServices API for clientDataJSON Drop the private `clientData` KVC setter on the ASAuthorization requests. The setter is Apple SPI (the public `clientData` property is readonly; the public setter lives on the web-browser-entitled provider Electron can't use), and referencing it fails App Store static analysis, so it would have had to be gated off for MAS builds. Testing on real hardware showed the SPI is unnecessary for a domain-associated app: passing the raw challenge to the public createCredentialRegistrationRequestWithChallenge: / createCredentialAssertionRequestWithChallenge: initializers makes Apple build a real clientDataJSON — with our challenge and the associated-domain origin (https://<rpId>) — and sign over its hash. That JSON comes back on the public `rawClientDataJSON` getter for both create() and get(), so the RP can verify the signature against it. Origin override (the SPI's only remaining benefit) isn't legitimate for a non-browser app anyway: https://<rpId> is the correct origin for a domain-associated actor. Capture rawClientDataJSON unconditionally from the public getter and validate it against the associated-domain origin before returning it to the page. No private symbols remain, so no MAS gating is required. Also update the Chromium patch prose to drop the now-inaccurate ASPublicKeyCredentialClientData reference. Co-Authored-By: Claude <[email protected]> * fix: address platform passkey review feedback - Reject requests whose clientDataJSON challenge can't be parsed instead of falling back to client_data_hash (which Apple re-hashes, breaking RP verification). Same in MakeCredential and GetAssertion. - Reject cross-origin (iframe) ceremonies rather than presenting them to the RP as same-origin, since the public API can't carry the frame origin — Apple always builds a top-level origin: https://<rpId> clientDataJSON. - Fail the ceremony when Apple's returned clientDataJSON doesn't validate, instead of forwarding Chromium's JSON and stranding a keychain credential that can never verify RP-side. - Reset objc_storage_ at the start of each operation so stale expected challenge/origin/type can't bleed across requests. - Log an actionable DevTools message on ASAuthorizationError 1004, and document the signing / provisioning-profile / associated-domain (AASA) requirements plus the origin: https://<rpId> expectedOrigin note in app.md. Co-Authored-By: Claude <[email protected]> * fix: harden excluded-credential mapping and add credential-ID parity check - Map excluded-credential rejections on every supported macOS version: macOS 13.5-14 surfaces them as WKErrorDomain code 8, macOS 15+ as ASAuthorizationErrorMatchedExcludedCredential (1006). Previously only 1006 was handled, so create() with a matching excludeCredentials entry returned NotAllowedError instead of the spec-required InvalidStateError on 13.5-14. Capture the error domain as a string (not a bool) to distinguish the two. - Correct the stale "1006 was added in macOS 14" comment — it is macOS 15. - Add a defense-in-depth check that the credential ID in the attested authenticator data matches ASAuthorization...Registration.credentialID, failing kAuthenticatorResponseInvalid on mismatch. Mirrors Chromium's device/fido/mac/icloud_keychain.mm. - Clarify that the isUVPAA override reports capability, not configuration: a misconfigured (unsigned / no embedded profile / no AASA) app still gets true and then fails the ceremony with error 1004. Co-Authored-By: Claude <[email protected]> * style: satisfy oxfmt in api-web-authn-spec Collapse a wrapped executeJavaScript() call onto one line to match oxfmt. Co-Authored-By: Claude <[email protected]> * docs: drop macOS 13 version qualifiers for platform passkeys macOS 12 is no longer supported (electron#51967), so macOS 13 is the minimum deployment target and the "requires macOS 13" caveats are redundant. Remove them and the now-unreachable "below 13.0 fallback" note. Addresses review feedback from jkleinsc. Co-Authored-By: Claude <[email protected]> * chore: update patches --------- Co-authored-by: Claude <[email protected]> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
…tron#52603) * fix: exit gracefully when the display server connection is lost The Ozone shutdown callback that runs when the X11/Wayland connection breaks went straight to LOG(FATAL), so every X server exit or compositor restart produced a crash report. Add Browser::ExitWithCode() (the app.exit() path, callable from native code), have the callback force-exit like app.exit(0), and keep the FATAL as a 10-second delayed watchdog in case exiting hangs. * chore: address review feedback * chore: fix include order * chore: use a watchdog delegate for the shutdown alarm * chore: fix format * chore: let the watchdog cover the missing-Browser case
…skill (electron#52681) Review feedback on electron#52567 flagged two commit-organization problems in agent-driven Chromium rolls, both traceable to gaps in this skill's commit guidelines: - Two commits for the same upstream CL (8131017): Phase One committed the patch-context fixes, then Phase Two hit build fallout from the same CL and the phase-two guidelines prescribed a fresh `{CL-Number}: {title}` commit without ever saying to check for an existing one. Fixed by requiring a `git log --grep` check before any CL-titled commit and folding into the existing commit with `git commit --fixup` + autosquash (keeping the lint-legal `fixup!` commit if the rebase conflicts). - Unrelated CLs (8171126 + 8131017) grouped into one commit because they dirtied the same .patch files and the guidelines' multi-Ref allowance had no "genuinely related" qualifier. Fixed by requiring per-CL staging with `git add -p` and narrowing when multiple Ref lines are appropriate. Also adds a final self-check step to the Phase Two workflow: scan full commit messages (`git log --format='%h %B'` — Ref lines live in bodies) and verify each CL maps to exactly one non-fixup commit. Claude-Session: https://claude.ai/code/session_01Fbjy87RXmaLqHXr8nhofJU Co-authored-by: Claude <[email protected]>
…#52687) Assisted-by: GPT-5.6 Sol
Exposes the existing Blink renderer preference `caret_browsing_enabled` as a settable property on webContents. Blink already applies this preference on every renderer preferences sync, so toggling it takes effect immediately without a reload. Enables assistive-technology use cases that need a keyboard-navigable caret in page content, which Chrome offers but Electron had no API for. The specs arrow through non-editable prose rather than only reading the preference back, because Blink honors the caret movement editor commands in non-editable content only when caret browsing is on — so that is what actually observes the renderer having received the preference. Refs electron#31339 Co-Authored-By: Claude Opus 5 <[email protected]>
* ci: upload audit findings as an audit-results artifact * docs: name the workflows that upload the audit-results artifact * ci: upload audit results unzipped * ci: retrigger checks --------- Co-authored-by: Claude <[email protected]>
snackzone
force-pushed
the
zm-caret-browsing-api
branch
3 times, most recently
from
August 7, 2026 23:39
581c824 to
415bc00
Compare
Blink draws and moves a caret once caret_browsing_enabled is set, but assistive technology is never told, so a screen reader stays silent. Notify ui::AXPlatform too, as Chrome does in renderer_preferences_util.cc. It is process-wide while the preference is per-WebContents, so refcount the instances that enable it. * Caret attributes gate on AXPlatform::IsCaretBrowsingEnabled() before falling back to AXNode::HasVisibleCaretOrSelection(), which is false for a collapsed caret in non-editable content; untold, macOS reports NSNotFound and Windows never fires IA2_EVENT_TEXT_CARET_MOVED. * A mirror would let one window disabling caret browsing degrade accessibility in another; Chrome's input is a uniform profile pref. * Reconcile from a cached flag, before the preference-equality early return and at construction: a <webview> guest inherits the embedder's preferences via BrowserPluginGuest::InitInternal(), so a delta taken from the preference transition would release an uncounted reference. * The destructor releases from the cached flag before its early returns, since web_contents() may be gone and the state must not stay pinned. Co-Authored-By: Claude Opus 5 <[email protected]>
snackzone
force-pushed
the
zm-caret-browsing-api
branch
from
August 8, 2026 00:10
415bc00 to
261fdb3
Compare
Assisted-by: Claude Opus 5 Assisted-by: GPT-5.6 Sol
…dates (electron#52695) Bumps the npm_and_yarn group with 2 updates in the / directory: [brace-expansion](https://github.com/juliangruber/brace-expansion) and [fast-uri](https://github.com/fastify/fast-uri). Updates `brace-expansion` from 1.1.16 to 1.1.18 - [Release notes](https://github.com/juliangruber/brace-expansion/releases) - [Commits](juliangruber/brace-expansion@v1.1.16...v1.1.18) Updates `fast-uri` from 3.1.4 to 3.1.5 - [Release notes](https://github.com/fastify/fast-uri/releases) - [Commits](fastify/fast-uri@v3.1.4...v3.1.5) --- updated-dependencies: - dependency-name: brace-expansion dependency-version: 1.1.18 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: fast-uri dependency-version: 3.1.5 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Adds electron-security-backports[bot] (app user id 312726202) to the trusted-bots list in .github/faraday.yml, so its Chrome security cherry-pick PRs need 1 maintainer approval instead of 2 — the same tier as trop[bot] and electron-roller[bot]. Claude-Session: https://claude.ai/code/session_01Xdg3Bw4qNE91fToLjrJxsz Co-authored-by: Claude <[email protected]>
…2591) * 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
Node.js now enables Float16Array on the global object and includes <cstdlib> in builtin_info.cc. The corresponding Electron patches are therefore no-ops on Node.js v24.18.1. Remove both patches and re-export the Node.js patch series. Refs: nodejs/node#58154 Refs: nodejs/node#63001
* build: update linux-arm64 PGO profile * build: update linux-x64 PGO profile * build: update macos-arm64 PGO profile * build: update macos-x64 PGO profile * build: update v8-builtins PGO profile * build: update win-arm64 PGO profile * build: update win-x64 PGO profile --------- Co-authored-by: electron-pgo-updater[bot] <290827142+electron-pgo-updater[bot]@users.noreply.github.com>
Extracted verbatim from assetsForVersion()'s patterns array in script/release/release.ts so Sudowoodo can read a structured manifest instead of regex-parsing the TypeScript source. Co-authored-by: Claude Fable 5 <[email protected]>
Link the "caret browsing" string in both method descriptions to the property's section, per review feedback. Co-Authored-By: Claude Opus 5 <[email protected]>
…ctron#52856) Loading `tls` makes Node start a background thread that parses the CA certificates. Node joins that thread in TearDownOncePerProcess(), which Electron never called, so a process that loaded tls/https and exited soon after could have exit() destroy Node's static mutexes underneath that thread and abort(). Call node::TearDownOncePerProcess() at the end of the ELECTRON_RUN_AS_NODE entry point, from the NodeBindings instance that initialized Node (browser and utility processes), and before the direct exit() that app.exit() takes when called before 'ready'.
* chore: cleanup includes of Win32 headers * chore: work around leaky defines in libuv
* chore: add triage-prs skill and script Adds a PR triage helper script that classifies open PRs by CI status (green/failing/pending/none), annotates them with their PR Triage board Status, excludes WIP, and flags new-pr PRs. Includes a Claude skill wrapping the script with faraday and failing shortcuts. Assisted-by: Claude Opus 4.8 * chore: tighten triage-prs skill docs and colocate script Rewrites the frontmatter description for skill selection: adds "triage" triggers so the description matches the skill name, narrows the over-broad bare "failing" trigger to "failing prs", and drops the trailing runtime instructions, which referenced body content that is not loaded at match time. Documents the draft/WIP exclusions and the multi-minute runtime, both of which were previously silent, and trims the jq/OSC-8 internals that only cost context at invocation time. Also fixes --help truncating before --repo/--limit/--help (hard-coded sed range) and moves the script alongside SKILL.md. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Samuel Attard <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…2872) Since the main process started booting from the embedded Node.js startup snapshot (electron#51703), its context is deserialized from that blob, which was built on top of the stock snapshot_blob.bin at build time. Objects a custom snapshot puts into the default context -- electron-mksnapshot users, and the browser_v8_context_snapshot.bin the loadBrowserProcessSpecificV8Snapshot fuse selects -- therefore never showed up in the main process on native builds (mac arm64, linux x64, win x64), while cross-built targets, which ship without the Node snapshot, kept working. spec/fixtures/snapshot-items-available ("f is not defined") reproduces it, but CI only ran verify-mksnapshot.py with --create-snapshot-only since the GHA migration. Skip the embedded Node snapshot for the main process when the fuse is on or the loaded v8 context snapshot is not the one this build shipped, and bootstrap Node from scratch on the loaded blob as snapshot-less builds do. The check is a size + V8-blob-header comparison against constants that build/checksum_header.py now emits next to the existing SHA-256, so it costs nothing at startup. Re-add the full verify-mksnapshot.py run to one native test leg (linux x64).
…lectron#52874) node_use_node_snapshot / node_use_node_code_cache were gated to host_cpu == target_cpu, so the targets Electron cross-builds -- linux arm64 and win arm64 (x64 hosts) and mac x64 (arm64 hosts) -- shipped without the embedded Node snapshot and its builtin code cache, and every process there still ran the full Node bootstrap. node_mksnapshot already builds in v8_snapshot_toolchain, like mksnapshot and v8_context_snapshot_generator. Unlike those it executes target-CPU code (the Node bootstrap runs in JS), so the requirement is a snapshot toolchain that can run what its V8 emits: V8's arm64 simulator on x64 hosts (linux clang_x64_v8_arm64, the win host toolchain with v8_target_cpu = arm64), or an x64 binary under Rosetta on arm64 macs, which is what Electron CI's v8_snapshot_toolchain = "//build/toolchain/mac:clang_x64" override for mac x64 already provides. The one same-OS combination that cannot work is V8's default for mac arm64 -> x64, clang_arm64_v8_x64 (arm64 binary emitting x64 code, no simulator) -- that is the crash the old TODO in node.gni described. Neither the snapshot nor the code cache contains machine code, so what a cross node_mksnapshot produces is valid on the target; the js2c code cache is already generated cross-arch the same way. So gate both on host_os == target_os except that toolchain, and give the node_snapshot / node_snapshot_stub source_sets the //base:debugging_buildflags dependency that node_builtins.h's base/dcheck_is_on.h include needs (a fresh out dir building only third_party/electron_node:node_snapshot failed on the missing generated header). Also brings the patch description up to date. Verified on a linux x64 host with target_cpu = "arm64": node_mksnapshot runs under the simulator (blob 4.9 MB, 392-entry / 2.8 MB code cache, same shape as native), the snapshot-keyed browser js2c cache tool runs, and electron links with the snapshot embedded. Booting it needs arm64 hardware; the js2c code-cache spec's browser assertions and process.config.variables.node_use_node_snapshot cover it on the arm64 test legs. mac x64 and win arm64 are by construction, untested locally.
…ron#52721) * ci: parallelize independent setup steps in build and test jobs * ci: regenerate publish pipeline segment --------- Co-authored-by: Claude <[email protected]>
…ron#52682) * fix: keep WebAuthn platform passkey error paths from hanging the request The request handlers ignore kAuthenticatorResponseInvalid from a kICloudKeychain-type authenticator, so every reject path left the page pending until the WebAuthn timeout. Report a terminal status instead, advertise ES256 via GetAlgorithms() so non-ES256 registrations are pre-filtered rather than routed into the base GetTouch() no-op, and log response-validation failures to the DevTools console. * fix: harden webauthn authenticator selection dispatch and cross-origin routing Running the request/cancel callbacks can complete the request synchronously and destroy the delegate, so consume selection state before running them (same pattern as OnAccountSelected), guard the default dispatch against an already-consumed selection, and don't offer the platform passkeys discovery to cross-origin frames Apple's API cannot serve - other transports can still handle those requests. * fix: validate platformPasskeys strictly in configureWebAuthn Reject non-boolean values with a TypeError like the touchID options do (gin's converter silently coerced them), treat null/undefined as not set, and validate before applying so a throw leaves the existing configuration untouched. Also reset the process-global flag between spec suites. * docs: clarify platform passkey scope, extensions, and selection-event semantics
…n#52222) * docs: desktopName is the Linux portal identity; document Wayland shortcut flow desktopName sets CHROME_DESKTOP, which becomes the Wayland app_id / WM_CLASS, the systemd scope name, and the app ID xdg-desktop-portal reports to portal backends. Portals now enforce that identity (GNOME 50 denies GlobalShortcuts binds for invalid IDs), so document the reverse-DNS requirement and the Wayland portal flow for globalShortcut: consent dialog on GNOME, silent binds on KDE, persistence across relaunches, the feature flag currently needed on GNOME, and the optimistic register() return value. * docs: address review feedback - drop CHROME_DESKTOP and systemd scope implementation details - point reverse-DNS naming guidance at the Desktop Entry spec - remove the xdg-desktop-portal dashed-name parsing bug callout - update the GNOME feature flag guidance: portal path is now enabled by default (electron#52221) - hold off documenting the optimistic register() behavior until the async registration API lands No-Verification-Needed: docs-only change
Notes: Fixed a regression preventing from transparent frameless windows from being resized on Linux.
SetContentView detached the previous content view with RemoveChildView, which removes it from the view hierarchy without destroying it. For views Electron owns (not owned_by_client), this leaked the view on every replacement. Use RemoveChildViewT to delete views we own, keep RemoveChildView for client owned views that must outlive removal, and clear content_view_/focused_view_ before removal so neither references a destroyed view.
…ectron#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 electron#52141. No-Verification-Needed: Windows-only source not built on this host; verified via Windows CI experiment
…nts lives (electron#52847) * fix: keep remote api::WebContents alive while their content::WebContents lives The api::WebContents wrapping a DevTools WebContents is created up front in InspectableWebContents::ShowDevTools but only referenced again once the frontend has loaded. It is a kRemote WebContents, so nothing pinned it and a GC in between collected its wrapper; DevToolsOpened() then either got an empty handle back from FromOrCreate() and crashed dereferencing it, or created a second api::WebContents for the same DevTools WebContents. Pin remote api::WebContents in the constructor and unpin them in WebContentsDestroyed(), the same mechanism background pages already use. Fixes electron#52158 * chore: format spec No-Verification-Needed: formatting-only change
electron#52862) * perf: don't interrupt the uv loop for I/O changes made inside uv_run() Electron configures Node's libuv loop with UV_LOOP_INTERRUPT_ON_IO_CHANGE so that starting a timer/handle/watcher from a Chromium task wakes the embed thread, which may be blocked polling the backend fd with a stale timeout. The interrupt also fired for changes made while uv_run() itself was executing (e.g. Node toggling its immediate idle handle or timer handle on most ticks inside UvRunOnce), where nobody is polling: each of those cost a write()/kevent()/PostQueuedCompletionStatus on the main thread and made the embed thread's next poll return immediately, scheduling an extra empty UvRunOnce task per tick. Track uv_run() nesting in the loop's private internal fields and skip the I/O-change interrupt while it is non-zero. Once uv_run() returns the embedder re-reads uv_backend_timeout(), which already accounts for the change. uv_async_send() is unaffected. On Linux an idle app with a 10 ms setInterval goes from ~94 eventfd writes/s on the main thread and two UI-thread wakeups per tick to zero writes and one wakeup per tick, with identical timer/immediate ordering and latency. Also repairs the patch's test-embed.c (it no longer compiled against the current MAKE_VALGRIND_HAPPY signature) and adds a case that starts a timer from inside uv_run(UV_RUN_NOWAIT), asserting the external poller still fires it on time and, on Linux, that no interrupt was written. * chore: drop upstreaming note from patch description libuv/libuv#3308 is closed, so the sentence suggesting the gated variant be proposed there no longer applies. Description-only change. No-Verification-Needed: patch description text only * refactor: suspend the io-change interrupt from UvRunOnce instead of inside uv_run() Keying the gate on "uv_run() is on the stack" also covered a foreign nested uv_run() issued from a Chromium task (a native module pumping the loop), where the embed thread is polling with a stale timeout and does need the wakeup. Replace the in_run counter with an embedder-controlled uv_loop_interrupt_suspend()/resume() depth and wrap only UvRunOnce's uv_run() in it, since that is where the embed thread is known to be parked on embed_sem_. * chore: update patches --------- Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
) fix: generate the Node startup snapshot once per build run_node_mksnapshot was instantiated in every toolchain that pulled in ":node_snapshot", so a cross build ran it twice: once in the default toolchain for the shipped framework, once in v8_snapshot_toolchain for the host tool that generates the browser process's js2c code cache. Two runs are not guaranteed to produce the same snapshot, and on Windows they do not, so the tool built its cache against a read-only heap the framework never embedded and V8 rejected every entry at startup with a read-only snapshot checksum mismatch - the browser process compiled browser_init, utility_init and node_init from source instead. Define the action only in the default toolchain and have each toolchain's ":node_snapshot" compile that one output, so the snapshot the cache is keyed to is the snapshot the framework ships. Notes: none
…2883) * build: trim the non-link overhead of macOS release builds Four independent, low-risk changes aimed at the macOS release job, which today spends well over an hour outside the ThinLTO links themselves: * Zip Symbols: `tar --options xz:threads=0` does not actually multi-thread on macOS (Apple's liblzma emits a single block), so the ~7 GB of dSYMs were being compressed by one core at preset -6, ~30 minutes per job. Pipe the tar stream through the xz binary with -T0 instead (falling back to the tar options when xz is not on PATH), and use preset -3, which is ~5x faster than -6 for ~12% larger output. Same .tar.xz format. * siso: set SISO_EXPERIMENTS=no-fallback on macOS. When a remote compile exceeds siso's 2 minute client-side deadline (RBE queueing, an upload stall) siso re-runs it locally; on the 5-core / 14 GB runners a local ThinLTO compile takes 5-10 minutes and lands on the critical path (75 such fallbacks in a recent release build, 570 in a testing build). no-fallback retries remotely with a 4x longer deadline instead. * GN: thin_lto_enable_cache=false for macOS release builds. CI starts from a fresh out dir, so the ThinLTO cache is written (~100 GB across a release build's links) and never read, competing for IO with links that are already swapping. Local builds keep the default. * build-stats: hash object files on worker threads and only walk obj/ and <toolchain>/obj/. The previous recursive readdir of the whole out dir (~800k entries) plus single-threaded sha256 of ~6 GB took 2-3 minutes; this takes seconds. Objects outside those trees (SDK crt*.o, rust sysroot copies) are no longer counted, which does not affect the change rate metric since only files present in both snapshots are compared. No-Verification-Needed: CI config and build scripts only, no product code * build: use context managers for the tar|xz pipeline (pylint R1732) * build: read only the tail of siso.INFO in build-stats.mjs siso.INFO grows with the step count and a release build's already exceeds V8's maximum string length once a second toolchain is in the graph, which made build-stats.mjs fail with 'Invalid string length'. The stats line is at the end of the log, so read the last 16 MB instead of the whole file. * build: drop SISO_EXPERIMENTS=no-fallback on macOS Under RBE queue pressure a remote compile can stay EXECUTING past siso's deadline; with no-fallback siso retries (deduped onto the same running op) and then fails the build outright, which is worse than a slow local fallback for PR CI. Give remote compiles a longer deadline in build-tools' siso config instead and keep the fallback as the safety net. * build: link the macOS snapshot tools without ThinLTO in release builds (electron#52884) * build: link the macOS snapshot tools without ThinLTO in release builds In official builds v8_snapshot_toolchain is the target toolchain, so mksnapshot, node_mksnapshot, v8_context_snapshot_generator and the natives code-cache generator are each a full ThinLTO+PGO link of V8 (and Blink, and Node) with dsymutil. On the 5-core / 14 GB macOS CI runners those four links take 12 + 6 + 20 + 2 minutes (21 + 46 min on x64, where they also run under Rosetta), run serially through a link pool of depth 1, and page heavily (5-9 GB RSS each), all before the Electron Framework link can start. Their outputs are snapshot/code-cache data that does not depend on how optimized the tool binary is. Add //electron/build/toolchain/mac with variants of the mac toolchain that turn off ThinLTO, PGO and debug info (symbol_level=0, so the extra objects are small and dsymutil has nothing to link) and point macOS release builds' v8_snapshot_toolchain at them: clang_arm64_snapshot for arm64 and clang_x64_snapshot for x64 (still x64 so mksnapshot.zip keeps shipping an x64 mksnapshot). V8/Blink/Node compile a second time in that toolchain, but remotely and cacheably. Because the tools now live under $root_out_dir/<toolchain>/, mksnapshot.zip is flattened on macOS so its layout is unchanged (mksnapshot, v8_context_snapshot_generator, their dylibs and icudtl.dat at the root), and build/zip.py learns to apply PATHS_TO_SKIP relative to a toolchain dir and to drop duplicates when flattening. The resulting file set is identical to the default-toolchain one. Testing builds are unaffected (no LTO there, so nothing to gain from a second toolchain). No-Verification-Needed: build config and packaging script only * build: update build-tools for remote generators and longer remote compile deadlines (electron#52896) Picks up electron/build-tools#889 and electron#890: * siso runs the mojom, Blink bindings, grit strings and TypeScript/WebUI generators on RBE workers instead of locally (all hosts). On the 5-core macOS runners those steps are about a CPU-hour of python/node per release build, contending with siso's include scanning during the fetch phase; remotely they are also cached, so unchanged generators become cache hits on every host. * remote clang steps on macOS hosts get a 10 minute client-side deadline instead of 2 minutes, so ordinary RBE queueing no longer triggers the 5-10 minute local ThinLTO fallback compiles that land on the critical path (75 in one release build, 570 in a testing build). Local fallback stays as the safety net.
…e cache (electron#52873) Since electron#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
…loads (electron#52820) * chore: roll Squirrel.Mac for streamed, resumable and delta update downloads Rolls squirrel.mac to fffea30 (Squirrel/Squirrel.Mac#327, electron#328, electron#330): * the update ZIP streams to disk through an NSURLSession download task instead of arriving as one in-memory NSData, an interrupted transfer resumes on the next check (and after a relaunch) when the server provides a validator and honours Range, and a feed may declare `sha256`/`size` for the ZIP, checked before it is unpacked; * a feed may offer `delta`, a Sparkle BinaryDelta patch from one earlier build, applied to a copy of the running app and verified like an unpacked ZIP, with the ZIP as fallback in the same check. Squirrel compiles Sparkle's BinaryDelta apply sources and the bsdiff it vendors into the framework, so Sparkle 2.9.5 becomes a DEPS entry at vendor/Sparkle (gclient does not initialise Squirrel's submodule) with a licenses.py entry, and the GN config gains those sources with the flags Squirrel's Xcode project gives them, the new Squirrel sources, and -lbz2 -lcompression -lz. The autoUpdater docs describe the behaviour and the optional feed keys. * fixup! visibility of sparkle_binary_delta mac_framework_bundle() expands squirrel_framework into inner targets (squirrel_framework_shared_library links the sources), so limit the source_set to this file rather than to the template's outer name.
…reated during quit (electron#52836) * fix: unregister isolate dispose observers in their destructors Session, GlobalShortcut and AutoUpdater add themselves as gin::PerIsolateData::DisposeObserver on construction but only removed themselves from inside OnBeforeMicrotasksRunnerDispose. An instance created after that notification has run (for example from a webContents 'destroyed' handler that fires during exit cleanup) stayed in the observer list, was finalized together with the cppgc heap inside v8::Isolate::Dispose(), and the NotifyDisposed() pass that follows then walked a freed CheckedObserver and hit its CHECK. Remove the observer in the destructor instead, which covers both the notified and the late-created case, and make Session::Dispose() key on browser_context_ rather than keep_alive_ (persistents are already cleared when finalizers run at heap teardown) so a late session also drops its DownloadManager observer before the browser context goes away. * fix: notify isolate dispose observers after CleanedUpAtExit cleanup Send OnBeforeMicrotasksRunnerDispose from JavascriptEnvironment::DestroyMicrotasksRunner() once DoCleanup() has run, instead of from gin's WillDestroyMicrotasksRunner() before it, so that observers created by JS running during cleanup are notified and unregister themselves like the rest. This replaces unregistering Session, GlobalShortcut and AutoUpdater in their destructors.
…37.7 (electron#52932) build(deps): bump github/codeql-action/upload-sarif Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from 4.37.6 to 4.37.7. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@5595cca...ff2f1c6) --- updated-dependencies: - dependency-name: github/codeql-action/upload-sarif dependency-version: 4.37.7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
electron#52628) The POSIX process singleton read a second instance's notification into a fixed 32 KiB buffer and gave up as soon as writing to the socket would block. Command lines or additionalData payloads beyond those limits were either silently truncated or, when the write couldn't complete, made the second instance kill the primary process as unresponsive.
* feat: add disableWakeLocks to WebPreferences * chore: more accurate wake lock availability Co-authored-by: John Kleinschmidt <[email protected]> * chore: rename to wakeLockAvailability * fix: test syntax errors --------- Co-authored-by: John Kleinschmidt <[email protected]>
webContents.caretBrowsingEnabled drives ui::AXPlatform through a process-wide refcount, but nothing JavaScript can reach reports that state, so a WebContents leaking its reference — the direction the count is deliberately biased toward — passed the whole suite silently. The only refcount-sensitive signal was an assertion-free setter call that catches underflow through a DCHECK and nothing else. Expose the platform state on the existing electron_common_testing linked binding, which is compiled out unless DCHECK_IS_ON, and assert on it: the notification survives one of two enabled WebContents disabling, a repeated set takes no second reference, and closing a window withdraws it. Reading AXPlatform rather than the count itself measures what assistive technology actually sees. Co-Authored-By: Claude Opus 5 <[email protected]>
The count was keyed to the api::WebContents wrapper's destructor, which can run an unbounded time after the content::WebContents it counted for is gone. An attached webview guest is owned by its embedder frame and an extension background page by its ExtensionHost, so those wrappers outlive their contents until garbage collection — and a background page is pinned, so its release never runs at all. In that window ui::AXPlatform is told caret browsing is active for a page that no longer exists, contradicting the documented promise that the notification is withdrawn once every WebContents that enabled it has been disabled or destroyed. Release in WebContentsDestroyed() as well, above the early return a wrapper being torn down takes, idempotent through caret_browsing_counted_. The destructor keeps its release for the reverse order, where the wrapper dies first. This also closes a hole in the destructor's release: the will-destroy listener it invites runs after that release and can take a reference nothing would have released. Both new specs fail without the added release and pass with it. The leak also made the existing caret specs order-dependent: the guest test only passed in isolation, because a leaked count from the test before it left the platform state stuck on. Co-Authored-By: Claude Opus 5 <[email protected]>
The destructor releases its caret browsing reference before it emits will-destroy, and the wrapper is still dispatchable at that point, so a listener could take a reference past the destructor's last release point. Releasing in WebContentsDestroyed() closes that, since it runs after the event either way — explicitly for contents this instance does not own, and from the content::WebContents teardown at the end of the destructor otherwise. Pin the behaviour: this spec fails without that release. Co-Authored-By: Claude Opus 5 <[email protected]>
A guest is created with a copy of its embedder's renderer preferences, so it starts enabled and takes its own reference to the process-wide notification; disabling the embedder afterwards leaves the guest enabled. Both halves are asserted by the guest specs but were undocumented. "Changes take effect immediately" overpromised: SyncRendererPrefs() propagates over mojo with no ack, so the property reads back true while the renderer may not have applied it yet — which is why the renderer-side specs poll instead of asserting after the set. Co-Authored-By: Claude Opus 5 <[email protected]>
The negative caret test could pass vacuously: collapseSelectionToStart()
sets anchorOffset to 0 unconditionally, so an offset of 0 proved only that
executeJavaScript ran, not that the synthesized Right presses reached the
page. With the positive control in a separate BrowserWindow, nothing ruled
out a dead input pipeline in the negative one.
Merge the two into one window that first proves the caret moves while
enabled, then disables and polls for the caret staying put. Polling both
phases also drops the guaranteed 3s dead wait: the old predicate
(offset === 3) could never hold once the feature worked, so every green run
burned the full timeout and threw the error away in .catch(() => {}).
Co-Authored-By: Claude Opus 5 <[email protected]>
One conflict, in WebContents::WebContentsDestroyed(): electron#52847 added Unpin() at the top of the function, where this branch had added the release of the process-wide caret browsing count. Both sides want to be there, so both are kept. The caret release goes first, so the count is dropped before Unpin() makes the wrapper collectible, and its comment is trimmed to avoid repeating the "underlying content::WebContents is gone" preamble now sitting under it. electron#52847 pins Type::kRemote wrappers for the life of their content::WebContents and unpins them here. That makes the release in WebContentsDestroyed() more load-bearing than when it was written, not less: a remote wrapper is now pinned for its whole life, so its destructor cannot run until a GC after this Unpin(), and the count would otherwise be held for that whole window. Co-Authored-By: Claude Opus 5 <[email protected]>
Co-authored-by: John Kleinschmidt <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Adds
webContents.caretBrowsingEnabled— a boolean property plus asetCaretBrowsingEnabled()/isCaretBrowsingEnabled()method pair, modeled on theexisting
audioMutedAPI. It gives apps the ability to turn on Chrome's caretbrowsing mode: a movable cursor placed in the page's text, letting users navigate and
select content with the keyboard.
Closes electron#31339 (partially — see "What this does not do" below).
Note
This is a fork PR opened for iteration and review, not the upstream submission.
Base is
snackzone/electron:main. No CI runs here (this fork has no workflowsenabled). The upstream PR against
electron/electronwill be opened separately oncethis has been reviewed and the commit history has been cleaned up.
Why the accessibility call is load-bearing
Setting Blink's
RendererPreferences::caret_browsing_enabledis not sufficient on itsown. Without also calling
ui::AXPlatform::GetInstance().SetCaretBrowsingState(), thecaret paints and moves but screen readers announce nothing, because
AXPlatform::IsCaretBrowsingEnabled()gates every platform attribute an assistivetechnology reads to find the caret. Chrome pairs the two calls the same way in
chrome/browser/renderer_preferences_util.cc:228, and Chromium's own browsertesttreats them as distinct requirements:
The chain:
AXPlatform::IsCaretBrowsingEnabled()gatesBrowserAccessibility::HasVisibleCaretOrSelection()(
ui/accessibility/platform/browser_accessibility.cc:937); without it you fallthrough to
AXNode::HasVisibleCaretOrSelection(), which returns false for a collapsedselection in non-editable content (
ui/accessibility/ax_node.cc:851-867); that falseis the early-out on
accessibilitySelectedTextRange(
browser_accessibility_cocoa.mm:1562).No Blink patch is needed — Blink applies the preference dynamically, so changes take
effect immediately without reloading the page.
Why there is a refcount, and why a plain mirror won't do
AXPlatformis a process-wide singleton, while this preference isper-
WebContents. The platform state is therefore driven by a count of how manyWebContentshave caret browsing enabled, rather than mirrored from the most recentsetter call.
It's worth stating why Chrome's approach doesn't transfer, since it's the obvious
question.
renderer_preferences_util.cc:228is the only production caller ofSetCaretBrowsingState()in Chromium, and it mirrors the flag with no refcount atall. That works because
prefs::kCaretBrowsingEnabledis a profile pref(
chrome/browser/ui/browser_ui_prefs.cc:204) pushed to everyWebContentsin theprofile — every
WebContentsholds the same value, so there is no divergence for amirror to get wrong. This API is deliberately per-
WebContents, so divergence isintrinsic to the API shape. The refcount is the price of that shape, not
over-engineering.
The design deliberately biases toward over-reporting. Assistive technology is told
caret browsing is active while any
WebContentsin the process has it on, so aWebContentsthat never enabled it can report a caret for a collapsed selection. Thatdirection is chosen, not merely tolerated: over-reporting is cosmetic noise — and is
exactly what Chrome does profile-wide whenever its pref is on — whereas
under-reporting means the caret paints and moves while the screen reader says
nothing, which is the feature silently not working. Every part of the design
preserves that bias, including the release-build clamp in
AdjustCaretBrowsingCount():DCHECK_GEcompiles out in release, so the count isalso clamped at zero to keep a hypothetical imbalance from wedging caret browsing
accessibility off for the rest of the process's life.
Verification
Manual screen-reader verification passed on macOS, via a same-binary A/B using a
purpose-built read-only AX probe. Arrowing through non-editable text with a
collapsed caret:
AXInsertionPointLineNumber09223372036854775807(NSNotFound)AXSelectedTextRange{4, 0}(collapsed, advanced){0, 0}AXSelectedText""nilThe collapsed caret is the discriminating case. A non-collapsed selection returns true
from
AXNode::HasVisibleCaretOrSelection()with noAXPlatforminvolvement, soShift+Arrow would have appeared to work either way.
Platform scope, stated plainly: the feature is platform-neutral — a renderer
preference plus a cross-platform accessibility call — but screen-reader verification
was done on macOS only. The
AXPlatformcaret-browsing gate has direct consumersonly in the macOS and Windows backends;
ax_platform_node_auralinux.cc(ATK/AT-SPI2,what Orca uses) has none, reaching the gate only indirectly via
AXPlatformNodeBase::IsInvisibleOrIgnored(). Whether Orca announces the caret isunknown, not proven. Worth flagging because the requester in electron#31339 is on Linux.
Automated tests: 10 new tests (8 in
spec/api-web-contents-spec.ts, 2 inspec/webview-spec.ts). Every one of them was proven to fail against a deliberatelybroken implementation before being accepted — an earlier revision of this work had
four tests that all passed against a build with
SyncRendererPrefs()removed, becausethey only ever read back the same browser-side struct the setter had just written. The
current tests observe renderer-side caret movement instead.
One limitation to be explicit about: nothing reads
AXPlatformstate from JS (atest-only surface was ruled out of scope), so the automated tests prove the refcount's
non-negativity and JS-visible coherence, not that
SetCaretBrowsingState(true)isin effect. That rests solely on the manual probe above, which is not reproducible in
CI.
Test results, with a baseline
spec/webview-spec.ts— 117 pass / 0 fail.spec/api-web-contents-spec.ts— 274 pass / 3 fail. Those three failures arepre-existing and unrelated, measured rather than assumed. Running the same spec file
on this branch's base commit (
13ade97217, which contains no caret browsing code atall):
13ade97217Identical failures, same test names and same ordinals in both runs:
41 and 49 are 30-second mocha timeouts that require DNS to fail to resolve a
deliberately bogus hostname; the network these ran on resolves it instead. The
+8/+8/+0 delta is exactly the 8 new caret tests in this file.
yarn lint:cpp,lint:js, andlint:docsare clean.What this does not do
This does not implement the F7 keybinding, which electron#31339 asked for
alongside the developer opt-in. Electron has no accelerator entry for it, and an
Electron-provided F7 default would change keyboard behavior for every existing app.
This property is purely additive: it's the enabling primitive, and apps that want F7
can bind it. (An earlier revision of these docs claimed F7 worked; that claim was
removed deliberately.)
Deliberately scoped to
webContents— no<webview>parity. Per electron#8866,<webview>attributes for each newwebContentsAPI were judged "a lot to maintain,"and the capability remains reachable on the guest's
webContentsviadid-attach-webview. Flagging it so it reads as a decision rather than an oversight.Note that guests are still handled correctly:
BrowserPluginGuest::InitInternal()copies the embedder's renderer preferences wholesale, so a guest can inherit caret
browsing without anyone calling the setter on it — the refcount reconciles on every
construction path to account for that.
Checklist
npm testpasses — see note belowOn
npm test: the full runner was not executed. Two spec files were run directly —spec/api-web-contents-spec.tsandspec/webview-spec.ts— with the results andbaseline comparison above. Left unchecked rather than claimed.
This work was drafted with AI assistance (Claude Opus 5 via Claude Code), disclosed
per the AI tool policy
with
Co-Authored-By:trailers on every commit. The reviewed-and-verified box above isleft for the human author to check.
Release Notes
Notes: Added
webContents.caretBrowsingEnabledfor toggling caret browsing in aWebContents.