| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/browser/browsing_data/clear_site_data_throttle.h" | 10 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
| 11 #include "content/browser/child_process_security_policy_impl.h" |
| 11 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 12 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 12 #include "content/browser/frame_host/frame_tree_node.h" | 13 #include "content/browser/frame_host/frame_tree_node.h" |
| 13 #include "content/browser/frame_host/navigator.h" | 14 #include "content/browser/frame_host/navigator.h" |
| 14 #include "content/browser/frame_host/navigator_delegate.h" | 15 #include "content/browser/frame_host/navigator_delegate.h" |
| 15 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 16 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 16 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 17 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
| 17 #include "content/common/frame_messages.h" | 18 #include "content/common/frame_messages.h" |
| 18 #include "content/common/resource_request_body_impl.h" | 19 #include "content/common/resource_request_body_impl.h" |
| 20 #include "content/common/site_isolation_policy.h" |
| 19 #include "content/public/browser/content_browser_client.h" | 21 #include "content/public/browser/content_browser_client.h" |
| 22 #include "content/public/browser/site_instance.h" |
| 20 #include "content/public/common/browser_side_navigation_policy.h" | 23 #include "content/public/common/browser_side_navigation_policy.h" |
| 21 #include "content/public/common/content_client.h" | 24 #include "content/public/common/content_client.h" |
| 22 #include "content/public/common/url_constants.h" | 25 #include "content/public/common/url_constants.h" |
| 23 #include "net/url_request/redirect_info.h" | 26 #include "net/url_request/redirect_info.h" |
| 24 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| 25 #include "url/url_constants.h" | 28 #include "url/url_constants.h" |
| 26 | 29 |
| 27 namespace content { | 30 namespace content { |
| 28 | 31 |
| 29 namespace { | 32 namespace { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 has_user_gesture_(false), | 66 has_user_gesture_(false), |
| 64 transition_(ui::PAGE_TRANSITION_LINK), | 67 transition_(ui::PAGE_TRANSITION_LINK), |
| 65 is_external_protocol_(false), | 68 is_external_protocol_(false), |
| 66 net_error_code_(net::OK), | 69 net_error_code_(net::OK), |
| 67 render_frame_host_(nullptr), | 70 render_frame_host_(nullptr), |
| 68 is_renderer_initiated_(is_renderer_initiated), | 71 is_renderer_initiated_(is_renderer_initiated), |
| 69 is_same_page_(false), | 72 is_same_page_(false), |
| 70 is_synchronous_(is_synchronous), | 73 is_synchronous_(is_synchronous), |
| 71 is_srcdoc_(is_srcdoc), | 74 is_srcdoc_(is_srcdoc), |
| 72 was_redirected_(false), | 75 was_redirected_(false), |
| 76 original_url_(url), |
| 73 state_(INITIAL), | 77 state_(INITIAL), |
| 74 is_transferring_(false), | 78 is_transferring_(false), |
| 75 frame_tree_node_(frame_tree_node), | 79 frame_tree_node_(frame_tree_node), |
| 76 next_index_(0), | 80 next_index_(0), |
| 77 navigation_start_(navigation_start), | 81 navigation_start_(navigation_start), |
| 78 pending_nav_entry_id_(pending_nav_entry_id), | 82 pending_nav_entry_id_(pending_nav_entry_id), |
| 79 request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED) { | 83 request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED), |
| 84 should_replace_current_entry_(false), |
| 85 is_download_(false), |
| 86 is_stream_(false), |
| 87 weak_factory_(this) { |
| 80 DCHECK(!navigation_start.is_null()); | 88 DCHECK(!navigation_start.is_null()); |
| 89 redirect_chain_.push_back(url); |
| 81 GetDelegate()->DidStartNavigation(this); | 90 GetDelegate()->DidStartNavigation(this); |
| 82 | 91 |
| 83 if (IsInMainFrame()) { | 92 if (IsInMainFrame()) { |
| 84 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 93 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
| 85 "navigation", "Navigation StartToCommit", this, | 94 "navigation", "Navigation StartToCommit", this, |
| 86 navigation_start, "Initial URL", url_.spec()); | 95 navigation_start, "Initial URL", url_.spec()); |
| 87 } | 96 } |
| 88 } | 97 } |
| 89 | 98 |
| 90 NavigationHandleImpl::~NavigationHandleImpl() { | 99 NavigationHandleImpl::~NavigationHandleImpl() { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 237 } |
| 229 | 238 |
| 230 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; | 239 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; |
| 231 if (state_ == DEFERRING_START) { | 240 if (state_ == DEFERRING_START) { |
| 232 result = CheckWillStartRequest(); | 241 result = CheckWillStartRequest(); |
| 233 } else if (state_ == DEFERRING_REDIRECT) { | 242 } else if (state_ == DEFERRING_REDIRECT) { |
| 234 result = CheckWillRedirectRequest(); | 243 result = CheckWillRedirectRequest(); |
| 235 } else { | 244 } else { |
| 236 result = CheckWillProcessResponse(); | 245 result = CheckWillProcessResponse(); |
| 237 | 246 |
| 238 // If the navigation is about to proceed after processing the response, then | 247 // If the navigation is about to proceed after having been deferred while |
| 239 // it's ready to commit. | 248 // processing the response, then it's ready to commit. Determine which |
| 240 if (result == NavigationThrottle::PROCEED) | 249 // RenderFrameHost should render the response, based on its site (after any |
| 241 ReadyToCommitNavigation(render_frame_host_); | 250 // redirects). |
| 251 // Note: if MaybeTransferAndProceed returns false, this means that this |
| 252 // NavigationHandle was deleted, so return immediately. |
| 253 if (result == NavigationThrottle::PROCEED && !MaybeTransferAndProceed()) |
| 254 return; |
| 242 } | 255 } |
| 243 | 256 |
| 244 if (result != NavigationThrottle::DEFER) | 257 if (result != NavigationThrottle::DEFER) |
| 245 RunCompleteCallback(result); | 258 RunCompleteCallback(result); |
| 246 } | 259 } |
| 247 | 260 |
| 248 void NavigationHandleImpl::CancelDeferredNavigation( | 261 void NavigationHandleImpl::CancelDeferredNavigation( |
| 249 NavigationThrottle::ThrottleCheckResult result) { | 262 NavigationThrottle::ThrottleCheckResult result) { |
| 250 DCHECK(state_ == DEFERRING_START || state_ == DEFERRING_REDIRECT); | 263 DCHECK(state_ == DEFERRING_START || state_ == DEFERRING_REDIRECT); |
| 251 DCHECK(result == NavigationThrottle::CANCEL_AND_IGNORE || | 264 DCHECK(result == NavigationThrottle::CANCEL_AND_IGNORE || |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 319 } |
| 307 | 320 |
| 308 NavigationThrottle::ThrottleCheckResult | 321 NavigationThrottle::ThrottleCheckResult |
| 309 NavigationHandleImpl::CallWillProcessResponseForTesting( | 322 NavigationHandleImpl::CallWillProcessResponseForTesting( |
| 310 content::RenderFrameHost* render_frame_host, | 323 content::RenderFrameHost* render_frame_host, |
| 311 const std::string& raw_response_headers) { | 324 const std::string& raw_response_headers) { |
| 312 scoped_refptr<net::HttpResponseHeaders> headers = | 325 scoped_refptr<net::HttpResponseHeaders> headers = |
| 313 new net::HttpResponseHeaders(raw_response_headers); | 326 new net::HttpResponseHeaders(raw_response_headers); |
| 314 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; | 327 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; |
| 315 WillProcessResponse(static_cast<RenderFrameHostImpl*>(render_frame_host), | 328 WillProcessResponse(static_cast<RenderFrameHostImpl*>(render_frame_host), |
| 316 headers, SSLStatus(), | 329 headers, SSLStatus(), GlobalRequestID(), false, false, |
| 330 false, base::Closure(), |
| 317 base::Bind(&UpdateThrottleCheckResult, &result)); | 331 base::Bind(&UpdateThrottleCheckResult, &result)); |
| 318 | 332 |
| 319 // Reset the callback to ensure it will not be called later. | 333 // Reset the callback to ensure it will not be called later. |
| 320 complete_callback_.Reset(); | 334 complete_callback_.Reset(); |
| 321 return result; | 335 return result; |
| 322 } | 336 } |
| 323 | 337 |
| 324 void NavigationHandleImpl::CallDidCommitNavigationForTesting(const GURL& url) { | 338 void NavigationHandleImpl::CallDidCommitNavigationForTesting(const GURL& url) { |
| 325 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 339 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 326 | 340 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 scoped_refptr<net::HttpResponseHeaders> response_headers, | 413 scoped_refptr<net::HttpResponseHeaders> response_headers, |
| 400 const ThrottleChecksFinishedCallback& callback) { | 414 const ThrottleChecksFinishedCallback& callback) { |
| 401 // Update the navigation parameters. | 415 // Update the navigation parameters. |
| 402 url_ = new_url; | 416 url_ = new_url; |
| 403 method_ = new_method; | 417 method_ = new_method; |
| 404 sanitized_referrer_.url = new_referrer_url; | 418 sanitized_referrer_.url = new_referrer_url; |
| 405 sanitized_referrer_ = Referrer::SanitizeForRequest(url_, sanitized_referrer_); | 419 sanitized_referrer_ = Referrer::SanitizeForRequest(url_, sanitized_referrer_); |
| 406 is_external_protocol_ = new_is_external_protocol; | 420 is_external_protocol_ = new_is_external_protocol; |
| 407 response_headers_ = response_headers; | 421 response_headers_ = response_headers; |
| 408 was_redirected_ = true; | 422 was_redirected_ = true; |
| 423 redirect_chain_.push_back(new_url); |
| 409 if (new_method != "POST") | 424 if (new_method != "POST") |
| 410 resource_request_body_ = nullptr; | 425 resource_request_body_ = nullptr; |
| 411 | 426 |
| 412 state_ = WILL_REDIRECT_REQUEST; | 427 state_ = WILL_REDIRECT_REQUEST; |
| 413 complete_callback_ = callback; | 428 complete_callback_ = callback; |
| 414 | 429 |
| 415 // Notify each throttle of the request. | 430 // Notify each throttle of the request. |
| 416 NavigationThrottle::ThrottleCheckResult result = CheckWillRedirectRequest(); | 431 NavigationThrottle::ThrottleCheckResult result = CheckWillRedirectRequest(); |
| 417 | 432 |
| 418 // If the navigation is not deferred, run the callback. | 433 // If the navigation is not deferred, run the callback. |
| 419 if (result != NavigationThrottle::DEFER) | 434 if (result != NavigationThrottle::DEFER) |
| 420 RunCompleteCallback(result); | 435 RunCompleteCallback(result); |
| 421 } | 436 } |
| 422 | 437 |
| 423 void NavigationHandleImpl::WillProcessResponse( | 438 void NavigationHandleImpl::WillProcessResponse( |
| 424 RenderFrameHostImpl* render_frame_host, | 439 RenderFrameHostImpl* render_frame_host, |
| 425 scoped_refptr<net::HttpResponseHeaders> response_headers, | 440 scoped_refptr<net::HttpResponseHeaders> response_headers, |
| 426 const SSLStatus& ssl_status, | 441 const SSLStatus& ssl_status, |
| 442 const GlobalRequestID& request_id, |
| 443 bool should_replace_current_entry, |
| 444 bool is_download, |
| 445 bool is_stream, |
| 446 const base::Closure& transfer_callback, |
| 427 const ThrottleChecksFinishedCallback& callback) { | 447 const ThrottleChecksFinishedCallback& callback) { |
| 428 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 448 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 429 render_frame_host_ = render_frame_host; | 449 render_frame_host_ = render_frame_host; |
| 430 response_headers_ = response_headers; | 450 response_headers_ = response_headers; |
| 451 request_id_ = request_id; |
| 452 should_replace_current_entry_ = should_replace_current_entry; |
| 453 is_download_ = is_download; |
| 454 is_stream_ = is_stream; |
| 431 state_ = WILL_PROCESS_RESPONSE; | 455 state_ = WILL_PROCESS_RESPONSE; |
| 432 ssl_status_ = ssl_status; | 456 ssl_status_ = ssl_status; |
| 433 complete_callback_ = callback; | 457 complete_callback_ = callback; |
| 458 transfer_callback_ = transfer_callback; |
| 434 | 459 |
| 435 // Notify each throttle of the response. | 460 // Notify each throttle of the response. |
| 436 NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse(); | 461 NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse(); |
| 437 | 462 |
| 438 // If the navigation is about to proceed, then it's ready to commit. | 463 // If the navigation is done processing the response, then it's ready to |
| 439 if (result == NavigationThrottle::PROCEED) | 464 // commit. Determine which RenderFrameHost should render the response, based |
| 440 ReadyToCommitNavigation(render_frame_host); | 465 // on its site (after any redirects). |
| 466 // Note: if MaybeTransferAndProceed returns false, this means that this |
| 467 // NavigationHandle was deleted, so return immediately. |
| 468 if (result == NavigationThrottle::PROCEED && !MaybeTransferAndProceed()) |
| 469 return; |
| 441 | 470 |
| 442 // If the navigation is not deferred, run the callback. | 471 // If the navigation is not deferred, run the callback. |
| 443 if (result != NavigationThrottle::DEFER) | 472 if (result != NavigationThrottle::DEFER) |
| 444 RunCompleteCallback(result); | 473 RunCompleteCallback(result); |
| 445 } | 474 } |
| 446 | 475 |
| 447 void NavigationHandleImpl::ReadyToCommitNavigation( | 476 void NavigationHandleImpl::ReadyToCommitNavigation( |
| 448 RenderFrameHostImpl* render_frame_host) { | 477 RenderFrameHostImpl* render_frame_host) { |
| 449 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 478 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 450 render_frame_host_ = render_frame_host; | 479 render_frame_host_ = render_frame_host; |
| 451 state_ = READY_TO_COMMIT; | 480 state_ = READY_TO_COMMIT; |
| 452 | 481 |
| 453 // Only notify the WebContentsObservers when PlzNavigate is enabled, as | 482 GetDelegate()->ReadyToCommitNavigation(this); |
| 454 // |render_frame_host_| may be wrong in the case of transfer navigations. | |
| 455 if (IsBrowserSideNavigationEnabled()) | |
| 456 GetDelegate()->ReadyToCommitNavigation(this); | |
| 457 } | 483 } |
| 458 | 484 |
| 459 void NavigationHandleImpl::DidCommitNavigation( | 485 void NavigationHandleImpl::DidCommitNavigation( |
| 460 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 486 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 461 bool same_page, | 487 bool same_page, |
| 462 RenderFrameHostImpl* render_frame_host) { | 488 RenderFrameHostImpl* render_frame_host) { |
| 463 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 489 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 464 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); | 490 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
| 465 CHECK_EQ(url_, params.url); | 491 CHECK_EQ(url_, params.url); |
| 466 | 492 |
| 467 method_ = params.method; | 493 method_ = params.method; |
| 468 has_user_gesture_ = (params.gesture == NavigationGestureUser); | 494 has_user_gesture_ = (params.gesture == NavigationGestureUser); |
| 469 transition_ = params.transition; | 495 transition_ = params.transition; |
| 470 render_frame_host_ = render_frame_host; | 496 render_frame_host_ = render_frame_host; |
| 471 is_same_page_ = same_page; | 497 is_same_page_ = same_page; |
| 472 | 498 |
| 473 // If an error page reloads, net_error_code might be 200 but we still want to | 499 // If an error page reloads, net_error_code might be 200 but we still want to |
| 474 // count it as an error page. | 500 // count it as an error page. |
| 475 if (params.base_url.spec() == kUnreachableWebDataURL || | 501 if (params.base_url.spec() == kUnreachableWebDataURL || |
| 476 net_error_code_ != net::OK) { | 502 net_error_code_ != net::OK) { |
| 477 state_ = DID_COMMIT_ERROR_PAGE; | 503 state_ = DID_COMMIT_ERROR_PAGE; |
| 478 } else { | 504 } else { |
| 479 state_ = DID_COMMIT; | 505 state_ = DID_COMMIT; |
| 480 } | 506 } |
| 481 } | 507 } |
| 482 | 508 |
| 509 void NavigationHandleImpl::Transfer() { |
| 510 DCHECK(!IsBrowserSideNavigationEnabled()); |
| 511 // This is an actual transfer. Inform the NavigationResourceThrottle. This |
| 512 // will allow to mark the URLRequest as transferring. When it is marked as |
| 513 // transferring, the URLRequest can no longer be cancelled by its original |
| 514 // RenderFrame. Instead it will persist until being picked up by the transfer |
| 515 // RenderFrame, even if the original RenderFrame is destroyed. |
| 516 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_); |
| 517 transfer_callback_.Reset(); |
| 518 } |
| 519 |
| 483 NavigationThrottle::ThrottleCheckResult | 520 NavigationThrottle::ThrottleCheckResult |
| 484 NavigationHandleImpl::CheckWillStartRequest() { | 521 NavigationHandleImpl::CheckWillStartRequest() { |
| 485 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); | 522 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); |
| 486 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); | 523 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); |
| 487 DCHECK(state_ != DEFERRING_START || next_index_ != 0); | 524 DCHECK(state_ != DEFERRING_START || next_index_ != 0); |
| 488 for (size_t i = next_index_; i < throttles_.size(); ++i) { | 525 for (size_t i = next_index_; i < throttles_.size(); ++i) { |
| 489 NavigationThrottle::ThrottleCheckResult result = | 526 NavigationThrottle::ThrottleCheckResult result = |
| 490 throttles_[i]->WillStartRequest(); | 527 throttles_[i]->WillStartRequest(); |
| 491 switch (result) { | 528 switch (result) { |
| 492 case NavigationThrottle::PROCEED: | 529 case NavigationThrottle::PROCEED: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 | 606 |
| 570 case NavigationThrottle::BLOCK_REQUEST: | 607 case NavigationThrottle::BLOCK_REQUEST: |
| 571 NOTREACHED(); | 608 NOTREACHED(); |
| 572 } | 609 } |
| 573 } | 610 } |
| 574 next_index_ = 0; | 611 next_index_ = 0; |
| 575 state_ = WILL_PROCESS_RESPONSE; | 612 state_ = WILL_PROCESS_RESPONSE; |
| 576 return NavigationThrottle::PROCEED; | 613 return NavigationThrottle::PROCEED; |
| 577 } | 614 } |
| 578 | 615 |
| 616 bool NavigationHandleImpl::MaybeTransferAndProceed() { |
| 617 DCHECK_EQ(WILL_PROCESS_RESPONSE, state_); |
| 618 |
| 619 // Check if the navigation should transfer. This may result in the |
| 620 // destruction of this NavigationHandle, and the cancellation of the request. |
| 621 if (!MaybeTransferAndProceedInternal()) |
| 622 return false; |
| 623 |
| 624 // Inform observers that the navigation is now ready to commit, unless a |
| 625 // transfer of the navigation failed. |
| 626 ReadyToCommitNavigation(render_frame_host_); |
| 627 return true; |
| 628 } |
| 629 |
| 630 bool NavigationHandleImpl::MaybeTransferAndProceedInternal() { |
| 631 DCHECK(render_frame_host_); |
| 632 |
| 633 // PlzNavigate: the final RenderFrameHost handling this navigation has been |
| 634 // decided before calling WillProcessResponse in |
| 635 // NavigationRequest::OnResponseStarted. |
| 636 // TODO(clamy): See if PlzNavigate could use this code to check whether to |
| 637 // use the RFH determined at the start of the navigation or to switch to |
| 638 // another one. |
| 639 if (IsBrowserSideNavigationEnabled()) |
| 640 return true; |
| 641 |
| 642 // Subframes shouldn't swap processes unless out-of-process iframes are |
| 643 // possible. |
| 644 if (!IsInMainFrame() && !SiteIsolationPolicy::AreCrossProcessFramesPossible()) |
| 645 return true; |
| 646 |
| 647 // If this is a download, do not do a cross-site check. The renderer will |
| 648 // see it is a download and abort the request. |
| 649 // |
| 650 // Similarly, HTTP 204 (No Content) responses leave the renderer showing the |
| 651 // previous page. The navigation should be allowed to finish without running |
| 652 // the unload handler or swapping in the pending RenderFrameHost. |
| 653 if (is_download_ || is_stream_ || |
| 654 (response_headers_.get() && response_headers_->response_code() == 204)) { |
| 655 return true; |
| 656 } |
| 657 |
| 658 // The content embedder can decide that a transfer to a different process is |
| 659 // required for this URL. |
| 660 bool should_transfer = |
| 661 GetContentClient()->browser()->ShouldSwapProcessesForRedirect( |
| 662 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
| 663 original_url_, url_); |
| 664 |
| 665 RenderFrameHostManager* manager = |
| 666 render_frame_host_->frame_tree_node()->render_manager(); |
| 667 |
| 668 // In the site-per-process model, the RenderFrameHostManager may also decide |
| 669 // (independently from the content embedder's ShouldSwapProcessesForRedirect |
| 670 // above) that a process transfer is needed. Process transfers are skipped for |
| 671 // WebUI processes for now, since e.g. chrome://settings has multiple |
| 672 // "cross-site" chrome:// frames, and that doesn't yet work cross-process. |
| 673 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() && |
| 674 !ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( |
| 675 render_frame_host_->GetProcess()->GetID())) { |
| 676 should_transfer |= manager->IsRendererTransferNeededForNavigation( |
| 677 render_frame_host_, url_); |
| 678 } |
| 679 |
| 680 // Start the transfer if needed. |
| 681 if (should_transfer) { |
| 682 // This may destroy the NavigationHandle if the transfer fails. |
| 683 base::WeakPtr<NavigationHandleImpl> weak_self = weak_factory_.GetWeakPtr(); |
| 684 manager->OnCrossSiteResponse(render_frame_host_, request_id_, |
| 685 redirect_chain_, sanitized_referrer_, |
| 686 transition_, should_replace_current_entry_); |
| 687 if (!weak_self) |
| 688 return false; |
| 689 } |
| 690 |
| 691 return true; |
| 692 } |
| 693 |
| 579 void NavigationHandleImpl::RunCompleteCallback( | 694 void NavigationHandleImpl::RunCompleteCallback( |
| 580 NavigationThrottle::ThrottleCheckResult result) { | 695 NavigationThrottle::ThrottleCheckResult result) { |
| 581 DCHECK(result != NavigationThrottle::DEFER); | 696 DCHECK(result != NavigationThrottle::DEFER); |
| 582 | 697 |
| 583 ThrottleChecksFinishedCallback callback = complete_callback_; | 698 ThrottleChecksFinishedCallback callback = complete_callback_; |
| 584 complete_callback_.Reset(); | 699 complete_callback_.Reset(); |
| 585 | 700 |
| 586 if (!callback.is_null()) | 701 if (!callback.is_null()) |
| 587 callback.Run(result); | 702 callback.Run(result); |
| 588 | 703 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 608 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 723 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
| 609 | 724 |
| 610 if (throttles_to_register.size() > 0) { | 725 if (throttles_to_register.size() > 0) { |
| 611 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 726 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
| 612 throttles_to_register.end()); | 727 throttles_to_register.end()); |
| 613 throttles_to_register.weak_clear(); | 728 throttles_to_register.weak_clear(); |
| 614 } | 729 } |
| 615 } | 730 } |
| 616 | 731 |
| 617 } // namespace content | 732 } // namespace content |
| OLD | NEW |