Bug 704521 - Fix form history autocomplete broken for XUL elements. r=zpao
authorMounir Lamouri <mounir.lamouri@gmail.com>
Sun, 04 Dec 2011 20:59:47 +0800
changeset 83028 5e8a7c9d5f1df24ac1c4b41bb449ba1197bd64b1
parent 83027 2a15404c1d7106718fa74d8c7605eb8946336d79
child 83029 3d2eac7dcf6693d3763edc0599feab7027dbf72c
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszpao
bugs704521
milestone11.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 704521 - Fix form history autocomplete broken for XUL elements. r=zpao
toolkit/components/satchel/nsFormFillController.cpp
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -570,17 +570,19 @@ nsFormFillController::StartSearch(const 
     // satchel manage the field?
     rv = mLoginManager->AutoCompleteSearch(aSearchString,
                                          aPreviousResult,
                                          mFocusedInput,
                                          getter_AddRefs(result));
   } else {
     nsCOMPtr<nsIAutoCompleteResult> formHistoryResult;
 
-    if (mFocusedInput && nsContentUtils::IsAutocompleteEnabled(mFocusedInput)) {
+    // It appears that mFocusedInput is always null when we are focusing a XUL
+    // element. Scary :)
+    if (!mFocusedInput || nsContentUtils::IsAutocompleteEnabled(mFocusedInput)) {
       nsCOMPtr <nsIFormAutoComplete> formAutoComplete =
         do_GetService("@mozilla.org/satchel/form-autocomplete;1", &rv);
       NS_ENSURE_SUCCESS(rv, rv);
 
       rv = formAutoComplete->AutoCompleteSearch(aSearchParam,
                                                 aSearchString,
                                                 mFocusedInput,
                                                 aPreviousResult,