Skip to content

fix: honor end in webContents.adjustSelection() - #55440

Merged
MarshallOfSound merged 1 commit into
mainfrom
claude/fix-adjust-selection-end
Oct 29, 2026
Merged

MarshallOfSound merged 1 commit into
mainfrom
claude/fix-adjust-selection-end

Conversation

@claude

@claude claude Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Requested by David Babenko-Sanders · Slack thread

Description of Change

WebContents::AdjustSelectionByCharacterOffset read the end offset from the wrong key (matchCase), so end was silently ignored by both webContents.adjustSelection and <webview>.adjustSelection; this PR reads end and adds specs to api-web-contents.spec.ts covering start-only, end-only and combined adjustments in both directions. The specs were validated against a prebuilt nightly (47.0.0-nightly.20261028), where the end cases 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 the end option.

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
@claude claude Bot added the semver/patch backwards-compatible bug fixes label Oct 28, 2026
@release-clerk

release-clerk Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Release note looks good now.

@claude claude Bot added target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. target/46-x-y PR should also be added to the "46-x-y" branch. labels Oct 28, 2026
@claude

claude Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

macos-x64 / build failed in Fix Sync: the CIPD download of the siso package kept stalling (HTTP/2 INTERNAL_ERROR) until it gave up, before any compile ran, so the failure is not from this PR (macos-arm64 built the changed file fine). The job has been re-run once.


Generated by Claude Code

@dsanders11
dsanders11 marked this pull request as ready for review October 28, 2026 22:08

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 reads end as documented in docs/api/web-contents.md:1725. <webview>.adjustSelection goes through the same method via lib/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-serial focusedFrame api and caret-browsing suites in this file call webContents.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.

@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) October 29, 2026 07:43
@MarshallOfSound
MarshallOfSound merged commit f7d9905 into main Oct 29, 2026
150 of 152 checks passed
@MarshallOfSound
MarshallOfSound deleted the claude/fix-adjust-selection-end branch October 29, 2026 07:43
@release-clerk

release-clerk Bot commented Oct 29, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed webContents.adjustSelection() ignoring the end option.

@trop

trop Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #55461

@trop

trop Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #55462

@trop

trop Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "46-x-y", please check out #55463

@trop trop Bot added in-flight/45-x-y in-flight/46-x-y merged/46-x-y PR was merged to the "46-x-y" branch. and removed target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. target/46-x-y PR should also be added to the "46-x-y" branch. in-flight/46-x-y labels Oct 29, 2026
@trop trop Bot added merged/45-x-y PR was merged to the "45-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. and removed in-flight/45-x-y in-flight/44-x-y labels Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

47-x-y merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. merged/46-x-y PR was merged to the "46-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants