New issue
Advanced search Search tips

Issue 918351 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Datalist options not appearing as suggestions for an input field after its type has been set to password once

Reported by markus.d...@gmail.com, Dec 31

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

Steps to reproduce the problem:
1. Click "Make option" and observe a suggestion appear for the input field.
2. Click "Switch to password" and then "Switch to text".
3. Notice that the suggestion dropdown never appears anymore.

What is the expected behavior?
Suggestions for the dropdown should appear after the input field's type has been set back to "text".

What went wrong?
Datalist options don't appear as suggestions for the input field after its type has been set to "password" once.

Did this work before? No 

Does this work in other browsers? Yes

Chrome version: 71.0.3578.98  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
 
test.html
947 bytes View Download
Labels: Needs-Triage-M71
Bisected to r525140 = 1bb521c4dce5635a2139c4fec9ef5304f28298f3 = crrev.com/c/829373 by battre@chromium.org
"Implement stickyness of password type for autofill"
Landed in 65.0.3300.0

	Websites now sometimes have buttons that turn <input type="password"> fields
	into <input type="text"> to allow the user to view their password. This creates
	two problems for autofill and the password manager.
	1) Autofill may learn password and suggest them for autofilling.
	2) The password manager may fail to offer saving passwords because it does not
	recognize the password field as such anymore.

	This CL introduces a change such that for text input fields, a field is
	considered a password field if it has been one in the past.
Cc: swarnasree.mukkala@chromium.org
Labels: -Type-Bug -Pri-2 Target-73 Triaged-ET RegressedIn-65 Target-71 Target-72 FoundIn-72 M-73 FoundIn-71 FoundIn-73 hasbisect OS-Linux OS-Mac Pri-1 Type-Bug-Regression
Owner: battre@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on reported chrome version #71.0.3578.98 and latest chrome #73.0.3657.0 using Windows 10, Ubuntu 17.10 and Mac OS 10.13.6 by following steps as per comment#0. As per comment#2, the following is the bisect information.

Bisect Information:
====================
Good Build: 65.0.3300.0
Bad Build: 65.0.3299.0

CHANGE LOG: https://chromium.googlesource.com/chromium/src/+/1bb521c4dce5635a2139c4fec9ef5304f28298f3
Reviewed-on: https://chromium-review.googlesource.com/829373
@Dominic Battre: Please help us in reassigning the issue if it is not related to your change.
Thanks.!
Components: UI>Browser>Autofill
Notes to self...

The fix looks simple:
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index a0e0f41096d9..638ae0ef5bf2 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -654,7 +654,14 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element,
 
   // Password field elements should only have suggestions shown by the password
   // autofill agent.
-  if (input_element && input_element->IsPasswordFieldForAutofill() &&
+  // The /*disable presubmit*/ comment below is used to disable a presubmit
+  // script that ensures that only IsPasswordFieldForAutofill() is used in this
+  // code (it has to appear between the function name and the parentesis to not
+  // match a regex). In this specific case we are actually interested in whether
+  // the field is currently a password field, not whether it has ever been a
+  // password field.
+  if (input_element &&
+      input_element->IsPasswordField /*disable presubmit*/ () &&
       !query_password_suggestion_) {
     return;
   }

As always, the testing is hard. :-)

We would basically need to replicate AutofillInteractiveTest.OnSelectOptionFromDatalist from chrome/browser/autofill/autofill_interactive_uitest.cc. Unfortunately, that's currently broken.
Status: Started (was: Assigned)
Thanks for the reproduction case. CL submitted for review here: https://chromium-review.googlesource.com/c/chromium/src/+/1392342
Project Member

Comment 6 by bugdroid1@chromium.org, Jan 2

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9758fada507db2abb745c06dfbee00cbdb38cfc2

commit 9758fada507db2abb745c06dfbee00cbdb38cfc2
Author: Dominic Battre <battre@chromium.org>
Date: Wed Jan 02 14:14:33 2019

Fix support for datalist options after input was password field

If an <input> element is or becomes a password field, it get a sticky flag such
that IsPasswordFieldForAutofill() will always return true. This has been
implemented for <input type="password"> fields that are toggled to <input
type="text"> when the user clicks on some kind of "reveal password" button
(often an eye next to the password field). The password manager needs to
continue treating this as a password field (offer saving, offer
fill-on-account-select, ...).

This CL relaxes the logic in such a way that datalist options are considered if
an <input> element has been a password but currently is not a password anymore.

In case the password manager wants to display a drop-down AND there are
datalist options, there is a conflict. While the input field is empty, the
password manager wins. Once the user starts typing, the password manager popup
disappears and the datalist options are shown if (and only if) they contain the
typed characters.

Bug:  918351 
Change-Id: Ifbe19422aa7ef5ee6582bd1cbeaab4bd93aff0fd
Reviewed-on: https://chromium-review.googlesource.com/c/1392342
Reviewed-by: Vadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Dominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619396}
[modify] https://crrev.com/9758fada507db2abb745c06dfbee00cbdb38cfc2/chrome/browser/autofill/autofill_interactive_uitest.cc
[modify] https://crrev.com/9758fada507db2abb745c06dfbee00cbdb38cfc2/components/autofill/content/renderer/autofill_agent.cc

Status: Fixed (was: Started)

Sign in to add a comment