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 81987 5e8a7c9d5f1df24ac1c4b41bb449ba1197bd64b1
parent 81986 2a15404c1d7106718fa74d8c7605eb8946336d79
child 81988 3d2eac7dcf6693d3763edc0599feab7027dbf72c
push idunknown
push userunknown
push dateunknown
reviewerszpao
bugs704521
milestone11.0a1
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,