NavigationHandle::GetResponseHeaders sometimes returns null for browser-side navigations |
|||||
Issue descriptionIn https://codereview.chromium.org/2380773002 I'm looking to check whether a navigation received response headers, so we can ignore navigations that received headers but did not commit, such as 204 responses. The page load metrics code wants to ignore aborted navigations that didn't commit if they have headers associated, as we interpret this as an indication that the abort was actually an internally generated abort, such as for a 204 or download, rather than a user-initiated abort. My new tests to detect that we properly handle 204s and downloads pass by default, but fail when --enable-browser-side-navigation is passed on the command line. It appears that there are two different codepaths for setting the HTTP response headers on a NavigationHandle, and the browser-side path is not invoked consistently. Response headers are set in NavigationHandleImpl::WillProcessResponse. For non-browser-side navigation, the code path is: NavigationResourceThrottle::WillProcessResponse WillProcessResponseOnUIThread NavigationHandleImpl::WillProcessResponse For browser-side navigation, the code path is: NavigationResourceHandler::OnResponseStarted NavigationURLLoaderImplCore::NotifyResponseStarted NavigationURLLoaderImpl::NotifyResponseStarted NavigationRequest::OnResponseStarted NavigationHandleImpl::WillProcessResponse While the non-browser-side path consistently invokes NavigationHandleImpl::WillProcessResponse and thus provides response headers to the NavigationHandle, the browser-side path aborts before calling NavigationHandleImpl::WillProcessResponse in some cases, causing the availability of response headers to be inconsistent. In particular, the browser-side path aborts early for downloads. In NavigationResourceHandler::OnResponseStarted we have the code: if (info->IsDownload()) return true; which aborts the rest of the call path and prevents headers from being provided to the navhandle. Later, in NavigationRequest::OnResponseStarted, we have code to abort early for 204 responses: // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not // commit; they leave the frame showing the previous page. DCHECK(response); if (response->head.headers.get() && (response->head.headers->response_code() == 204 || response->head.headers->response_code() == 205)) { frame_tree_node_->ResetNavigationRequest(false); return; } which prevents headers from being provided to the navhandle. It seems that we should consistently provide response headers to navigation handles in these cases, so implementers of WebContentsObserver::DidFinishNavigation can determine if a navigation that did not commit and has a net error code of aborted have headers associated or not, like in my case, so they can better understand the cause of the abort. For now, I'm going to add my new tests to testing/buildbot/filters/browser-side-navigation.linux.browser_tests.filter - they can be removed after this bug is fixed.
,
Nov 11 2016
I could take a look.
,
Nov 30 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2 commit 4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2 Author: yzshen <yzshen@chromium.org> Date: Wed Nov 30 21:44:13 2016 PlzNavigate: Pass move information along with the response started notification for navigation requests. BUG= 652767 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2537593002 Cr-Commit-Position: refs/heads/master@{#435427} [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/browser/frame_host/navigation_request.cc [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/browser/frame_host/navigation_request.h [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/browser/loader/navigation_resource_handler.cc [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/browser/loader/navigation_url_loader_delegate.h [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/browser/loader/navigation_url_loader_impl.cc [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/browser/loader/navigation_url_loader_impl.h [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/browser/loader/navigation_url_loader_impl_core.cc [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/browser/loader/navigation_url_loader_impl_core.h [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/test/test_navigation_url_loader.cc [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/test/test_navigation_url_loader_delegate.cc [modify] https://crrev.com/4434137b674aa5703a2f1e3cf10d6ad0bdac9ac2/content/test/test_navigation_url_loader_delegate.h
,
Dec 6 2016
,
Dec 12 2016
,
Dec 22 2016
The fix is in https://codereview.chromium.org/2549373004/
,
Dec 23 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2fc22f544753c756cd50786c8a03c2b73f5b1817 commit 2fc22f544753c756cd50786c8a03c2b73f5b1817 Author: clamy <clamy@chromium.org> Date: Fri Dec 23 18:14:21 2016 PlzNavigate: Call NavigationHandle::WillProcessResponse for 204/205s This CL ensures that NavigationHandle::WillProcessResponse wil be called for 204/205s and downloads. It also ensures that no renderer process will be created to commit the navigation (since there is nothing to commit), and that NavigationHandle::ReadyToCommit will not be called in that case. BUG= 652767 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2549373004 Cr-Commit-Position: refs/heads/master@{#440646} [modify] https://crrev.com/2fc22f544753c756cd50786c8a03c2b73f5b1817/content/browser/frame_host/navigation_handle_impl.cc [modify] https://crrev.com/2fc22f544753c756cd50786c8a03c2b73f5b1817/content/browser/frame_host/navigation_request.cc [modify] https://crrev.com/2fc22f544753c756cd50786c8a03c2b73f5b1817/content/browser/frame_host/navigation_request.h [modify] https://crrev.com/2fc22f544753c756cd50786c8a03c2b73f5b1817/content/browser/loader/navigation_resource_handler.cc [modify] https://crrev.com/2fc22f544753c756cd50786c8a03c2b73f5b1817/content/test/test_navigation_url_loader_delegate.cc
,
Dec 27 2016
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by bmcquade@chromium.org
, Oct 5 2016