Skip to content

fix(webview): support input for elements inside cross-origin <iframe>#41463

Open
dcrousso wants to merge 2 commits into
microsoft:mainfrom
dcrousso:fix-WKWebView-cross-origin-iframe-input
Open

fix(webview): support input for elements inside cross-origin <iframe>#41463
dcrousso wants to merge 2 commits into
microsoft:mainfrom
dcrousso:fix-WKWebView-cross-origin-iframe-input

Conversation

@dcrousso

Copy link
Copy Markdown
Contributor

this is layered on top of #41437

@dcrousso dcrousso requested review from pavelfeldman and yury-s June 25, 2026 15:05
dcrousso added 2 commits June 25, 2026 08:06
…`<iframe>`

leverage `elementFromPoint`, `getBoundingClientRect`, and `getComputedStyle` to manually compute the offsets of each ancestor `<iframe>`

also use existing infrastructure of `error:notconnected` to tell the caller to re-resolve the element in the parent context
@dcrousso dcrousso force-pushed the fix-WKWebView-cross-origin-iframe-input branch from 2bac9db to 4d7c0b8 Compare June 25, 2026 15:06
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

3 failed
❌ [chrome] › mcp/http.spec.ts:349 › client should receive list roots request @mcp-ubuntu-latest-chrome
❌ [firefox] › mcp/http.spec.ts:349 › client should receive list roots request @mcp-ubuntu-latest-firefox
❌ [webkit] › mcp/http.spec.ts:104 › http transport browser lifecycle (isolated) @mcp-ubuntu-latest-webkit

7377 passed, 1122 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 failed
❌ [chromium-library] › library/browsercontext-add-init-script.spec.ts:28 › should work without navigation, after all bindings @chromium-ubuntu-22.04-arm-node20
❌ [chromium-library] › library/browsercontext-expose-function.spec.ts:77 › should be callable from-inside addInitScript @chromium-ubuntu-22.04-arm-node20

3 flaky ⚠️ [chromium-library] › library/beforeunload.spec.ts:130 › should support dismissing the dialog multiple times `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:645 › screencast › should capture full viewport `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/inspector/cli-codegen-3.spec.ts:224 › cli codegen › should generate frame locators (4) `@firefox-ubuntu-22.04-node20`

49071 passed, 1142 skipped


Merge workflow run.

return { target, frame: null, doc: null, x, y };
const frame = target as HTMLIFrameElement | HTMLFrameElement;
const frameRect = frame.getBoundingClientRect();
const frameStyle = frame.ownerDocument.defaultView!.getComputedStyle(frame);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This (and in other places) looks like a cross origin reach?

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.

the ownerDocument is the ancestor of the <iframe> (as opposed to the contentDocument which is inside the <iframe>)

this is a replacement for a direct window.getComputedStyle(frame) which may not work since the window could be the wrong object if at this point the context is already inside an <iframe>

@dcrousso dcrousso requested a review from pavelfeldman June 26, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants