Skip to content

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

Merged
MarshallOfSound merged 1 commit into
41-x-yfrom
trop/41-x-y-bp-fix-propagate-requesting-frame-through-sync-permission-checks-1775343577479
Apr 5, 2026
Merged

MarshallOfSound merged 1 commit into
41-x-yfrom
trop/41-x-y-bp-fix-propagate-requesting-frame-through-sync-permission-checks-1775343577479

Conversation

@trop

@trop trop Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

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.

Co-authored-by: Sam Attard <[email protected]>
@trop
trop Bot requested review from a team and MarshallOfSound April 4, 2026 23:00
@trop trop Bot added 41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Apr 4, 2026
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) April 4, 2026 23:34
@MarshallOfSound
MarshallOfSound merged commit dbc7cbd into 41-x-y Apr 5, 2026
65 of 68 checks passed
@MarshallOfSound
MarshallOfSound deleted the trop/41-x-y-bp-fix-propagate-requesting-frame-through-sync-permission-checks-1775343577479 branch April 5, 2026 00:32
@release-clerk

release-clerk Bot commented Apr 5, 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

41-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.

1 participant