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

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

Issue 2488743003: (Re-)introduce AncestorThrottle to handle 'X-Frame-Options'. (Closed)
Patch Set: Display a blank page instead of an error page. ( and add checks in NavigationRequest) 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_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index ae9e5dbe57a7670f7f2835d180ace81f6c679869..e931df84eee2ad880b3cf16265563d5af103e3bf 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -9,6 +9,7 @@
#include "content/browser/browsing_data/clear_site_data_throttle.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/devtools/render_frame_devtools_agent_host.h"
+#include "content/browser/frame_host/ancestor_throttle.h"
#include "content/browser/frame_host/debug_urls.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/navigator.h"
@@ -289,7 +290,7 @@ void NavigationHandleImpl::CancelDeferredNavigation(
DCHECK(state_ == DEFERRING_START || state_ == DEFERRING_REDIRECT);
DCHECK(result == NavigationThrottle::CANCEL_AND_IGNORE ||
result == NavigationThrottle::CANCEL);
- state_ = CANCELING;
+ state_ = CANCELING_REQUEST;
RunCompleteCallback(result);
}
@@ -583,14 +584,20 @@ NavigationHandleImpl::CheckWillStartRequest() {
case NavigationThrottle::CANCEL:
case NavigationThrottle::CANCEL_AND_IGNORE:
+ state_ = CANCELING_REQUEST;
+ return result;
+
case NavigationThrottle::BLOCK_REQUEST:
- state_ = CANCELING;
+ state_ = CANCELING_RESPONSE;
alexmos 2016/11/30 01:22:19 I know this is the same as in mkwst@'s original CL
arthursonzogni 2016/11/30 13:49:55 It looks suspicious to me. I think CANCELING_REQUE
return result;
case NavigationThrottle::DEFER:
state_ = DEFERRING_START;
next_index_ = i + 1;
return result;
+
+ case NavigationThrottle::BLOCK_RESPONSE:
+ NOTREACHED();
}
}
next_index_ = 0;
@@ -612,7 +619,7 @@ NavigationHandleImpl::CheckWillRedirectRequest() {
case NavigationThrottle::CANCEL:
case NavigationThrottle::CANCEL_AND_IGNORE:
- state_ = CANCELING;
+ state_ = CANCELING_REQUEST;
return result;
case NavigationThrottle::DEFER:
@@ -621,6 +628,7 @@ NavigationHandleImpl::CheckWillRedirectRequest() {
return result;
case NavigationThrottle::BLOCK_REQUEST:
+ case NavigationThrottle::BLOCK_RESPONSE:
NOTREACHED();
}
}
@@ -648,7 +656,11 @@ NavigationHandleImpl::CheckWillProcessResponse() {
case NavigationThrottle::CANCEL:
case NavigationThrottle::CANCEL_AND_IGNORE:
- state_ = CANCELING;
+ state_ = CANCELING_REQUEST;
+ return result;
+
+ case NavigationThrottle::BLOCK_RESPONSE:
+ state_ = CANCELING_RESPONSE;
return result;
case NavigationThrottle::DEFER:
@@ -774,6 +786,7 @@ void NavigationHandleImpl::RegisterNavigationThrottles() {
// GetNavigationThrottles is not assigned to throttles_ directly because it
// would overwrite any throttle previously added with
// RegisterThrottleForTesting.
+
ScopedVector<NavigationThrottle> throttles_to_register =
GetDelegate()->CreateThrottlesForNavigation(this);
std::unique_ptr<NavigationThrottle> devtools_throttle =
@@ -786,6 +799,11 @@ void NavigationHandleImpl::RegisterNavigationThrottles() {
if (clear_site_data_throttle)
throttles_to_register.push_back(std::move(clear_site_data_throttle));
+ std::unique_ptr<content::NavigationThrottle> ancestor_throttle =
+ content::AncestorThrottle::MaybeCreateThrottleFor(this);
+ if (ancestor_throttle)
+ throttles_.push_back(std::move(ancestor_throttle));
+
if (throttles_to_register.size() > 0) {
throttles_.insert(throttles_.begin(), throttles_to_register.begin(),
throttles_to_register.end());

Powered by Google App Engine
This is Rietveld 408576698