OLD | NEW |
---|---|
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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
562 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded( | 562 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded( |
563 navigation_handle_.get()); | 563 navigation_handle_.get()); |
564 } | 564 } |
565 | 565 |
566 // If the request was canceled by the user do not show an error page. | 566 // If the request was canceled by the user do not show an error page. |
567 if (net_error == net::ERR_ABORTED) { | 567 if (net_error == net::ERR_ABORTED) { |
568 frame_tree_node_->ResetNavigationRequest(false); | 568 frame_tree_node_->ResetNavigationRequest(false); |
569 return; | 569 return; |
570 } | 570 } |
571 | 571 |
572 // Select an appropriate renderer to show the error page. | 572 // There are two types of error pages that need to be handled differently. |
573 RenderFrameHostImpl* render_frame_host = | 573 // * Error pages resulting from blocking the request, because the original |
574 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); | 574 // document wasn't even allowed to make the request. In such case, |
575 // the error pages should be committed in the process of the original | |
576 // document, to avoid creating a process for the destination. | |
577 // * Error pages resulting from either network outage (no network, DNS | |
578 // error, etc) or similar cases, where the user can reasonably expect that | |
579 // a reload at a later point in time can be successful. Such error pages | |
580 // do belong to the process that will host the destination URL, as a | |
581 // reload will end up committing in that process anyway. | |
582 RenderFrameHostImpl* render_frame_host = nullptr; | |
583 if (net_error == net::ERR_BLOCKED_BY_CLIENT) { | |
nasko
2017/03/07 07:08:12
It turns out that the webRequest API blocking navi
Charlie Reis
2017/03/09 00:43:34
What's the problem with using the current RFH for
nasko
2017/03/09 07:24:09
I've done a lot of debugging but cannot see why th
| |
584 render_frame_host = frame_tree_node_->current_frame_host(); | |
585 } else { | |
586 render_frame_host = | |
587 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); | |
588 } | |
575 | 589 |
576 // Don't ask the renderer to commit an URL if the browser will kill it when | 590 // Don't ask the renderer to commit an URL if the browser will kill it when |
577 // it does. | 591 // it does. |
578 DCHECK(render_frame_host->CanCommitURL(common_params_.url)); | 592 DCHECK(render_frame_host->CanCommitURL(common_params_.url)); |
579 | 593 |
580 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, | 594 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, |
581 common_params_.url); | 595 common_params_.url); |
582 | 596 |
583 TransferNavigationHandleOwnership(render_frame_host); | 597 TransferNavigationHandleOwnership(render_frame_host); |
584 render_frame_host->navigation_handle()->ReadyToCommitNavigation( | 598 render_frame_host->navigation_handle()->ReadyToCommitNavigation( |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
769 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 783 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
770 | 784 |
771 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 785 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
772 common_params_, request_params_, | 786 common_params_, request_params_, |
773 is_view_source_); | 787 is_view_source_); |
774 | 788 |
775 frame_tree_node_->ResetNavigationRequest(true); | 789 frame_tree_node_->ResetNavigationRequest(true); |
776 } | 790 } |
777 | 791 |
778 } // namespace content | 792 } // namespace content |
OLD | NEW |