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

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

Issue 2884123002: PlzNavigate: blocked browser-initiated navigations should transfer processes sometimes (Closed)
Patch Set: Phrasing. Created 3 years, 7 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded( 627 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded(
628 navigation_handle_.get()); 628 navigation_handle_.get());
629 } 629 }
630 630
631 // If the request was canceled by the user do not show an error page. 631 // If the request was canceled by the user do not show an error page.
632 if (net_error == net::ERR_ABORTED) { 632 if (net_error == net::ERR_ABORTED) {
633 frame_tree_node_->ResetNavigationRequest(false, true); 633 frame_tree_node_->ResetNavigationRequest(false, true);
634 return; 634 return;
635 } 635 }
636 636
637 // There are two types of error pages that need to be handled differently. 637 // Decide whether to leave the error page in the original process.
638 // * Error pages resulting from blocking the request, because the original 638 // * If this was a renderer-initiated navigation, and the request is blocked
639 // document wasn't even allowed to make the request. In such case, 639 // because the initiating document wasn't allowed to make the request,
640 // the error pages should be committed in the process of the original 640 // commit the error in the existing process. This is a strategy to to avoid
641 // document, to avoid creating a process for the destination. 641 // creating a process for the destination, which may belong to an origin
642 // * Error pages resulting from either network outage (no network, DNS 642 // with a higher privilege level.
643 // error, etc) or similar cases, where the user can reasonably expect that 643 // * Error pages resulting from errors like network outage, no network, or DNS
644 // a reload at a later point in time can be successful. Such error pages 644 // error can reasonably expect that a reload at a later point in time would
645 // do belong to the process that will host the destination URL, as a 645 // work. These should be allowed to transfer away from the current process:
646 // reload will end up committing in that process anyway. 646 // they do belong to whichever process that will host the destination URL,
647 // as a reload will end up committing in that process anyway.
648 // * Error pages that arise during browser-initiated navigations to blocked
649 // URLs should be allowed to transfer away from the current process, which
650 // didn't request the navigation and may have a higher privilege level than
651 // the blocked destination.
647 RenderFrameHostImpl* render_frame_host = nullptr; 652 RenderFrameHostImpl* render_frame_host = nullptr;
648 if (net_error == net::ERR_BLOCKED_BY_CLIENT) { 653 if (net_error == net::ERR_BLOCKED_BY_CLIENT && !browser_initiated()) {
649 render_frame_host = frame_tree_node_->current_frame_host(); 654 render_frame_host = frame_tree_node_->current_frame_host();
650 } else { 655 } else {
651 render_frame_host = 656 render_frame_host =
652 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); 657 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this);
653 } 658 }
654 659
655 // Don't ask the renderer to commit an URL if the browser will kill it when 660 // Don't ask the renderer to commit an URL if the browser will kill it when
656 // it does. 661 // it does.
657 DCHECK(render_frame_host->CanCommitURL(common_params_.url)); 662 DCHECK(render_frame_host->CanCommitURL(common_params_.url));
658 663
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 867 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
863 868
864 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 869 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
865 std::move(handle_), common_params_, 870 std::move(handle_), common_params_,
866 request_params_, is_view_source_); 871 request_params_, is_view_source_);
867 872
868 frame_tree_node_->ResetNavigationRequest(true, true); 873 frame_tree_node_->ResetNavigationRequest(true, true);
869 } 874 }
870 875
871 } // namespace content 876 } // 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