Bug 1338482 - Part 3: Add initial state for field details. r?MattN draft
authorsteveck-chung <schung@mozilla.com>
Mon, 27 Feb 2017 12:16:14 +0800
changeset 489902 a96d1dcb7a2f2698dc700e07aa1bb53f19108fbf
parent 489085 219d0d1d0c55d233e2cac8c536bdb683c08d7e31
child 547111 cb8dc937f73edc84258fc00c3b62b0c7aa3088da
push id46938
push userbmo:schung@mozilla.com
push dateMon, 27 Feb 2017 04:21:29 +0000
reviewersMattN
bugs1338482
milestone54.0a1
Bug 1338482 - Part 3: Add initial state for field details. r?MattN MozReview-Commit-ID: 9JFPan3qIox
browser/extensions/formautofill/FormAutofillHandler.jsm
--- 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.