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

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

Issue 2954623003: PlzNavigate: implement REUSE_COMMITTED_OR_PENDING_SITE for redirects (Closed)
Patch Set: Created 3 years, 6 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 source_site_instance()->GetProcess()->FilterURL(false, &url); 546 source_site_instance()->GetProcess()->FilterURL(false, &url);
547 // FilterURL sets the URL to about:blank if the CSP checks prevent the 547 // FilterURL sets the URL to about:blank if the CSP checks prevent the
548 // renderer from accessing it. 548 // renderer from accessing it.
549 if ((url == url::kAboutBlankURL) && (url != common_params_.url)) { 549 if ((url == url::kAboutBlankURL) && (url != common_params_.url)) {
550 navigation_handle_->set_net_error_code(net::ERR_ABORTED); 550 navigation_handle_->set_net_error_code(net::ERR_ABORTED);
551 frame_tree_node_->ResetNavigationRequest(false, true); 551 frame_tree_node_->ResetNavigationRequest(false, true);
552 return; 552 return;
553 } 553 }
554 } 554 }
555 555
556 // Compute the SiteInstance to use for the redirect and pass its
557 // RenderProcessHost ID if it has a process.
Charlie Reis 2017/06/27 04:24:53 nit: ID vs RenderProcessHost
clamy 2017/06/27 15:23:05 Done.
558 scoped_refptr<SiteInstance> site_instance =
559 frame_tree_node_->render_manager()->GetSiteInstanceForNavigationRequest(
560 *this);
Charlie Reis 2017/06/27 04:24:53 I'm a small bit concerned that it's possible for t
clamy 2017/06/27 15:23:05 It seems the tests are fine with the change. For t
Charlie Reis 2017/06/27 18:46:34 I remembered the more specific problem we had in t
clamy 2017/06/28 14:08:31 I don't think the case you mention can happen. In
Charlie Reis 2017/06/28 17:05:22 Good point-- such a SiteInstance wouldn't have a p
clamy 2017/06/30 15:12:59 Since we should still consider the speculative RFH
561 RenderProcessHost* expected_process =
562 site_instance->HasProcess() ? site_instance->GetProcess() : nullptr;
clamy 2017/06/23 12:44:48 This actually introduces a new issue - the SiteIns
nasko 2017/06/23 20:23:23 If 1 is really easier, I don't mind going with it
Charlie Reis 2017/06/27 04:24:53 Nice find! I think 2 makes sense, assuming it doe
clamy 2017/06/27 15:23:05 I'm trying option 2, and running the tests. If the
Charlie Reis 2017/06/27 18:46:34 Great. The tests look happy.
clamy 2017/06/28 14:08:32 No we leave it in place until the navigation is re
563
556 // It's safe to use base::Unretained because this NavigationRequest owns the 564 // It's safe to use base::Unretained because this NavigationRequest owns the
557 // NavigationHandle where the callback will be stored. 565 // NavigationHandle where the callback will be stored.
558 bool is_external_protocol = 566 bool is_external_protocol =
559 !GetContentClient()->browser()->IsHandledURL(common_params_.url); 567 !GetContentClient()->browser()->IsHandledURL(common_params_.url);
560 navigation_handle_->WillRedirectRequest( 568 navigation_handle_->WillRedirectRequest(
561 common_params_.url, common_params_.method, common_params_.referrer.url, 569 common_params_.url, common_params_.method, common_params_.referrer.url,
562 is_external_protocol, response->head.headers, 570 is_external_protocol, response->head.headers,
563 response->head.connection_info, 571 response->head.connection_info, expected_process,
564 base::Bind(&NavigationRequest::OnRedirectChecksComplete, 572 base::Bind(&NavigationRequest::OnRedirectChecksComplete,
565 base::Unretained(this))); 573 base::Unretained(this)));
566 } 574 }
567 575
568 void NavigationRequest::OnResponseStarted( 576 void NavigationRequest::OnResponseStarted(
569 const scoped_refptr<ResourceResponse>& response, 577 const scoped_refptr<ResourceResponse>& response,
570 std::unique_ptr<StreamHandle> body, 578 std::unique_ptr<StreamHandle> body,
571 mojo::ScopedDataPipeConsumerHandle consumer_handle, 579 mojo::ScopedDataPipeConsumerHandle consumer_handle,
572 const SSLStatus& ssl_status, 580 const SSLStatus& ssl_status,
573 std::unique_ptr<NavigationData> navigation_data, 581 std::unique_ptr<NavigationData> navigation_data,
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 CSPDirective::FrameSrc, common_params_.url, is_redirect, 997 CSPDirective::FrameSrc, common_params_.url, is_redirect,
990 common_params_.source_location.value_or(SourceLocation()), 998 common_params_.source_location.value_or(SourceLocation()),
991 CSPContext::CHECK_ENFORCED_CSP)) { 999 CSPContext::CHECK_ENFORCED_CSP)) {
992 return CONTENT_SECURITY_POLICY_CHECK_PASSED; 1000 return CONTENT_SECURITY_POLICY_CHECK_PASSED;
993 } 1001 }
994 1002
995 return CONTENT_SECURITY_POLICY_CHECK_FAILED; 1003 return CONTENT_SECURITY_POLICY_CHECK_FAILED;
996 } 1004 }
997 1005
998 } // namespace content 1006 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698