Closed
Bug 1400112
Opened 6 years ago
Closed 6 years ago
[Form Autofill] Collect the form details again when any form change happens
Categories
(Toolkit :: Form Manager, defect, P3)
Toolkit
Form Manager
Tracking
()
RESOLVED
FIXED
mozilla58
Tracking | Status | |
---|---|---|
firefox58 | --- | fixed |
People
(Reporter: selee, Assigned: selee)
References
(Blocks 1 open bug)
Details
(Whiteboard: [form autofill:MVP])
Attachments
(1 file)
When the form is changed, `FormAutofillHandler.collectFormFields` should be invoked again to ensure all fields are with the latest update. The issue has affected BestBuy and WooCommerce[1]. Since FormAutofillHandler.form will not be changed with a new change of a form, `FormLike` for `FormAutofillHandler.form` should be updated to ensure the correctness. [1] https://bluestarcoffeeroasters.com/
Updated•6 years ago
|
Priority: -- → P3
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 4•6 years ago
|
||
mozreview-review |
Comment on attachment 8909077 [details] Bug 1400112 - Refresh `FormAutofillHandler.form` when the related form is changed. https://reviewboard.mozilla.org/r/180674/#review185820 ::: browser/extensions/formautofill/FormAutofillHandler.jsm:41 (Diff revision 3) > */ > fieldDetails: [], > /** > * String of the filled address' guid. > */ > filledRecordGUID: null, Do you think `filledRecordGUID` should be clear as well in `updateForm` function? For a new element added case, I think it should be kept. For a brandnew form case, I think it should be cleared. ::: browser/extensions/formautofill/FormAutofillHandler.jsm:137 (Diff revision 3) > + } > + > + if (!Array.from(this.form.elements).find(e => e === element)) { > + log.debug("The element can not be found in the current form."); > + return true; > + } Probably we need to check `deadObject` here.
Assignee | ||
Comment 5•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8909077 [details] Bug 1400112 - Refresh `FormAutofillHandler.form` when the related form is changed. https://reviewboard.mozilla.org/r/180674/#review185820 > Do you think `filledRecordGUID` should be clear as well in `updateForm` function? > > For a new element added case, I think it should be kept. > For a brandnew form case, I think it should be cleared. Currently, I am not sure how to distinguish the two cases in an accurate and efficient way.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 8•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=2fde1cb1a3e827e64f469b70fda4e30c1e770bca
Assignee | ||
Updated•6 years ago
|
Whiteboard: [form autofill:MVP]
Comment 9•6 years ago
|
||
mozreview-review |
Comment on attachment 8909077 [details] Bug 1400112 - Refresh `FormAutofillHandler.form` when the related form is changed. https://reviewboard.mozilla.org/r/180674/#review185858 ::: browser/extensions/formautofill/FormAutofillHandler.jsm:129 (Diff revision 5) > + if (element.form.elements.length != this.form.elements.length) { > + log.debug("The count of form elements is changed."); > + return true; > + } What if there's no `element.form`? ::: browser/extensions/formautofill/FormAutofillHandler.jsm:134 (Diff revision 5) > + if (!Array.from(this.form.elements).find(e => e === element)) { > + log.debug("The element can not be found in the current form."); > + return true; > + } nit: `this.form.elements.indexOf(element) === -1` should work here. (`this.form.elements` should be an array already.) ::: browser/extensions/formautofill/FormAutofillHandler.jsm:150 (Diff revision 5) > + this.winUtils = this.form.rootElement.ownerGlobal.QueryInterface(Ci.nsIInterfaceRequestor) > + .getInterface(Ci.nsIDOMWindowUtils); `nsIDOMWindowUtils` seems not related to elements nor form. I don't think it needs to be updated.
Attachment #8909077 -
Flags: review?(lchang)
Comment 10•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8909077 [details] Bug 1400112 - Refresh `FormAutofillHandler.form` when the related form is changed. https://reviewboard.mozilla.org/r/180674/#review185820 > Currently, I am not sure how to distinguish the two cases in an accurate and efficient way. I personally prefer to keep it for now if we can't tell the difference between two cases. BTW, we might need to clear the highlight states as well if we're going to reset `filledRecordGUID` in the end.
Comment hidden (mozreview-request) |
Assignee | ||
Comment 12•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8909077 [details] Bug 1400112 - Refresh `FormAutofillHandler.form` when the related form is changed. https://reviewboard.mozilla.org/r/180674/#review185858 > What if there's no `element.form`? Thanks for addressing this. I've fixed it with `FormLikeFactory.createFromField` and added the related test to verify `rootElement == <body>` case.
Comment 13•6 years ago
|
||
mozreview-review |
Comment on attachment 8909077 [details] Bug 1400112 - Refresh `FormAutofillHandler.form` when the related form is changed. https://reviewboard.mozilla.org/r/180674/#review185942 ::: browser/extensions/formautofill/FormAutofillContent.jsm:496 (Diff revision 6) > - } else if (!formHandler.isFormChangedSinceLastCollection) { > + } else if (formHandler.isFormUpdateNeeded(element)) { > + this.log.debug("form update is needed!!!"); > + formHandler.updateForm(FormLikeFactory.createFromField(element)); Looks like `FormLike` will be created twice. Can we avoid that? I can think of two ways: 1. Create it ouside `isFormUpdateNeeded` and then pass it into the function along with `element` itself. 2. Invoke `updateForm` inside `isFormUpdateNeeded` (and maybe change the function name accordingly) if there isn't a chance that we want to know the needed status but don't want to update it. If we do, a second parameter can also work though. What do you think?
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 17•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8909077 [details] Bug 1400112 - Refresh `FormAutofillHandler.form` when the related form is changed. https://reviewboard.mozilla.org/r/180674/#review185942 > Looks like `FormLike` will be created twice. Can we avoid that? I can think of two ways: > > 1. Create it ouside `isFormUpdateNeeded` and then pass it into the function along with `element` itself. > 2. Invoke `updateForm` inside `isFormUpdateNeeded` (and maybe change the function name accordingly) if there isn't a chance that we want to know the needed status but don't want to update it. If we do, a second parameter can also work though. > > What do you think? The latest patch renames `isFormUpdateNeeded` to `updateFormIfNeeded` and modified its behavior.
Assignee | ||
Comment 18•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=252bbfa18ece2146246dca5e6f152dffa9818e2e
Comment 19•6 years ago
|
||
mozreview-review |
Comment on attachment 8909077 [details] Bug 1400112 - Refresh `FormAutofillHandler.form` when the related form is changed. https://reviewboard.mozilla.org/r/180674/#review186440 Thanks.
Attachment #8909077 -
Flags: review?(lchang) → review+
Comment 20•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8909077 [details] Bug 1400112 - Refresh `FormAutofillHandler.form` when the related form is changed. https://reviewboard.mozilla.org/r/180674/#review185820 > Probably we need to check `deadObject` here. Checking `deadObject` seems expensive. In order not to block this bug, I think we can discuss a proper solution in a separate bug.
Assignee | ||
Comment 21•6 years ago
|
||
Hey MattN, could you take a look this patch and review it? Thank you.
Flags: needinfo?(MattN+bmo)
Comment hidden (mozreview-request) |
Assignee | ||
Comment 23•6 years ago
|
||
Pushed a try for the latest rebased patch: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6fe7ccd7af0db175db0a9b0bc45c7b14f15c088c
Comment 24•6 years ago
|
||
mozreview-review |
Comment on attachment 8909077 [details] Bug 1400112 - Refresh `FormAutofillHandler.form` when the related form is changed. https://reviewboard.mozilla.org/r/180674/#review197908
Attachment #8909077 -
Flags: review?(MattN+bmo) → review+
Assignee | ||
Comment 25•6 years ago
|
||
Thank MattN and Luke for the review!
Flags: needinfo?(MattN+bmo)
Keywords: checkin-needed
Comment 26•6 years ago
|
||
Autoland can't push this until all pending issues in MozReview are marked as resolved.
Flags: needinfo?(selee)
Keywords: checkin-needed
Comment 28•6 years ago
|
||
Pushed by lchang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/61eb9c2d2319 Refresh `FormAutofillHandler.form` when the related form is changed. r=lchang,MattN
Keywords: checkin-needed
Comment 29•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/61eb9c2d2319
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox58:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in
before you can comment on or make changes to this bug.
Description
•