Closed Bug 1360374 Opened 7 years ago Closed 7 years ago

Apply the field prediction heuristics for the elements added after DOMContentLoaded

Categories

(Toolkit :: Form Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: selee, Assigned: selee)

References

Details

(Whiteboard: [form autofill:M3])

Attachments

(1 file)

Since it's a common case that website inserts elements after the page loaded, the prediction heuristics should apply to these new added elements to make sure all interesting element support Form Autofill feature.
Whiteboard: [form autofill:M2] → [form autofill:M3]
Blocks: 1361560
We discussed replacing the DOMContentLoaded listener with a "focusin" listener to delay any work as long as possible and avoid a talos regression in tp5. This will block enabling the feature by default on Nightly since due to Talos.
No longer blocks: 1361560
Blocks: 1349490
Comment on attachment 8864413 [details]
Bug 1360374 - Identify FormAutofill fields when a field is focused on.;

https://reviewboard.mozilla.org/r/136102/#review139492

Thanks Sean! r=me assuming all formautofill tests pass.

::: browser/extensions/formautofill/FormAutofillContent.jsm:413
(Diff revision 2)
> +      if (this.getFormHandler(field)) {
> +        continue;
> +      }

Add a comment about what this is about since it's not the ideal situation since ideally we would want to handle dynamic additions and check that the actual "field", not "form" were already found. Example:

```
// For now skip consider fields in forms we've already seen before even if the specific field wasn't seen before.
// Ideally whether the field is already in the handler's form details would be considered.
```

Alternatively you could fix it to do the above.

::: browser/extensions/formautofill/content/FormAutofillFrameScript.js:40
(Diff revision 2)
>      switch (evt.type) {
> -      case "DOMContentLoaded": {
> -        let doc = evt.target;
> +      case "focusin": {
> +        let element = evt.target;

Can you ensure this code is covered by mochitests by commenting out the addEventListener and ensuring tests fails? If not, please add one.
Attachment #8864413 - Flags: review?(MattN+bmo) → review+
Comment on attachment 8864413 [details]
Bug 1360374 - Identify FormAutofill fields when a field is focused on.;

https://reviewboard.mozilla.org/r/136102/#review139492

> Add a comment about what this is about since it's not the ideal situation since ideally we would want to handle dynamic additions and check that the actual "field", not "form" were already found. Example:
> 
> ```
> // For now skip consider fields in forms we've already seen before even if the specific field wasn't seen before.
> // Ideally whether the field is already in the handler's form details would be considered.
> ```
> 
> Alternatively you could fix it to do the above.

Thanks for the comments. I will be back here to improve it with more tests for single field change.

> Can you ensure this code is covered by mochitests by commenting out the addEventListener and ensuring tests fails? If not, please add one.

The mochitest fails after removing addEventListener("focusin", this); in FormAutofillFrameScript.
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/03c0ea04be4e
Identify FormAutofill fields when a field is focused on.; r=MattN
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/03c0ea04be4e
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Blocks: 1360370
No longer depends on: 1360370
Flags: qe-verify-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: