Commit 74c9dc10 authored by Stephane Zermatten's avatar Stephane Zermatten Committed by Commit Bot

[Autofill Assistant] Allow clicking on links.

Before this patch, navigation triggered by clicking on a link or through
javascript (renderer-initiated navigation) was considered an end state
for Autofill assistant.

With this patch, such actions are only considered an end state if the
page that's navigated to has no scripts. This is necessary, as such
navigation is part of the expected flow of some scripts.

Going back a page or refreshing through the UI (non renderer-initiated
navigation) are still considered an end state with this patch.

Bug: 806868
Change-Id: I5a38a82e7edf8b34a5830130b957dfad387e1b0d
Reviewed-on: https://chromium-review.googlesource.com/c/1329242Reviewed-by: default avatarMathias Carlen <mcarlen@chromium.org>
Commit-Queue: Stephane Zermatten <szermatt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606826}
parent 3c86aa45
...@@ -360,12 +360,10 @@ void Controller::OnNoRunnableScriptsAnymore() { ...@@ -360,12 +360,10 @@ void Controller::OnNoRunnableScriptsAnymore() {
if (script_tracker_->running()) if (script_tracker_->running())
return; return;
// We're on a page that has no scripts or the scripts have reached a state // We're navigated to a page that has no scripts or the scripts have reached a
// from which they cannot recover through a DOM change. This should never // state from which they cannot recover through a DOM change.
// happen with a consistent set of scripts; there should always be an explicit
// end.
GetUiController()->ShowStatusMessage( GetUiController()->ShowStatusMessage(
l10n_util::GetStringUTF8(IDS_AUTOFILL_ASSISTANT_DEFAULT_ERROR)); l10n_util::GetStringUTF8(IDS_AUTOFILL_ASSISTANT_GIVE_UP));
GetUiController()->ShutdownGracefully(); GetUiController()->ShutdownGracefully();
return; return;
} }
...@@ -442,13 +440,18 @@ void Controller::DidStartNavigation( ...@@ -442,13 +440,18 @@ void Controller::DidStartNavigation(
// - server redirections, which might happen outside of a script, but // - server redirections, which might happen outside of a script, but
// because of a load triggered by a previously-running script. // because of a load triggered by a previously-running script.
// - same-document modifications, which might happen automatically // - same-document modifications, which might happen automatically
/// // - javascript-initiated navigation or refresh
// Everything else, such as clicking on a link, going back to a previous page, // - navigation by clicking on a link
// or refreshing the page is considered an end condition. // In the last two cases, autofill assistant might still give up later on if
// it discovers that the new page has no scripts.
//
// Everything else, such as going back to a previous page, or refreshing the
// page is considered an end condition.
if (navigation_handle->IsInMainFrame() && if (navigation_handle->IsInMainFrame() &&
web_contents()->GetLastCommittedURL().is_valid() && web_contents()->GetLastCommittedURL().is_valid() &&
!script_tracker_->running() && !navigation_handle->WasServerRedirect() && !script_tracker_->running() && !navigation_handle->WasServerRedirect() &&
!navigation_handle->IsSameDocument()) { !navigation_handle->IsSameDocument() &&
!navigation_handle->IsRendererInitiated()) {
OnGiveUp(); OnGiveUp();
return; return;
} }
......
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