Bug 1338482 - Part 3: Add initial state for field details. r?MattN
MozReview-Commit-ID: 9JFPan3qIox
--- a/browser/extensions/formautofill/FormAutofillHandler.jsm
+++ b/browser/extensions/formautofill/FormAutofillHandler.jsm
@@ -80,35 +80,29 @@ FormAutofillHandler.prototype = {
f.addressType == info.addressType &&
f.contactType == info.contactType &&
f.fieldName == info.fieldName)) {
// A field with the same identifier already exists.
log.debug("Not collecting a field matching another with the same info:", info);
return null;
}
- let inputFormat = {
+ let formatWithElement = {
section: info.section,
addressType: info.addressType,
contactType: info.contactType,
fieldName: info.fieldName,
+ state: null,
+ element,
};
- // Clone the inputFormat for caching the fields and elements together
- let formatWithElement = Object.assign({}, inputFormat);
- inputFormat.index = autofillData.length;
- autofillData.push(inputFormat);
-
- formatWithElement.element = element;
this.fieldDetails.push(formatWithElement);
}
- log.debug("Collected details on", autofillData.length, "fields");
-
- return autofillData;
+ log.debug("Collected details on", this.fieldDetails.length, "fields");
},
/**
* Processes form fields that can be autofilled, and populates them with the
* data provided by backend.
*
* @param {Array<Object>} autofillResult
* Data returned by the user interface.