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

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

Issue 2510083003: PlzNavigate: properly update NavigationHandle for 204/205 and download responses (Closed)
Patch Set: address comments of clamy@ Created 4 years 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
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/debug/dump_without_crashing.h" 7 #include "base/debug/dump_without_crashing.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/browser/browsing_data/clear_site_data_throttle.h" 9 #include "content/browser/browsing_data/clear_site_data_throttle.h"
10 #include "content/browser/child_process_security_policy_impl.h" 10 #include "content/browser/child_process_security_policy_impl.h"
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 connection_info_ = connection_info; 486 connection_info_ = connection_info;
487 request_id_ = request_id; 487 request_id_ = request_id;
488 should_replace_current_entry_ = should_replace_current_entry; 488 should_replace_current_entry_ = should_replace_current_entry;
489 is_download_ = is_download; 489 is_download_ = is_download;
490 is_stream_ = is_stream; 490 is_stream_ = is_stream;
491 state_ = WILL_PROCESS_RESPONSE; 491 state_ = WILL_PROCESS_RESPONSE;
492 ssl_status_ = ssl_status; 492 ssl_status_ = ssl_status;
493 complete_callback_ = callback; 493 complete_callback_ = callback;
494 transfer_callback_ = transfer_callback; 494 transfer_callback_ = transfer_callback;
495 495
496 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not
497 // commit; they leave the frame showing the previous page.
498 const bool is_204_205_response =
499 response_headers_ && (response_headers_->response_code() == 204 ||
500 response_headers_->response_code() == 205);
501
502 // No need to cancel in non-PlzNavigate case. In that case, we will get
503 // DidFailProvisionalLoadWithError notification from the renderer to abort the
504 // navigation.
505 if (IsBrowserSideNavigationEnabled() &&
506 (is_204_205_response || is_download_)) {
507 net_error_code_ = net::ERR_ABORTED;
508 state_ = CANCELING;
509 RunCompleteCallback(NavigationThrottle::CANCEL_AND_IGNORE);
510 return;
511 }
512
496 // Notify each throttle of the response. 513 // Notify each throttle of the response.
497 NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse(); 514 NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse();
498 515
499 // If the navigation is done processing the response, then it's ready to 516 // If the navigation is done processing the response, then it's ready to
500 // commit. Determine which RenderFrameHost should render the response, based 517 // commit. Determine which RenderFrameHost should render the response, based
501 // on its site (after any redirects). 518 // on its site (after any redirects).
502 // Note: if MaybeTransferAndProceed returns false, this means that this 519 // Note: if MaybeTransferAndProceed returns false, this means that this
503 // NavigationHandle was deleted, so return immediately. 520 // NavigationHandle was deleted, so return immediately.
504 if (result == NavigationThrottle::PROCEED && !MaybeTransferAndProceed()) 521 if (result == NavigationThrottle::PROCEED && !MaybeTransferAndProceed())
505 return; 522 return;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 throttles_to_register.push_back(std::move(clear_site_data_throttle)); 788 throttles_to_register.push_back(std::move(clear_site_data_throttle));
772 789
773 if (throttles_to_register.size() > 0) { 790 if (throttles_to_register.size() > 0) {
774 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), 791 throttles_.insert(throttles_.begin(), throttles_to_register.begin(),
775 throttles_to_register.end()); 792 throttles_to_register.end());
776 throttles_to_register.weak_clear(); 793 throttles_to_register.weak_clear();
777 } 794 }
778 } 795 }
779 796
780 } // namespace content 797 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698