diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:11:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:11:26 +0000 |
commit | fcea19dfd2c426bac0456da850e7c12258e4b9eb (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /toolkit/components/autocomplete | |
parent | Adding upstream version 115.7.0esr. (diff) | |
download | firefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.tar.xz firefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.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')
-rw-r--r-- | toolkit/components/autocomplete/nsAutoCompleteController.cpp | 25 |
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(); } |