Bug 1531443 - Clear the `lastProfileAutoCompleteResult` during a form history fallback search. r=jaws
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Mon, 04 Mar 2019 19:22:00 +0000
changeset 520142 7cc86fd0d3865f54f91a92e01b21a62aa0125d8b
parent 520141 e544d9948446156682f0ae8870308fdde72916ea
child 520143 e0828fccefb530fa25fdc473db6ac42cb6662e77
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1531443
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1531443 - Clear the `lastProfileAutoCompleteResult` during a form history fallback search. r=jaws 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() {