diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:11:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:11:27 +0000 |
commit | f3bcaf9f88aad2c423ebcd61121562f9834187d4 (patch) | |
tree | f22238c29b57707b645a350940e3e9bdf3ce1f5d /toolkit/components/autocomplete/nsAutoCompleteController.cpp | |
parent | Adding debian version 115.7.0esr-1~deb12u1. (diff) | |
download | firefox-esr-f3bcaf9f88aad2c423ebcd61121562f9834187d4.tar.xz firefox-esr-f3bcaf9f88aad2c423ebcd61121562f9834187d4.zip |
Merging upstream version 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.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(); } |