Bug 1350243 - Combine e10s and non-e10s code paths when reacting to datalist updates. r=MattN
authorMike Conley <mconley@mozilla.com>
Thu, 06 Apr 2017 16:39:08 -0400
changeset 559077 107ccefe10d2fc60de12f53d9a327608ca8413bf
parent 559076 e70b8e5ed92505bbed32cca763e5f92a23ae8c14
child 559078 7310b4caed29db887a55820c11a04e29000ba232
push id53003
push userdgottwald@mozilla.com
push dateSat, 08 Apr 2017 22:00:51 +0000
reviewersMattN
bugs1350243
milestone55.0a1
Bug 1350243 - Combine e10s and non-e10s code paths when reacting to datalist updates. r=MattN MozReview-Commit-ID: 1O3wAzzwWAR
toolkit/components/satchel/nsFormFillController.cpp
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -822,70 +822,28 @@ nsFormFillController::PerformInputListAu
         mListNode = node;
       }
     }
   }
 
   return NS_OK;
 }
 
-class UpdateSearchResultRunnable : public mozilla::Runnable
-{
-public:
-  UpdateSearchResultRunnable(nsIAutoCompleteObserver* aObserver,
-                             nsIAutoCompleteSearch* aSearch,
-                             nsIAutoCompleteResult* aResult)
-    : mObserver(aObserver)
-    , mSearch(aSearch)
-    , mResult(aResult)
-  {
-    MOZ_ASSERT(mResult, "Should have a valid result");
-    MOZ_ASSERT(mObserver, "You shouldn't call this runnable with a null observer!");
-  }
-
-  NS_IMETHOD Run() override {
-    mObserver->OnUpdateSearchResult(mSearch, mResult);
-    return NS_OK;
-  }
-
-private:
-  nsCOMPtr<nsIAutoCompleteObserver> mObserver;
-  nsCOMPtr<nsIAutoCompleteSearch> mSearch;
-  nsCOMPtr<nsIAutoCompleteResult> mResult;
-};
-
 void nsFormFillController::RevalidateDataList()
 {
   if (!mLastListener) {
     return;
   }
 
-  if (XRE_IsContentProcess()) {
-    nsCOMPtr<nsIAutoCompleteController> controller(do_QueryInterface(mLastListener));
-    if (!controller) {
-      return;
-    }
-
-    controller->StartSearch(mLastSearchString);
+  nsCOMPtr<nsIAutoCompleteController> controller(do_QueryInterface(mLastListener));
+  if (!controller) {
     return;
   }
 
-  nsresult rv;
-  nsCOMPtr <nsIInputListAutoComplete> inputListAutoComplete =
-    do_GetService("@mozilla.org/satchel/inputlist-autocomplete;1", &rv);
-
-  nsCOMPtr<nsIAutoCompleteResult> result;
-
-  rv = inputListAutoComplete->AutoCompleteSearch(mLastSearchString,
-                                                 mFocusedInput,
-                                                 getter_AddRefs(result));
-
-  nsCOMPtr<nsIRunnable> event =
-    new UpdateSearchResultRunnable(mLastListener, this, result);
-  NS_DispatchToCurrentThread(event);
+  controller->StartSearch(mLastSearchString);
 }
 
 NS_IMETHODIMP
 nsFormFillController::StopSearch()
 {
   // Make sure to stop and clear this, otherwise the controller will prevent
   // mLastFormAutoComplete from being deleted.
   if (mLastFormAutoComplete) {