Commit 77318515 authored by Moe Ahmadi's avatar Moe Ahmadi Committed by Commit Bot

[AF][IOS] Scan page for form changes when a field is focused

This CL fixes a regression caused by crrev.com/c/1012979. Previously,
AutofillAgent would scan the whole page on form activities due to the
possiblity of Autofill having been enabled after page load.
crrev.com/c/1012979 replaced that logic in favor of observing the Pref
directly. This has a side effect where previously hidden fields can go
unnoticed by AutofillManager. This CL fixes that regression by scanning the
page when a field is focused. All fields receive focuse before their value
is set by Autofill, therefore, AutofillManager can get notified of
previously hidden fields.

Bug: 855696
Change-Id: I175bf90e12d1ca356b746e6347943a295063c288
Reviewed-on: https://chromium-review.googlesource.com/1112493Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570713}
parent 8d88b47f
...@@ -634,10 +634,10 @@ void GetFormAndField(autofill::FormData* form, ...@@ -634,10 +634,10 @@ void GetFormAndField(autofill::FormData* form,
web::URLVerificationTrustLevel trustLevel; web::URLVerificationTrustLevel trustLevel;
const GURL pageURL(webState->GetCurrentURL(&trustLevel)); const GURL pageURL(webState->GetCurrentURL(&trustLevel));
// If the event is a form_changed, then the event concerns the whole page and // Scan the page to find the latest version of the forms for their new,
// not a particular form. The whole page need to be reparsed to find the new // changed or previously hidden fields, when we get notified of form changes
// forms. // or a field is focused.
if (params.type == "form_changed") { if (params.type == "form_changed" || params.type == "focus") {
[self scanFormsInPage:webState pageURL:pageURL]; [self scanFormsInPage:webState pageURL:pageURL];
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