Commit c1890522 authored by Arthur Hemery's avatar Arthur Hemery Committed by Commit Bot

Navigation: Avoid early abort when intercepting DidCommit.

After running a callback in the renderer we destroy the
NavigationClient interface that was used to commit, since
by design, it is an interface that lives only during the navigation.

This is not an issue, except with the introduction of mechanisms
intercepting DidCommit* callbacks and messages execution. In this case,
the callback is intercepted, but the destruction still is interpreted
by the NavigationRequest to be an abort.

To counteract this, we introduce a new helper function that we use to
ignore interface disconnects when receiving the DidCommit* messages,
and before processing it. This way we are guaranteed (because we
receive the messages in order DidCommit -> Disconnect) that the
disconnect coming from this source is always ignored.

Bug: 784904
Change-Id: If169c3f9fb76a20200dbb1466e9bc48d736140bf
Reviewed-on: https://chromium-review.googlesource.com/c/1491434Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Commit-Queue: Arthur Hemery <ahemery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636771}
parent 2e3986d1
...@@ -2058,4 +2058,9 @@ void NavigationRequest::IgnoreInterfaceDisconnection() { ...@@ -2058,4 +2058,9 @@ void NavigationRequest::IgnoreInterfaceDisconnection() {
base::DoNothing()); base::DoNothing());
} }
void NavigationRequest::IgnoreCommitInterfaceDisconnection() {
return commit_navigation_client_.set_connection_error_handler(
base::DoNothing());
}
} // namespace content } // namespace content
...@@ -251,6 +251,10 @@ class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate { ...@@ -251,6 +251,10 @@ class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate {
common_params_.has_user_gesture = has_user_gesture; common_params_.has_user_gesture = has_user_gesture;
} }
// Ignores any interface disconnect that might happen to the
// navigation_client used to commit.
void IgnoreCommitInterfaceDisconnection();
private: private:
NavigationRequest(FrameTreeNode* frame_tree_node, NavigationRequest(FrameTreeNode* frame_tree_node,
const CommonNavigationParams& common_params, const CommonNavigationParams& common_params,
......
...@@ -2171,6 +2171,7 @@ void RenderFrameHostImpl::DidCommitPerNavigationMojoInterfaceNavigation( ...@@ -2171,6 +2171,7 @@ void RenderFrameHostImpl::DidCommitPerNavigationMojoInterfaceNavigation(
validated_params, validated_params,
mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) { mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) {
DCHECK(committing_navigation_request); DCHECK(committing_navigation_request);
committing_navigation_request->IgnoreCommitInterfaceDisconnection();
DidCommitNavigation(committing_navigation_request, DidCommitNavigation(committing_navigation_request,
std::move(validated_params), std::move(interface_params)); std::move(validated_params), std::move(interface_params));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment