Skip to content

fix: webview findInPage() hang when the embedder page has an iframe - #54508

Merged
codebytere merged 5 commits into
mainfrom
fix-webview-find-with-embedder-iframe
Sep 30, 2026
Merged

codebytere merged 5 commits into
mainfrom
fix-webview-find-with-embedder-iframe

Conversation

@codebytere

Copy link
Copy Markdown
Member

Description of Change

Fixes #54199

Calling findInPage() on a <webview> never emitted found-in-page and pinned the main process at 100% CPU when the embedder page also had an <iframe>. Chromium's find-in-page frame walk treats a webview's placeholder frame inconsistently: child and parent lookups swap in the guest's main frame, while sibling lookups return the placeholder itself. From the iframe the walk stepped onto the placeholder, could not continue, wrapped back to the embedder's main frame and repeated forever without reaching the guest.

This adds a Chromium patch that takes siblings from the same child list the other lookups use, upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/8470272. The new webview spec adds an iframe to the embedder before the webview and steps find past the last match.

Checklist

Release Notes

Notes: Fixed webview.findInPage() hanging when the host page also has an iframe.

Calling findInPage() on a <webview> whose embedder page also contains an
<iframe> never emitted found-in-page and left the main process spinning
in FindRequestManager::Traverse(). The sibling lookup there returned the
webview's outer delegate frame where the rest of the traversal expects
the guest's main frame, so the walk cycled through the embedder's
frames without reaching the guest. Patch the traversal to derive
siblings from the ancestor's children and add a spec that wraps past
the last match with an embedder iframe present.
Trim the two function comments to one sentence each and note in the
patch description that the backward walk has the same cycle when the
iframe follows the guest. No code lines change.
@codebytere codebytere added semver/patch backwards-compatible bug fixes target/43-x-y PR should also be added to the "43-x-y" branch. 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. labels Sep 28, 2026
@codebytere
codebytere requested a review from a team as a code owner September 28, 2026 12:13
@codebytere
codebytere merged commit 7af89da into main Sep 30, 2026
74 checks passed
@release-clerk

release-clerk Bot commented Sep 30, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed webview.findInPage() hanging when the host page also has an iframe.

@codebytere
codebytere deleted the fix-webview-find-with-embedder-iframe branch September 30, 2026 06:28
@trop

trop Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

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

@trop trop Bot removed the target/43-x-y PR should also be added to the "43-x-y" branch. label Sep 30, 2026
@trop

trop Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

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

@trop

trop Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

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

@trop trop Bot added in-flight/45-x-y in-flight/44-x-y merged/43-x-y PR was merged to the "43-x-y" branch. and removed target/45-x-y PR should also be added to the "45-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. in-flight/43-x-y labels Sep 30, 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 Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/43-x-y PR was merged to the "43-x-y" branch. 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. semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

webview.findInPage hangs Electron when window contains an iframe

3 participants