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

Unified Diff: content/browser/frame_host/navigation_request.cc

Issue 2488743003: (Re-)introduce AncestorThrottle to handle 'X-Frame-Options'. (Closed)
Patch Set: Addressed comments (@clamy). Created 4 years 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 cfdd32db8acb5b0bf01b7fa280952e70a5230739..2ecc7b2f360d12ea902c23cc5d83908723119e09 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -446,7 +446,7 @@ void NavigationRequest::OnResponseStarted(
void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache,
int net_error) {
- DCHECK(state_ == STARTED);
+ DCHECK(state_ == STARTED || state_ == RESPONSE_STARTED);
state_ = FAILED;
navigation_handle_->set_net_error_code(static_cast<net::Error>(net_error));
frame_tree_node_->navigator()->FailedNavigation(
@@ -467,6 +467,7 @@ void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) {
void NavigationRequest::OnStartChecksComplete(
NavigationThrottle::ThrottleCheckResult result) {
CHECK(result != NavigationThrottle::DEFER);
+ CHECK(result != NavigationThrottle::BLOCK_RESPONSE);
clamy 2016/12/09 17:14:01 nit: this should be changed to DCHECK. Same below.
// Abort the request if needed. This will destroy the NavigationRequest.
if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
@@ -478,6 +479,8 @@ void NavigationRequest::OnStartChecksComplete(
if (result == NavigationThrottle::BLOCK_REQUEST) {
OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT);
+ // DO NOT ADD CODE after this. The previous call to OnRequestFailed have
clamy 2016/12/09 17:14:01 nit:s/have/has
arthursonzogni 2016/12/13 15:32:13 Done
+ // destroyed the NavigationRequest.
return;
}
@@ -551,6 +554,7 @@ void NavigationRequest::OnStartChecksComplete(
void NavigationRequest::OnRedirectChecksComplete(
NavigationThrottle::ThrottleCheckResult result) {
CHECK(result != NavigationThrottle::DEFER);
+ CHECK(result != NavigationThrottle::BLOCK_RESPONSE);
// Abort the request if needed. This will destroy the NavigationRequest.
if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
@@ -575,6 +579,13 @@ void NavigationRequest::OnWillProcessResponseChecksComplete(
return;
}
+ if (result == NavigationThrottle::BLOCK_RESPONSE) {
+ OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE);
+ // DO NOT ADD CODE after this. The previous call to OnRequestFailed have
clamy 2016/12/09 17:14:01 nit:s/have/has
arthursonzogni 2016/12/13 15:32:13 Done.
+ // destroyed the NavigationRequest.
+ return;
+ }
+
// Have the processing of the response resume in the network stack.
loader_->ProceedWithResponse();

Powered by Google App Engine
This is Rietveld 408576698