Chromium Code Reviews| 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 2e525bbe4956a473d0c41d0d2051e1d5801bdef4..aa09fe9997c00d754f8996a6f004ee86f0683815 100644 |
| --- a/content/browser/frame_host/navigation_handle_impl.cc |
| +++ b/content/browser/frame_host/navigation_handle_impl.cc |
| @@ -317,6 +317,18 @@ void NavigationHandleImpl::Resume() { |
| result = CheckWillStartRequest(); |
| } else if (state_ == DEFERRING_REDIRECT) { |
| result = CheckWillRedirectRequest(); |
| + if (!IsBrowserSideNavigationEnabled() && |
| + result != NavigationThrottle::PROCEED && |
| + result != NavigationThrottle::DEFER) { |
| + // The renderer will not be informed of the redirect, as the navigation |
| + // will have been cancelled before sending the |
| + // ResourceMsg_ReceivedRedirect IPC. Reset the URL of the NavigationHandle |
| + // to the URL it had prior to the redirect, to match the commit of an |
| + // error page. |
| + redirect_chain_.pop_back(); |
| + DCHECK(!redirect_chain_.empty()); |
| + url_ = redirect_chain_.back(); |
|
Charlie Reis
2017/03/09 17:39:03
Does this mean that if we're redirecting from A to
arthursonzogni
2017/03/10 11:55:28
Yes unfortunately.
|
| + } |
| } else { |
| result = CheckWillProcessResponse(); |
| @@ -563,14 +575,27 @@ void NavigationHandleImpl::WillRedirectRequest( |
| state_ = WILL_REDIRECT_REQUEST; |
| complete_callback_ = callback; |
| + // Notify each throttle of the request. |
| + NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; |
| if (IsSelfReferentialURL()) { |
| state_ = CANCELING; |
| - RunCompleteCallback(NavigationThrottle::CANCEL); |
| - return; |
| + result = NavigationThrottle::CANCEL; |
| + } else { |
| + result = CheckWillRedirectRequest(); |
| } |
| - // Notify each throttle of the request. |
| - NavigationThrottle::ThrottleCheckResult result = CheckWillRedirectRequest(); |
| + if (!IsBrowserSideNavigationEnabled() && |
| + result != NavigationThrottle::PROCEED && |
| + result != NavigationThrottle::DEFER) { |
| + // The renderer will not be informed of the redirect, as the navigation |
| + // will have been cancelled before sending the |
| + // ResourceMsg_ReceivedRedirect IPC. Reset the URL of the NavigationHandle |
| + // to the URL it had prior to the redirect, to match the commit of an |
| + // error page. |
| + redirect_chain_.pop_back(); |
| + DCHECK(!redirect_chain_.empty()); |
| + url_ = redirect_chain_.back(); |
| + } |
| // If the navigation is not deferred, run the callback. |
| if (result != NavigationThrottle::DEFER) |
| @@ -683,9 +708,9 @@ NavigationHandleImpl::CheckWillStartRequest() { |
| case NavigationThrottle::PROCEED: |
| continue; |
| + case NavigationThrottle::BLOCK_REQUEST: |
| case NavigationThrottle::CANCEL: |
| case NavigationThrottle::CANCEL_AND_IGNORE: |
| - case NavigationThrottle::BLOCK_REQUEST: |
| state_ = CANCELING; |
| return result; |
| @@ -715,6 +740,7 @@ NavigationHandleImpl::CheckWillRedirectRequest() { |
| case NavigationThrottle::PROCEED: |
| continue; |
| + case NavigationThrottle::BLOCK_REQUEST: |
| case NavigationThrottle::CANCEL: |
| case NavigationThrottle::CANCEL_AND_IGNORE: |
| state_ = CANCELING; |
| @@ -725,7 +751,6 @@ NavigationHandleImpl::CheckWillRedirectRequest() { |
| next_index_ = i + 1; |
| return result; |
| - case NavigationThrottle::BLOCK_REQUEST: |
| case NavigationThrottle::BLOCK_RESPONSE: |
| NOTREACHED(); |
|
Charlie Reis
2017/03/09 17:39:03
Unrelated: NOTREACHED is compiled out of release b
arthursonzogni
2017/03/10 11:55:28
It is impossible to have NavigationThrottle::BLOCK
Charlie Reis
2017/03/13 20:48:02
My concern was that a poorly written NavigationThr
|
| } |