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

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

Issue 2889703002: Ensure that all code paths which call FrameTreeNode::ResetNavigationRequest set NavigationHandle::G… (Closed)
Patch Set: review comments 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
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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 497
498 // For non browser initiated navigations we need to check if the source has 498 // For non browser initiated navigations we need to check if the source has
499 // access to the URL. We always allow browser initiated requests. 499 // access to the URL. We always allow browser initiated requests.
500 // TODO(clamy): Kill the renderer if FilterURL fails? 500 // TODO(clamy): Kill the renderer if FilterURL fails?
501 GURL url = common_params_.url; 501 GURL url = common_params_.url;
502 if (!browser_initiated_ && source_site_instance()) { 502 if (!browser_initiated_ && source_site_instance()) {
503 source_site_instance()->GetProcess()->FilterURL(false, &url); 503 source_site_instance()->GetProcess()->FilterURL(false, &url);
504 // FilterURL sets the URL to about:blank if the CSP checks prevent the 504 // FilterURL sets the URL to about:blank if the CSP checks prevent the
505 // renderer from accessing it. 505 // renderer from accessing it.
506 if ((url == url::kAboutBlankURL) && (url != common_params_.url)) { 506 if ((url == url::kAboutBlankURL) && (url != common_params_.url)) {
507 navigation_handle_->set_net_error_code(net::ERR_ABORTED);
507 frame_tree_node_->ResetNavigationRequest(false, true); 508 frame_tree_node_->ResetNavigationRequest(false, true);
508 return; 509 return;
509 } 510 }
510 } 511 }
511 512
512 // It's safe to use base::Unretained because this NavigationRequest owns the 513 // It's safe to use base::Unretained because this NavigationRequest owns the
513 // NavigationHandle where the callback will be stored. 514 // NavigationHandle where the callback will be stored.
514 bool is_external_protocol = 515 bool is_external_protocol =
515 !GetContentClient()->browser()->IsHandledURL(common_params_.url); 516 !GetContentClient()->browser()->IsHandledURL(common_params_.url);
516 navigation_handle_->WillRedirectRequest( 517 navigation_handle_->WillRedirectRequest(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 render_frame_host != frame_tree_node_->current_frame_host()) { 582 render_frame_host != frame_tree_node_->current_frame_host()) {
582 // Reset the source location information if the navigation will not commit 583 // Reset the source location information if the navigation will not commit
583 // in the current renderer process. This information originated in another 584 // in the current renderer process. This information originated in another
584 // process (the current one), it should not be transferred to the new one. 585 // process (the current one), it should not be transferred to the new one.
585 common_params_.source_location.reset(); 586 common_params_.source_location.reset();
586 587
587 // Allow the embedder to cancel the cross-process commit if needed. 588 // Allow the embedder to cancel the cross-process commit if needed.
588 // TODO(clamy): Rename ShouldTransferNavigation once PlzNavigate ships. 589 // TODO(clamy): Rename ShouldTransferNavigation once PlzNavigate ships.
589 if (!frame_tree_node_->navigator()->GetDelegate()->ShouldTransferNavigation( 590 if (!frame_tree_node_->navigator()->GetDelegate()->ShouldTransferNavigation(
590 frame_tree_node_->IsMainFrame())) { 591 frame_tree_node_->IsMainFrame())) {
592 navigation_handle_->set_net_error_code(net::ERR_ABORTED);
591 frame_tree_node_->ResetNavigationRequest(false, true); 593 frame_tree_node_->ResetNavigationRequest(false, true);
592 return; 594 return;
593 } 595 }
594 } 596 }
595 597
596 if (navigation_data) 598 if (navigation_data)
597 navigation_handle_->set_navigation_data(std::move(navigation_data)); 599 navigation_handle_->set_navigation_data(std::move(navigation_data));
598 600
599 // Store the response and the StreamHandle until checks have been processed. 601 // Store the response and the StreamHandle until checks have been processed.
600 response_ = response; 602 response_ = response;
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 864 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
863 865
864 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 866 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
865 std::move(handle_), common_params_, 867 std::move(handle_), common_params_,
866 request_params_, is_view_source_); 868 request_params_, is_view_source_);
867 869
868 frame_tree_node_->ResetNavigationRequest(true, true); 870 frame_tree_node_->ResetNavigationRequest(true, true);
869 } 871 }
870 872
871 } // namespace content 873 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl_browsertest.cc ('k') | content/browser/frame_host/navigator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698