Bug 1410821 - Call startSearch again when the new search string could not hit the cached result. r=mak draft
authorRay Lin <ralin@mozilla.com>
Fri, 03 Nov 2017 15:22:45 +0800
changeset 693390 d003f41b026ed8a1d3da8f213e5321668025913a
parent 692325 b2f459b88cab5525c785a7fa70a01be3e9cdcb23
child 739011 2d53ae5df69f5c1da0b3c0d59a4df2aef9fb8dbf
push id87779
push userbmo:ralin@mozilla.com
push dateMon, 06 Nov 2017 03:06:41 +0000
reviewersmak
bugs1410821
milestone58.0a1
Bug 1410821 - Call startSearch again when the new search string could not hit the cached result. r=mak MozReview-Commit-ID: 1AJutt4IA0E
toolkit/components/autocomplete/nsAutoCompleteController.cpp
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -557,18 +557,21 @@ nsAutoCompleteController::HandleKeyNavig
         input->GetTextValue(text);
         input->GetSelectionStart(&start);
         input->GetSelectionEnd(&end);
         if (start != end || end < (int32_t)text.Length())
           *_retval = false;
       }
 #endif
       if (*_retval) {
+        nsAutoString oldSearchString;
         // Open the popup if there has been a previous search, or else kick off a new search
-        if (!mResults.IsEmpty()) {
+        if (!mResults.IsEmpty() &&
+            NS_SUCCEEDED(mResults[0]->GetSearchString(oldSearchString)) &&
+            oldSearchString.Equals(mSearchString, nsCaseInsensitiveStringComparator())) {
           if (mRowCount) {
             OpenPopup();
           }
         } else {
           // Stop all searches in case they are async.
           StopSearch();
 
           if (!mInput) {