Bug 1531443 - Clear the `lastProfileAutoCompleteResult` during a form history fallback search. r=jaws a=lizzard
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 06 Mar 2019 12:33:26 -0800
changeset 516279 533b15ae2bde4c8d89723855a73248d9a84e7d51
parent 516278 666f0ce4c40f746e8623a540f73565b050865c94
child 516280 051a0830599b133e1d6b5eea37feefa2ad497c7a
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, lizzard
bugs1531443
milestone66.0
Bug 1531443 - Clear the `lastProfileAutoCompleteResult` during a form history fallback search. r=jaws a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D21587
browser/extensions/formautofill/FormAutofillContent.jsm
--- a/browser/extensions/formautofill/FormAutofillContent.jsm
+++ b/browser/extensions/formautofill/FormAutofillContent.jsm
@@ -1,13 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/*
+/**
  * Form Autofill content process module.
  */
 
 /* eslint-disable no-use-before-define */
 
 "use strict";
 
 var EXPORTED_SYMBOLS = ["FormAutofillContent"];
@@ -178,16 +178,20 @@ AutofillProfileAutoCompleteSearch.protot
       // Don't save cache results or reset state when returning non-autofill results such as the
       // form history fallback above.
       if (isFormAutofillSearch) {
         ProfileAutocomplete.lastProfileAutoCompleteResult = result;
         // Reset AutoCompleteController's state at the end of startSearch to ensure that
         // none of form autofill result will be cached in other places and make the
         // result out of sync.
         autocompleteController.resetInternalState();
+      } else {
+        // Clear the cache so that we don't try to autofill from it after falling
+        // back to form history.
+        ProfileAutocomplete.lastProfileAutoCompleteResult = null;
       }
     });
   },
 
   /**
    * Stops an asynchronous search that is in progress
    */
   stopSearch() {