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