New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 817881 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 2
Type: Bug

Blocking:
issue 836511



Sign in to add a comment

Cannot inspect error page in OOPIF if DevTools is open when the page loads

Project Member Reported by est...@chromium.org, Mar 1 2018

Issue description

Chrome Version: 66.0.3358.0
OS: Mac, Linux

What steps will reproduce the problem?
(0) Enable Strict Site Isolation in chrome://flags and relaunch Chrome.
(1) Visit a webpage that serves an iframe with a network error page. I did this by saving "<iframe src='https://asdfasdfasfs.test'/>" to a local .html file and serving it with `python -m SimpleHTTPServer`.
(2) Open DevTools. Observe that you can inspect the contents of the frame and that it shows up in the frame tree dropdown in the Console.
(3) Now refresh the page.

What is the expected result?
You can inspect the contents of the frame and it shows up in the frame tree dropdown in the Console.

What happens instead?
You can't inspect the frame and it doesn't show up in the Console frame tree dropdown. If you close and reopen DevTools, it does.

 

Comment 1 by creis@chromium.org, Mar 1 2018

Cc: creis@chromium.org dgozman@chromium.org nasko@chromium.org
Labels: -Pri-3 Pri-2
Owner: pfeldman@chromium.org
Status: Assigned (was: Untriaged)
Thanks for the report!  Confirmed on Windows 66.0.3358.0 as well.  Also seems to repro in 65.0.3325.106, though OOPIF elements aren't inline there (which was added in  issue 800613 ).
Cc: alex...@chromium.org
@Alex: is there a way to find out whether navigation is going to end up in the out-of-process iframe given the NavigationHandleImpl? We need to know it from within NavigationThrottle::WillFailRequest to fix this.
Cc: clamy@chromium.org
Hmm, good question.  By that time, we've already determined the final RenderFrameHost for the error page in NavigationRequest::OnRequestFailedInternal(), but it looks like we haven't set it on the NavigationHandleImpl yet, so something like nav_handle->GetRenderFrameHost()->IsCrossProcessSubframe() wouldn't work.

Any chance you could do your work instead from ReadyToCommitNavigation or DidFinishNavigation, or is that too late?  That should be able to check navigation_handle->GetRenderFrameHost()->IsCrossProcessSubframe() as well as determine whether the navigation handle has an error.

+nasko@/clamy@ for any other thoughts re: how to check for this, or whether we could expose the error page's final RenderFrameHost to WillFailRequest throttles.  Note that nasko@ is also working on isolating error pages in their own process (https://crrev.com/c/762520), but that will only affect main frames, not subframes, so probably won't help here.

> we haven't set it on the NavigationHandleImpl

In case of a non-error navigation, we are getting navhandle->GetRenderFrameHost() from within WillProcessResponse  and are calling frh->IsCrossProcessSubframe on it. So things work for the WillProcessResponse branch.

Things are different for WillFailRequest - navhandle does not want to return RFH unless its state is >= WILL_PROCESS_RESPONSE.

All we need to know is whether the OOP-ness has changed for a given RFH. We need to handle this transition, throttle OOPIF if necessary and set up our agents.

> Any chance you could do your work instead from ReadyToCommitNavigation or DidFinishNavigation

We need to throttle the navigation in order to set up all the agents, other signals are emitted too late. We already have the code in our Throttle::WillProcessResponse that works for regular navigations. 

>> All we need to know is whether the OOP-ness has changed for a given RFH

read as "for a given frame tree node".

Comment 6 by clamy@chromium.org, Mar 5 2018

@alexmos: The main issue I would see is that it's possible to modify the net error code in NavigationThrottle::WillFailRequest. So, if the new error code is of the blocking variety, then we will always use the current process instead of using the process determined for navigation (and this applies to subframes as well). One possibility could be to call ReadyToCommitNavigation when we will commit an error page, since by that time we will know for sure the final process.
#6: I'm a bit confused by this.  Looking at the code, it doesn't look like we recompute the target RFH after WillFailRequest, so even if it ends up changing the error code, we'll use whatever RFH was determined in NavigationRequest::OnRequestFailedInternal().  Am I misunderstanding something?

I.e., here's the sequence of events that I see:

1. The target RFH for the error page is first determined here in NavigationRequest::OnRequestFailedInternal:
  RenderFrameHostImpl* render_frame_host = nullptr;
  if (net_error == net::ERR_BLOCKED_BY_CLIENT && !browser_initiated()) {
    render_frame_host = frame_tree_node_->current_frame_host();
  } else {
    render_frame_host =
        frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); // <-- errors that end up in OOPIFs go through here.
  }

2. We run WillFailRequest throttles:
    navigation_handle_->WillFailRequest(
        ssl_info, base::Bind(&NavigationRequest::OnFailureChecksComplete,
                             base::Unretained(this), render_frame_host));

3. We run the OnFailureChecksComplete() callback, which is passed the |render_frame_host| from step 1.

4. OnFailureChecksComplete() calls CommitErrorPage(), which commits the error page in the RFH from step 1:
  frame_tree_node_->TransferNavigationRequestOwnership(render_frame_host);
  navigation_handle_->ReadyToCommitNavigation(render_frame_host, true);
  render_frame_host->FailedNavigation(common_params_, request_params_,
                                      has_stale_copy_in_cache_, net_error_,
                                      error_page_content);


Comment 8 by clamy@chromium.org, Mar 6 2018

