Chromium Code Reviews| 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..bbcdcfed714ce72c31ee6e791299a06d76325ca9 100644 |
| --- a/content/browser/frame_host/navigation_handle_impl.cc |
| +++ b/content/browser/frame_host/navigation_handle_impl.cc |
| @@ -623,6 +623,23 @@ 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. |
| + const bool is_204_205_response = |
|
clamy
2016/11/25 10:46:00
I'm still not super happy about the code flow here
yzshen1
2016/11/28 22:03:59
Done.
clamy
2016/11/30 17:44:03
Yes this is something we could do as well. Let me
|
| + 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; |
| + return NavigationThrottle::CANCEL_AND_IGNORE; |
| + } |
| + |
| for (size_t i = next_index_; i < throttles_.size(); ++i) { |
| NavigationThrottle::ThrottleCheckResult result = |
| throttles_[i]->WillProcessResponse(); |