Bug 1318203 - Follow-up, Void the search result whenever a login is confirmed, r=adw draft
authorTimothy Guan-tin Chien <timdream@gmail.com>
Tue, 06 Dec 2016 13:50:40 -1000
changeset 447704 e09eab141be7ddf98cf22fe8ded7cad8b11d2b99
parent 447644 8e5e72908a5729d8ac7b20deb6110e562ab5921e
child 539096 964d9736d499b3ae0ba191a860777a476bf0dd4a
push id38133
push userbmo:timdream@gmail.com
push dateWed, 07 Dec 2016 09:46:07 +0000
reviewersadw
bugs1318203
milestone53.0a1
Bug 1318203 - Follow-up, Void the search result whenever a login is confirmed, r=adw MozReview-Commit-ID: LQwZeHh1LyT
toolkit/components/autocomplete/nsAutoCompleteController.cpp
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -637,16 +637,19 @@ nsAutoCompleteController::HandleKeyNavig
             input->SelectTextRange(value.Length(), value.Length());
           }
         }
       }
 
       // Close the pop-up even if nothing was selected
       ClearSearchTimer();
       ClosePopup();
+
+      // Void the current results as the input has changed.
+      ClearResults();
     }
     // Update last-searched string to the current input, since the input may
     // have changed.  Without this, subsequent backspaces look like text
     // additions, not text deletions.
     nsAutoString value;
     input->GetTextValue(value);
     mSearchString = value;
   }
@@ -1551,16 +1554,19 @@ nsAutoCompleteController::EnterMatch(boo
     SetTextValue(input, value, nsIAutoCompleteInput::TEXTVALUE_REASON_ENTERMATCH);
     input->SelectTextRange(value.Length(), value.Length());
     mSearchString = value;
   }
 
   obsSvc->NotifyObservers(input, "autocomplete-did-enter-text", nullptr);
   ClosePopup();
 
+  // Void the current results as the input has changed.
+  ClearResults();
+
   bool cancel;
   input->OnTextEntered(aEvent, &cancel);
 
   return NS_OK;
 }
 
 nsresult
 nsAutoCompleteController::RevertTextValue()