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

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: . 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
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..3475b22914cbb57b44074da1bf33f801a9706b0d 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -623,6 +623,16 @@ NavigationHandleImpl::CheckWillProcessResponse() {
DCHECK(state_ == WILL_PROCESS_RESPONSE || state_ == DEFERRING_RESPONSE);
DCHECK(state_ != WILL_PROCESS_RESPONSE || next_index_ == 0);
DCHECK(state_ != DEFERRING_RESPONSE || next_index_ != 0);
+
+ // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not
+ // commit; they leave the frame showing the previous page.
+ if (response_headers_ && (response_headers_->response_code() == 204 ||
+ response_headers_->response_code() == 205)) {
+ net_error_code_ = net::ERR_ABORTED;
yzshen1 2016/11/18 00:10:53 Changing the net error code seems weird. But it ma
+ state_ = CANCELING;
+ return NavigationThrottle::CANCEL_AND_IGNORE;
+ }
+
for (size_t i = next_index_; i < throttles_.size(); ++i) {
NavigationThrottle::ThrottleCheckResult result =
throttles_[i]->WillProcessResponse();
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request.cc » ('j') | content/browser/frame_host/navigation_request.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698