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

Unified Diff: content/browser/frame_host/navigation_request.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_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 4c24485495582a9779114f52df872e9a33ff8b8c..642962f64a7754a9d00c213712d036a39b88b41f 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -375,21 +375,12 @@ void NavigationRequest::OnResponseStarted(
const scoped_refptr<ResourceResponse>& response,
std::unique_ptr<StreamHandle> body,
const SSLStatus& ssl_status,
- std::unique_ptr<NavigationData> navigation_data) {
+ std::unique_ptr<NavigationData> navigation_data,
+ bool is_download) {
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 =
@@ -433,12 +424,11 @@ void NavigationRequest::OnResponseStarted(
body_ = std::move(body);
// Check if the navigation should be allowed to proceed.
- // TODO(clamy): pass the right values for request_id, is_download and
- // is_stream.
+ // TODO(clamy): pass the right values for request_id and is_stream.
navigation_handle_->WillProcessResponse(
render_frame_host, response->head.headers.get(),
response->head.connection_info, ssl_status, GlobalRequestID(),
- common_params_.should_replace_current_entry, false, false,
+ common_params_.should_replace_current_entry, is_download, false,
clamy 2016/11/25 10:46:00 Could we pass the values for is_stream and GlobalR
yzshen1 2016/11/28 22:03:59 Done.
base::Closure(),
base::Bind(&NavigationRequest::OnWillProcessResponseChecksComplete,
base::Unretained(this)));
@@ -568,9 +558,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;
}

Powered by Google App Engine
This is Rietveld 408576698