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 46866467c1b8cdbff04a4724cd1a56569396b7e6..bde20dbda9394cd0a29c40d6028a5777656d15c1 100644 |
--- a/content/browser/frame_host/navigation_handle_impl.cc |
+++ b/content/browser/frame_host/navigation_handle_impl.cc |
@@ -355,7 +355,15 @@ void NavigationHandleImpl::CancelDeferredNavigation( |
state_ == DEFERRING_REDIRECT || |
state_ == DEFERRING_RESPONSE); |
DCHECK(result == NavigationThrottle::CANCEL_AND_IGNORE || |
- result == NavigationThrottle::CANCEL); |
+ result == NavigationThrottle::CANCEL || |
+ result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE); |
alexmos
2017/04/11 06:00:29
Please update the comments on CancelDeferredNaviga
engedy
2017/04/11 08:06:16
Done.
|
+ DCHECK(result != NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE || |
+ state_ == DEFERRING_START || |
+ (state_ == DEFERRING_REDIRECT && IsBrowserSideNavigationEnabled())); |
+ |
+ if (result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) |
+ frame_tree_node_->SetCollapsed(true); |
+ |
state_ = CANCELING; |
RunCompleteCallback(result); |
} |
@@ -680,6 +688,13 @@ void NavigationHandleImpl::DidCommitNavigation( |
state_ = DID_COMMIT_ERROR_PAGE; |
} else { |
state_ = DID_COMMIT; |
+ |
+ // Getting this far means that the navigation was not blocked, and neither |
+ // is this the error page navigation following a blocked navigation. Ensure |
+ // the frame owner element is no longer collapsed as a result of a prior |
+ // navigation having been blocked with BLOCK_REQUEST_AND_COLLAPSE. |
+ if (!frame_tree_node()->IsMainFrame()) |
+ frame_tree_node()->SetCollapsed(false); |
} |
if (url_.SchemeIs(url::kDataScheme) && IsInMainFrame() && |
@@ -722,6 +737,11 @@ NavigationHandleImpl::CheckWillStartRequest() { |
state_ = CANCELING; |
return result; |
+ case NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE: |
+ frame_tree_node_->SetCollapsed(true); |
+ state_ = CANCELING; |
+ return result; |
+ |
case NavigationThrottle::DEFER: |
state_ = DEFERRING_START; |
next_index_ = i + 1; |
@@ -748,9 +768,13 @@ NavigationHandleImpl::CheckWillRedirectRequest() { |
case NavigationThrottle::PROCEED: |
continue; |
+ case NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE: |
+ frame_tree_node_->SetCollapsed(true); |
+ // Fall through. |
case NavigationThrottle::BLOCK_REQUEST: |
CHECK(IsBrowserSideNavigationEnabled()) |
- << "BLOCK_REQUEST must not be used on redirect without PlzNavigate"; |
+ << "BLOCK_REQUEST and BLOCK_REQUEST_AND_COLLAPSE must not be used " |
+ "on redirect without PlzNavigate"; |
case NavigationThrottle::CANCEL: |
case NavigationThrottle::CANCEL_AND_IGNORE: |
state_ = CANCELING; |
@@ -799,6 +823,7 @@ NavigationHandleImpl::CheckWillProcessResponse() { |
return result; |
case NavigationThrottle::BLOCK_REQUEST: |
+ case NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE: |
NOTREACHED(); |
} |
} |