Closed
Bug 1030301
Opened 11 years ago
Closed 11 years ago
Filter unsupported <input> types that use @autocomplete
Categories
(Toolkit :: Form Manager, defect)
Toolkit
Form Manager
Tracking
()
RESOLVED
FIXED
mozilla35
People
(Reporter: bnicholson, Assigned: agi)
References
(Blocks 1 open bug)
Details
(Whiteboard: p=5)
Attachments
(1 file, 2 obsolete files)
7.52 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
With bug 1020496, all <input> types will have an @autocomplete attribute -- even those that aren't supported for rAc (radio, checkbox, etc.). We should filter out unsupported types.
(Quoting Matthew N. [:MattN] from https://bugzilla.mozilla.org/show_bug.cgi?id=1020602#c3)
> You can use input.mozIsTextField(true) to filter out radio/checkbox but it
> also filters out type=hidden. Exposing nsIFormControl::IsTextControl would
> be better since that includes textarea but hidden would still need to be
> special-cased. I just realized that number is missing too and possibly
> others so maybe we should have a separate helper perhaps on nsIFormControl
> (eventually) like isAutocompletableControl.
Assignee | ||
Comment 1•11 years ago
|
||
Would returning a blank string for non-supported input types work?
so e.g.
<input type="checkbox" autocomplete="tel">
would have @autocomplete == ""
Flags: needinfo?(bnicholson)
Reporter | ||
Comment 2•11 years ago
|
||
When I filed this bug, I think I meant to say getAutocompleteInfo() instead of @autocomplete since this is going to be used by us to filter out invalid inputs. After talking to MattN, though, he thinks both GetAutocomplete and GetAutocompleteInfo should be changed here: https://mxr.mozilla.org/mozilla-central/source/content/html/content/src/HTMLInputElement.cpp?mark=1547#1529. This would keep @autocomplete and getAutocompleteInfo consistent.
Rather than returning a blank string, could we return null? smaug, what do you think?
Flags: needinfo?(bnicholson) → needinfo?(bugs)
Comment 3•11 years ago
|
||
The spec doesn't let us return null.
1. If the element has no autocomplete attribute, then jump to the step labeled default.
...
25. Default: Let the element's IDL-exposed autofill value be the empty string, and its autofill hint set and autofill scope be empty.
And the interface has
attribute DOMString autocomplete;
not
attribute DOMString? autocomplete;
Flags: needinfo?(bugs)
Reporter | ||
Comment 4•11 years ago
|
||
Thanks. So how about this:
* For @autocomplete, return an empty string as suggested in comment 1.
* For getAutocompleteInfo() (a ChromeOnly helper function), return null.
Comment 5•11 years ago
|
||
ChromeOnly stuff can return null. Just document it clearly in the interface.
Assignee | ||
Comment 6•11 years ago
|
||
This patch implements the changes as per comment 4. I'm following the specs for @type=hidden [1] but it looks like they are not in agreement with our tests [2].
I'm not sure what's the process here, should we change the module to DOM: Core & HTML?
Olli do you want to review this?
Thanks!
[1]: http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#hidden-state-%28type=hidden%29
[2]: https://tbpl.mozilla.org/?tree=Try&rev=1d6ee00f0199
Attachment #8481997 -
Flags: review?(bugs)
Comment 7•11 years ago
|
||
Ugh the spec is pretty much unreadable :(
Comment 8•11 years ago
|
||
Comment on attachment 8481997 [details] [diff] [review]
Filter out non-autocomplete-enabled types for <input>
Sounds like we need to fix some tests then.
But please check what other browsers do with type="hidden"
Attachment #8481997 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 9•11 years ago
|
||
WebKit/Chrome doesn't hide the value of @autocomplete for any @type, but does block @type="hidden" input controls from being autocompleted with rAc
Assignee | ||
Comment 10•11 years ago
|
||
OK I removed the test for @type="hidden" that was failing.
Matt, is there a reason why you included "hidden" among autocompletable controls? Are you ok with removing it? Thanks!
Attachment #8481997 -
Attachment is obsolete: true
Flags: needinfo?(MattN+bmo)
Assignee | ||
Comment 11•11 years ago
|
||
Oh well. The spec changed a few days ago and now type="hidden" is allowed among controls that admits a @autocomplete attribute. Since allowing @autocomplete on type="hidden" is what we were doing before, I guess it makes sense to not change this behavior.
Olli, this patch is essentially the one you reviewed in Comment 8, except that now type="hidden" is autocompletable (hence we don't need to change tests). Asking for review just to be sure this is what we want to check-in. Thanks!
Try: https://tbpl.mozilla.org/?tree=Try&rev=66ac5b2a3c28
(note to sheriffs: the failure in Android 4.0 rc1 is not caused by my patch, e.g. https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=de47d4022beb )
Attachment #8482399 -
Attachment is obsolete: true
Attachment #8489798 -
Flags: review?(bugs)
Flags: needinfo?(MattN+bmo)
Updated•11 years ago
|
Attachment #8489798 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 12•11 years ago
|
||
Thanks!
Assignee: nobody → agi.novanta
Status: NEW → ASSIGNED
Flags: in-testsuite+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 13•11 years ago
|
||
Keywords: checkin-needed
Comment 14•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in
before you can comment on or make changes to this bug.
Description
•