DescriptionOOPIF: Handle cross-site frames being blocked by X-Frame-Options or CSP.
Currently with OOPIFs, when a page from site A embeds a cross-site
frame from site B, and the subframe is blocked due to X-Frame-Options
or CSP frame-ancestors, the blocking happens in process B, after the
frame gets transferred to a new process, but before commit (or rather,
DidFailProvisionalLoad, which is what happens because of the block).
There are several problems with this:
1. The renderer for frame B gets killed while trying to forward the
load event to the parent process, so that it can get fired on the
<iframe> element there. (see issue 584845).
2. As a result, the load event for the <iframe> element in process A
never fires as it should. (Firing this event is necessary so that the
blocking can't be observed.)
3. The blocked subframe is kept in process A, but it still has
A's origin, meaning it appears as a same-site frame to its parent,
rather than a cross-site frame, as it should after the block. Normal
blocking logic handles this by setting a unique origin on the blocked
frame, but this happens in process B, and process A never learns about
that. In addition, the browser process still thinks the subframe's
origin is A.
4. The load that was started for the subframe in process A never gets
stopped. In particular, this is problematic for layout tests, which
wait for DidStopLoading in process A to end the test.
Basically, process A never finds out that the subframe failed to load
in a different process due to CSP/XFO blocking, and can't take
appropriate action.
The proper way to fix this is by enforcing XFO/CSP in the browser
process, so that we don't need to create the unnecessary new process
in the first place. However, that is a longer-term effort (see
https://crbug.com/555418). This CL provides a stop-gap solution of
forwarding the notification about the block from process B to process
A, so that process A can (1) set the subframe's origin to unique, and
(2) fire the load event on its FrameOwner. The browser->renderer part
of this notification can be reused once the browser process can do the
blocking.
This CL also generically fixes the case of stopping the load in the
current RenderFrameHost when a pending RenderFrameHost never commits,
which solves problem 4 and guards any future such problems.
BUG=584845
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
Patch Set 1 #Patch Set 2 : #Patch Set 3 : #Patch Set 4 : Rebase #
Total comments: 17
Patch Set 5 : Rename plumbing to use BlockedLoad #Patch Set 6 : Rebase #Patch Set 7 : Split off the relaxed DCHECK in OnCrossSiteResponse into separate CL #Depends on Patchset: Messages
Total messages: 14 (5 generated)
|