mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1638311 - [1.1] Ignore input type=hidden elements for autofill. r=geckoview-reviewers,MattN,agi
Differential Revision: https://phabricator.services.mozilla.com/D78557
This commit is contained in:
parent
a886b3e138
commit
3834bcff96
@ -272,11 +272,12 @@ class AutofillDelegateTest : BaseSessionTest() {
|
||||
countAutofillNodes({ it.focused }), equalTo(1))
|
||||
// The focused field, its siblings, its parent, and the root node should
|
||||
// be visible.
|
||||
// Hidden elements are ignored.
|
||||
// TODO: Is this actually correct? Should the whole focused branch be
|
||||
// visible or just the nodes as described above?
|
||||
assertThat("Should have seven visible nodes",
|
||||
countAutofillNodes({ node -> node.visible }),
|
||||
equalTo(7))
|
||||
equalTo(6))
|
||||
|
||||
mainSession.evaluateJS("document.querySelector('#pass2').blur()")
|
||||
sessionRule.waitUntilCalled(object : Callbacks.AutofillDelegate {
|
||||
|
@ -34,7 +34,7 @@ import org.mozilla.gecko.util.GeckoBundle;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
public class Autofill {
|
||||
private static final boolean DEBUG = true;
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
public static final class Notify {
|
||||
private Notify() {}
|
||||
@ -651,8 +651,6 @@ public class Autofill {
|
||||
|
||||
Log.d(LOGTAG, "fillViewStructure");
|
||||
|
||||
final Node root = getRoot();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
structure.setAutofillId(view.getAutofillId(), getId());
|
||||
structure.setWebDomain(getDomain());
|
||||
@ -1026,11 +1024,13 @@ public class Autofill {
|
||||
final CharSequence value = values.valueAt(i);
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(LOGTAG, "autofill(" + id + ')');
|
||||
Log.d(LOGTAG, "Process autofill for id=" + id + ", value=" + value);
|
||||
}
|
||||
|
||||
int rootId = id;
|
||||
for (int currentId = id; currentId != View.NO_ID; ) {
|
||||
final Node elem = getAutofillSession().getNode(currentId);
|
||||
|
||||
if (elem == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -201,11 +201,12 @@ class GeckoViewAutofill {
|
||||
rootInfo.children = aFormLike.elements
|
||||
.filter(
|
||||
element =>
|
||||
!usernameField ||
|
||||
element.type != "text" ||
|
||||
element == usernameField ||
|
||||
(element.getAutocompleteInfo() &&
|
||||
element.getAutocompleteInfo().fieldName == "email")
|
||||
element.type != "hidden" &&
|
||||
(!usernameField ||
|
||||
element.type != "text" ||
|
||||
element == usernameField ||
|
||||
(element.getAutocompleteInfo() &&
|
||||
element.getAutocompleteInfo().fieldName == "email"))
|
||||
)
|
||||
.map(element => {
|
||||
sendFocusEvent |= element === focusedElement;
|
||||
|
Loading…
Reference in New Issue
Block a user