Repository navigation
fix: honor end in webContents.adjustSelection() - #55440
Conversation
AdjustSelectionByCharacterOffset read the end offset from the `matchCase` key instead of `end`, so `end` was silently ignored by both webContents.adjustSelection() and <webview>.adjustSelection(). Read the correct key and add specs covering start-only, end-only and combined adjustments in both directions. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KX1hkNiiBq2fQEsXWusxpm
|
Release note looks good now. |
|
Generated by Claude Code |
There was a problem hiding this comment.
LGTM. This is a one-key fix: end is now read from the end option instead of matchCase. It comes with targeted specs. I reviewed from a standalone clone, so I couldn't see any upstream code.
What was reviewed:
shell/browser/api/electron_api_web_contents.cc:5120: the method now readsendas documented indocs/api/web-contents.md:1725.<webview>.adjustSelectiongoes through the same method vialib/common/web-view-methods.ts, so it is fixed too.- The new spec suite: I checked the expected offsets against "Hello World" for all five cases. Assertions run in the test body after polling, never in listeners.
- The suite isn't tagged
serial, so I checked whether that's a problem. It uses a hidden window and only in-page focus. The non-serialfocusedFrame apiand caret-browsing suites in this file callwebContents.focus()the same way.
Extended reasoning...
The change replaces one dictionary key in WebContents::AdjustSelectionByCharacterOffset and adds a five-case spec suite to spec/api-web-contents.spec.ts. It doesn't touch any security-sensitive surface: no IPC validation, permissions, webPreferences or contextBridge changes. The fix matches the documented end option exactly. No CODEOWNERS entry covers either changed file. The timeline shows no outstanding objections, and the bug hunt ran until it stopped finding issues (dry_streak) without reporting anything.
|
Release Notes Persisted
|
|
I have automatically backported this PR to "44-x-y", please check out #55461 |
|
I have automatically backported this PR to "45-x-y", please check out #55462 |
|
I have automatically backported this PR to "46-x-y", please check out #55463 |
Requested by David Babenko-Sanders · Slack thread
Description of Change
WebContents::AdjustSelectionByCharacterOffsetread theendoffset from the wrong key (matchCase), soendwas silently ignored by bothwebContents.adjustSelectionand<webview>.adjustSelection; this PR readsendand adds specs toapi-web-contents.spec.tscovering start-only, end-only and combined adjustments in both directions. The specs were validated against a prebuilt nightly (47.0.0-nightly.20261028), where theendcases fail as expected because the fix isn't built there; this environment can't build Electron, so the passing run will come from CI.Checklist
Release Notes
🤖 Generated with Claude Code
https://claude.ai/code/session_01KX1hkNiiBq2fQEsXWusxpm
Notes: Fixed
webContents.adjustSelection()ignoring theendoption.