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

Unified Diff: content/browser/frame_host/navigation_request.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
Index: content/browser/frame_host/navigation_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 7351dbcd2b4ca371eb1c4e2044d51cc85e11b74a..32929c37b0226c075f8327554a31ad522b151620 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -383,17 +383,7 @@ void NavigationRequest::OnResponseStarted(
DCHECK(state_ == STARTED);
state_ = RESPONSE_STARTED;
- // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not
- // commit; they leave the frame showing the previous page.
DCHECK(response);
- if (response->head.headers.get() &&
- (response->head.headers->response_code() == 204 ||
- response->head.headers->response_code() == 205)) {
- frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded(
- navigation_handle_.get());
- frame_tree_node_->ResetNavigationRequest(false);
- return;
- }
// Update the service worker params of the request params.
bool did_create_service_worker_host =
@@ -570,9 +560,13 @@ void NavigationRequest::OnWillProcessResponseChecksComplete(
CHECK(result != NavigationThrottle::DEFER);
// Abort the request if needed. This will destroy the NavigationRequest.
- if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
- result == NavigationThrottle::CANCEL) {
- // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
+ if (result == NavigationThrottle::CANCEL_AND_IGNORE) {
+ frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded(
+ navigation_handle_.get());
+ frame_tree_node_->ResetNavigationRequest(false);
+ return;
+ }
+ if (result == NavigationThrottle::CANCEL) {
frame_tree_node_->ResetNavigationRequest(false);
return;
}
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.cc ('k') | content/browser/loader/navigation_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698