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 bb59cb07a25bbb960e2cd5965a3b2cc73a0f9460..b94e8073f6b74f8002f76c3adcc259c19582f6f4 100644 |
--- a/content/browser/frame_host/navigation_handle_impl.cc |
+++ b/content/browser/frame_host/navigation_handle_impl.cc |
@@ -9,6 +9,7 @@ |
#include "base/logging.h" |
#include "content/browser/browsing_data/clear_site_data_throttle.h" |
#include "content/browser/devtools/render_frame_devtools_agent_host.h" |
+#include "content/browser/frame_host/ancestor_throttle.h" |
#include "content/browser/frame_host/frame_tree_node.h" |
#include "content/browser/frame_host/navigator.h" |
#include "content/browser/frame_host/navigator_delegate.h" |
@@ -248,7 +249,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); |
} |
@@ -453,14 +454,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; |
return result; |
case NavigationThrottle::DEFER: |
state_ = DEFERRING_START; |
next_index_ = i + 1; |
return result; |
+ |
+ case NavigationThrottle::BLOCK_RESPONSE: |
+ NOTREACHED(); |
} |
} |
next_index_ = 0; |
@@ -482,7 +489,7 @@ NavigationHandleImpl::CheckWillRedirectRequest() { |
case NavigationThrottle::CANCEL: |
case NavigationThrottle::CANCEL_AND_IGNORE: |
- state_ = CANCELING; |
+ state_ = CANCELING_REQUEST; |
return result; |
case NavigationThrottle::DEFER: |
@@ -491,6 +498,7 @@ NavigationHandleImpl::CheckWillRedirectRequest() { |
return result; |
case NavigationThrottle::BLOCK_REQUEST: |
+ case NavigationThrottle::BLOCK_RESPONSE: |
NOTREACHED(); |
} |
} |
@@ -518,7 +526,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: |
@@ -554,8 +566,10 @@ 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 = |
GetContentClient()->browser()->CreateThrottlesForNavigation(this); |
+ |
std::unique_ptr<NavigationThrottle> devtools_throttle = |
RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); |
if (devtools_throttle) |
@@ -566,6 +580,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()); |