Skip to content

fix: propagate requesting frame through sync permission checks - #50719

Merged
jkleinsc merged 1 commit into
40-x-yfrom
sam/backport/permission-check-requesting-frame-40
Apr 6, 2026
Merged

jkleinsc merged 1 commit into
40-x-yfrom
sam/backport/permission-check-requesting-frame-40

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Member

Backport of #50679

See that PR for details.

Notes: no-notes

WebContentsPermissionHelper::CheckPermission was hardcoding
GetPrimaryMainFrame() and deriving the requesting origin from
web_contents_->GetLastCommittedURL(), so the setPermissionCheckHandler
callback always received the top frame's origin and
details.isMainFrame/details.requestingUrl always reflected the main
frame, even when a cross-origin subframe with allow="serial" or
allow="camera; microphone" triggered the check.

Thread the requesting RenderFrameHost through CheckPermission,
CheckSerialAccessPermission, and CheckMediaAccessPermission so the
permission manager receives the real requesting frame. Update the
serial delegate and WebContents::CheckMediaAccessPermission callers to
pass the frame they already have.

Adds a regression test that loads a cross-origin iframe with
allow="camera; microphone", calls enumerateDevices() from within the
iframe, and asserts the permission check handler receives the iframe
origin for requestingOrigin, isMainFrame, and requestingUrl.
@MarshallOfSound MarshallOfSound added backport This is a backport PR semver/patch backwards-compatible bug fixes 40-x-y labels Apr 6, 2026
@trop
trop Bot requested a review from a team April 6, 2026 05:24
@jkleinsc
jkleinsc merged commit 139d299 into 40-x-y Apr 6, 2026
166 of 169 checks passed
@jkleinsc
jkleinsc deleted the sam/backport/permission-check-requesting-frame-40 branch April 6, 2026 15:50
@release-clerk

release-clerk Bot commented Apr 6, 2026

Copy link
Copy Markdown

No Release Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

40-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants