Bug 1382548 - [Form Autofill] Avoid sending element references in messages. r=ralin, a=lizzard
authorLuke Chang <lchang@mozilla.com>
Wed, 30 Aug 2017 13:23:30 +0800
changeset 424091 577b2db694a7812dd737c4e18283119c53277630
parent 424090 b0f08e34f67d602245dae02dc534bf9aee2ba7fd
child 424092 6bc1744c12eed8c652ca811053e8ce859c2c4a1c
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersralin, lizzard
bugs1382548
milestone56.0
Bug 1382548 - [Form Autofill] Avoid sending element references in messages. r=ralin, a=lizzard MozReview-Commit-ID: F6EXJl9dl8s
browser/extensions/formautofill/FormAutofillContent.jsm
--- a/browser/extensions/formautofill/FormAutofillContent.jsm
+++ b/browser/extensions/formautofill/FormAutofillContent.jsm
@@ -116,19 +116,26 @@ AutofillProfileAutoCompleteSearch.protot
         onSearchResult: (search, result) => {
           listener.onSearchResult(this, result);
           ProfileAutocomplete.setProfileAutoCompleteResult(result);
         },
       });
       return;
     }
 
-    let collectionName = isAddressField ? "addresses" : "creditCards";
+    let infoWithoutElement = Object.assign({}, info);
+    delete infoWithoutElement.elementWeakRef;
 
-    this._getRecords({collectionName, info, searchString}).then((records) => {
+    let data = {
+      collectionName: isAddressField ? "addresses" : "creditCards",
+      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;