Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 2738643002: Implement error page commit policy in PlzNavigate. (Closed)
Patch Set: Add comment. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "content/browser/appcache/appcache_navigation_handle.h" 10 #include "content/browser/appcache/appcache_navigation_handle.h"
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded( 576 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded(
577 navigation_handle_.get()); 577 navigation_handle_.get());
578 } 578 }
579 579
580 // If the request was canceled by the user do not show an error page. 580 // If the request was canceled by the user do not show an error page.
581 if (net_error == net::ERR_ABORTED) { 581 if (net_error == net::ERR_ABORTED) {
582 frame_tree_node_->ResetNavigationRequest(false); 582 frame_tree_node_->ResetNavigationRequest(false);
583 return; 583 return;
584 } 584 }
585 585
586 // Select an appropriate renderer to show the error page. 586 // There are two types of error pages that need to be handled differently.
587 RenderFrameHostImpl* render_frame_host = 587 // * Error pages resulting from blocking the request, because the original
588 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); 588 // document wasn't even allowed to make the request. In such case,
589 // the error pages should be committed in the process of the original
590 // document, to avoid creating a process for the destination.
591 // * Error pages resulting from either network outage (no network, DNS
592 // error, etc) or similar cases, where the user can reasonably expect that
593 // a reload at a later point in time can be successful. Such error pages
594 // do belong to the process that will host the destination URL, as a
595 // reload will end up committing in that process anyway.
596 RenderFrameHostImpl* render_frame_host = nullptr;
597 if (net_error == net::ERR_BLOCKED_BY_CLIENT) {
598 render_frame_host = frame_tree_node_->current_frame_host();
599 } else {
600 render_frame_host =
601 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this);
602 }
589 603
590 // Don't ask the renderer to commit an URL if the browser will kill it when 604 // Don't ask the renderer to commit an URL if the browser will kill it when
591 // it does. 605 // it does.
592 DCHECK(render_frame_host->CanCommitURL(common_params_.url)); 606 DCHECK(render_frame_host->CanCommitURL(common_params_.url));
593 607
594 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, 608 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host,
595 common_params_.url); 609 common_params_.url);
596 610
597 TransferNavigationHandleOwnership(render_frame_host); 611 TransferNavigationHandleOwnership(render_frame_host);
598 render_frame_host->navigation_handle()->ReadyToCommitNavigation( 612 render_frame_host->navigation_handle()->ReadyToCommitNavigation(
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 811 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
798 812
799 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 813 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
800 common_params_, request_params_, 814 common_params_, request_params_,
801 is_view_source_); 815 is_view_source_);
802 816
803 frame_tree_node_->ResetNavigationRequest(true); 817 frame_tree_node_->ResetNavigationRequest(true);
804 } 818 }
805 819
806 } // namespace content 820 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698