summaryrefslogtreecommitdiffstats
path: root/toolkit/components/autocomplete/nsAutoCompleteController.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:26 +0000
commitfcea19dfd2c426bac0456da850e7c12258e4b9eb (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /toolkit/components/autocomplete/nsAutoCompleteController.cpp
parentAdding upstream version 115.7.0esr. (diff)
downloadfirefox-esr-upstream/115.8.0esr.tar.xz
firefox-esr-upstream/115.8.0esr.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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();
}