summaryrefslogtreecommitdiffstats
path: root/toolkit/components/autocomplete/nsAutoCompleteController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/autocomplete/nsAutoCompleteController.cpp')
-rw-r--r--toolkit/components/autocomplete/nsAutoCompleteController.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/toolkit/components/autocomplete/nsAutoCompleteController.cpp b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
index dc9754997b..a10f4ee62f 100644
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -499,17 +499,24 @@ nsAutoCompleteController::HandleKeyNavigation(uint32_t aKey, bool* _retval) {
}
}
- nsAutoString oldSearchString;
- uint16_t oldResult = 0;
-
// Open the popup if there has been a previous non-errored search, or
// else kick off a new search
- if (!mResults.IsEmpty() &&
- NS_SUCCEEDED(mResults[0]->GetSearchResult(&oldResult)) &&
- oldResult != nsIAutoCompleteResult::RESULT_FAILURE &&
- NS_SUCCEEDED(mResults[0]->GetSearchString(oldSearchString)) &&
- oldSearchString.Equals(mSearchString,
- nsCaseInsensitiveStringComparator)) {
+ bool hadPreviousSearch = false;
+ for (uint32_t i = 0; i < mResults.Length(); ++i) {
+ nsAutoString oldSearchString;
+ uint16_t oldResult = 0;
+ nsIAutoCompleteResult* oldResultObject = mResults[i];
+ if (oldResultObject &&
+ NS_SUCCEEDED(oldResultObject->GetSearchResult(&oldResult)) &&
+ oldResult != nsIAutoCompleteResult::RESULT_FAILURE &&
+ NS_SUCCEEDED(oldResultObject->GetSearchString(oldSearchString)) &&
+ oldSearchString.Equals(mSearchString,
+ nsCaseInsensitiveStringComparator)) {
+ hadPreviousSearch = true;
+ break;
+ }
+ }
+ if (hadPreviousSearch) {
if (mMatchCount) {
OpenPopup();
}