gecko-dev/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-timing-iframe-camera.https.sub.html
Charlie Hu cbb5758ad0 Bug 1592602 [wpt PR 19994] - Fix allow/sandbox attribute timing issue on browser side, a=testonly
Automatic update from web-platform-tests
Fix allow/sandbox attribute timing issue on browser side

The issue of allow/sandbox attribute timing originates from bug crbug.com/972089.
The initial fix to that bug only deals with feature policy replication
problem on renderer side.

This CL adds a wpt test that targets a feature(camera) that is tested on
browser side. A test on similar issue with sandbox attribute is added
as well but as tentative.

On browser-side:
Frame policy value is captured at RenderFrameHostImpl::BeginNavigation,
and travel through the whole navigation process in
NavigationRequest::commit_params. Finally it will reach
NavigatorImpl::DidNavigate which is called by
RenderFrameHostImpl::DidCommitNavigationInternal.

NavigatorImpl will then use the value captured from the beginning of navigation
in commit_params to set the active frame policy instead of using currently
pending frame policy, which could be further modified by the time the navigation
commits.

This CL also gets rid of separate handling of remote frame container policy in
document.cc by capturing pending frame policy at NavigationControllerImpl::
CreateNavigationRequestFromLoadParams.

Quick Example:
1. we start on frames A(B), where A applies frame_policy P1 to B.
2. A changes policy to P2.
3. B starts navigation to C.
4. A changes policy to P3.
5. Navigation to C commits.
6. C navigates to D and commits.

Previously, we would have committed with policy P3 in both steps 5 and 6.
Now, we'll commit with P2 in step 5, and P3 in step 6.

Bug: 1012786, 972089, 1026627
Change-Id: Ib944ee204ca82e1ede6052ca58187fe97f0aab00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1852905
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Commit-Queue: Charlie Hu <chenleihu@google.com>
Cr-Commit-Position: refs/heads/master@{#722486}

--

wpt-commits: 1e107f02690374251a203d4467681393181a3ef9
wpt-pr: 19994
2019-12-11 10:30:13 +00:00

15 lines
299 B
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<script>
window.onmessage = m => {
navigator.mediaDevices.getUserMedia({video: true})
.then(() => 'ok')
.catch(e => e.name)
.then(r => {
window.parent.postMessage({
id: m.data.id,
result: r
}, '*');
});
}
</script>