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

Unified 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, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index f2b2f133ddb19e898c42a356464ef428bd77a875..bd8bc8af3bceb9d424980713fc818e14fa6901eb 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -493,6 +493,23 @@ void NavigationHandleImpl::WillProcessResponse(
complete_callback_ = callback;
transfer_callback_ = transfer_callback;
+ // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not
+ // commit; they leave the frame showing the previous page.
+ const bool is_204_205_response =
+ response_headers_ && (response_headers_->response_code() == 204 ||
+ response_headers_->response_code() == 205);
+
+ // No need to cancel in non-PlzNavigate case. In that case, we will get
+ // DidFailProvisionalLoadWithError notification from the renderer to abort the
+ // navigation.
+ if (IsBrowserSideNavigationEnabled() &&
+ (is_204_205_response || is_download_)) {
+ net_error_code_ = net::ERR_ABORTED;
+ state_ = CANCELING;
+ RunCompleteCallback(NavigationThrottle::CANCEL_AND_IGNORE);
+ return;
+ }
+
// Notify each throttle of the response.
NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse();
« 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