Bug 1382548 - [Form Autofill] Avoid sending element references in messages. r=ralin draft
authorLuke Chang <lchang@mozilla.com>
Wed, 30 Aug 2017 13:23:30 +0800
changeset 655540 4247062e16cad7ea7cc404f05e6b668403c2899f
parent 655385 db7f19e26e571ae1dd309f5d2f387b06ba670c30
child 728866 3a3a9f2edca1bc057cc64fe86c873caa2bd0ad36
push id76909
push userbmo:lchang@mozilla.com
push dateWed, 30 Aug 2017 05:25:41 +0000
reviewersralin
bugs1382548
milestone57.0a1
Bug 1382548 - [Form Autofill] Avoid sending element references in messages. r=ralin MozReview-Commit-ID: F6EXJl9dl8s
browser/extensions/formautofill/FormAutofillContent.jsm
--- a/browser/extensions/formautofill/FormAutofillContent.jsm
+++ b/browser/extensions/formautofill/FormAutofillContent.jsm
@@ -121,19 +121,26 @@ AutofillProfileAutoCompleteSearch.protot
         onSearchResult: (search, result) => {
           listener.onSearchResult(this, result);
           ProfileAutocomplete.setProfileAutoCompleteResult(result);
         },
       });
       return;
     }
 
-    let collectionName = isAddressField ? ADDRESSES_COLLECTION_NAME : CREDITCARDS_COLLECTION_NAME;
+    let infoWithoutElement = Object.assign({}, info);
+    delete infoWithoutElement.elementWeakRef;
 
-    this._getRecords({collectionName, info, searchString}).then((records) => {
+    let data = {
+      collectionName: isAddressField ? ADDRESSES_COLLECTION_NAME : CREDITCARDS_COLLECTION_NAME,
+      info: infoWithoutElement,
+      searchString,
+    };
+
+    this._getRecords(data).then((records) => {
       if (this.forceStop) {
         return;
       }
       // Sort addresses by timeLastUsed for showing the lastest used address at top.
       records.sort((a, b) => b.timeLastUsed - a.timeLastUsed);
 
       let adaptedRecords = handler.getAdaptedProfiles(records);
       let result = null;