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

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

Issue 2488743003: (Re-)introduce AncestorThrottle to handle 'X-Frame-Options'. (Closed)
Patch Set: Rebase 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..9f605b241fa86083e22ee70e4b2a684dd34c184a 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);
// Abort the request if needed. This will destroy the NavigationRequest.
if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
@@ -551,6 +552,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 +577,11 @@ void NavigationRequest::OnWillProcessResponseChecksComplete(
return;
}
+ if (result == NavigationThrottle::BLOCK_RESPONSE) {
+ OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE);
clamy 2016/12/06 17:09:44 Please add some comment mentionning not to add cod
arthursonzogni 2016/12/07 16:25:02 Done.
+ return;
+ }
+
// Have the processing of the response resume in the network stack.
loader_->ProceedWithResponse();

Powered by Google App Engine
This is Rietveld 408576698