Well that's not how I thought it would work, and might be an issue if we decide to change the error code in WillFailRequest to net::ERR_BLOCKED_BY_CLIENT. We should probably check it again in OnFailureChecksComplete(), and change it to the current RFh in that case.
Yes, that's one option.  If we take that route, is there any reason to keep the existing RFH calculation in OnRequestFailedInternal(), rather than just moving it to OnFailureChecksComplete()?

The other option, which Nasko and I discussed yesterday, is to just let the RFH calculated in OnRequestFailedInternal() be the final RFH, and let GetRenderFrameHost() return it during WILL_FAIL_REQUEST. I don't see any throttles actually changing the error code in WillFailRequest today (looking at the two non-test ones in SSLErrorNavigationThrottle and NewTabPageNavigationThrottle) - so I'm a bit unclear why we would want to support it and prioritize over letting WillFailRequest() access the final RFH, for which Pavel has a use case here?
Cc: carlosil@chromium.org ortuno@chromium.org
+carlosil and ortuno in case they foresee any need to change the error code in WillFailRequest... I don't think committed interstitials will require that functionality but they can probably double-check.
Re #10: Yeah, I don't think committed interstitials requires functionality for changing the error code on WillFailRequest, so this shouldn't conflict with CI.
Blockedon: 824576
Sounds like  issue 824576  might potentially unblock this by allowing access to navhandle->GetRenderFrameHost() in more states.
Comment 12:  Issue 824576  was WontFixed.  Is there another way to make progress on the fix for this one?
Blockedon: -824576
I think we can still implement the plan from #9 (let the RFH calculated in OnRequestFailedInternal() be the final RFH, and let GetRenderFrameHost() return it during WILL_FAIL_REQUEST).  It sounds like committed interstitials won't need to change the error code in WillFailRequest, so I don't see any reason to support that.
Owner: alex...@chromium.org
"let GetRenderFrameHost() return it during WILL_FAIL_REQUEST" - could you do that for us? I don't want to break anything - things look fragile around there.
Blocking: 836511
Status: Started (was: Assigned)
I've got a CL started for this at https://crrev.com/c/1045266.
Project Member

Comment 18 by bugdroid1@chromium.org, May 15 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1a66b1d944516a3d6959fbea7ae2f710db4b3e50

commit 1a66b1d944516a3d6959fbea7ae2f710db4b3e50
Author: Alex Moshchuk <alexmos@chromium.org>
Date: Tue May 15 21:18:26 2018

Allow NavigationHandle::GetRenderFrameHost() in WillFailRequest throttles.

This should be safe since the final RenderFrameHost for the error page
is already determined in NavigationRequest::OnRequestFailedInternal().
As part of this change, pass that final RenderFrameHost to
NavigationHandle::WillFailRequest and store it on NavigationHandle
before running WillFailRequest through the throttles.

One use case for this will be DevTools, which needs to know whether a
given subframe is transitioning to/from an OOPIF in the throttles,
even for error pages.  That logic is already in WillProcessResponse(),
and with this change it can also be used in WillFailRequest() to fix
inspecting error pages loaded in OOPIFs.  Note that DevTools needs to
defer the response, so simply doing the work at ReadyToCommit time
doesn't work.

Today, WillFailRequest throttles are allowed to change the error code,
but they should not be changing it in a way that alters the final
error page RenderFrameHost.  Previously, this was implicitly true
because OnFailureChecksComplete() did not check if the error page
RenderFrameHost needed to be updated.  This CL makes that assumption
explicit.  Note that with error page isolation, this won't be an issue
since all error pages will end up in the error page process, which
won't change regardless of what WillFailRequest returns.

Bug:  817881 
Change-Id: Ifc1a53a70f8a649a8d9ddc67f6fd39ebc5c1efd7
Reviewed-on: https://chromium-review.googlesource.com/1045266
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558835}
[modify] https://crrev.com/1a66b1d944516a3d6959fbea7ae2f710db4b3e50/chrome/browser/ssl/ssl_error_navigation_throttle_unittest.cc
[modify] https://crrev.com/1a66b1d944516a3d6959fbea7ae2f710db4b3e50/content/browser/frame_host/navigation_handle_impl.cc
[modify] https://crrev.com/1a66b1d944516a3d6959fbea7ae2f710db4b3e50/content/browser/frame_host/navigation_handle_impl.h
[modify] https://crrev.com/1a66b1d944516a3d6959fbea7ae2f710db4b3e50/content/browser/frame_host/navigation_handle_impl_unittest.cc
[modify] https://crrev.com/1a66b1d944516a3d6959fbea7ae2f710db4b3e50/content/browser/frame_host/navigation_request.cc
[modify] https://crrev.com/1a66b1d944516a3d6959fbea7ae2f710db4b3e50/content/browser/frame_host/navigation_request.h
[modify] https://crrev.com/1a66b1d944516a3d6959fbea7ae2f710db4b3e50/content/public/browser/navigation_handle.h

Owner: pfeldman@chromium.org
Status: Assigned (was: Started)
Hey Pavel (or anyone else from DevTools) - the change in c#18 should let you access NavigationHandle::GetRenderFrameHost() from WillFailRequest().  Would you be able to finish this bug up?  Per c#4, it seems you can just do the same work you're already doing in WillProcessResponse() there (I'm guessing it's mostly about TargetAutoAttacher::AutoAttachToFrame()).
Owner: dgozman@chromium.org
Status: Fixed (was: Assigned)

Sign in to add a comment