Bug 1075549 - Firefox needs a restart in order to update the default search engine from the "<term> - Search with <engine>" string. r=mak
authorBlair McBride <bmcbride@mozilla.com>
Mon, 06 Oct 2014 23:40:11 +1300
changeset 232257 49c1e23101a26df1b40686de2a81c8388380a594
parent 232157 02543de24c5ce899a6dc6159498f87570d7b4efc
child 232258 09e85c63110c32b2dfc9e92e64b9128715293bc6
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1075549
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1075549 - Firefox needs a restart in order to update the default search engine from the "<term> - Search with <engine>" string. r=mak
toolkit/components/places/PlacesSearchAutocompleteProvider.jsm
toolkit/components/places/tests/unifiedcomplete/test_searchEngine_current.js
--- a/toolkit/components/places/PlacesSearchAutocompleteProvider.jsm
+++ b/toolkit/components/places/PlacesSearchAutocompleteProvider.jsm
@@ -59,16 +59,17 @@ const SearchAutocompleteProviderInternal
 
   initialized: false,
 
   observe: function (subject, topic, data) {
     switch (data) {
       case "engine-added":
       case "engine-changed":
       case "engine-removed":
+      case "engine-current":
         this._refresh();
     }
   },
 
   _refresh: function () {
     this.priorityMatches = [];
     this.aliasMatches = [];
     this.defaultMatch = null;
--- a/toolkit/components/places/tests/unifiedcomplete/test_searchEngine_current.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_searchEngine_current.js
@@ -26,10 +26,22 @@ add_task(function*() {
 
   do_log_info("search engine, multiple words");
   yield check_autocomplete({
     search: "mozzarella cheese",
     searchParam: "enable-actions",
     matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozzarella cheese", searchQuery: "mozzarella cheese"}), title: "MozSearch" }, ]
   });
 
+  do_log_info("search engine, after current engine has changed");
+  Services.search.addEngineWithDetails("MozSearch2", "", "", "", "GET",
+                                       "http://s.example.com/search2");
+  engine = Services.search.getEngineByName("MozSearch2");
+  notEqual(Services.search.currentEngine, engine, "New engine shouldn't be the current engine yet");
+  Services.search.currentEngine = engine;
+  yield check_autocomplete({
+    search: "mozilla",
+    searchParam: "enable-actions",
+    matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch2", input: "mozilla", searchQuery: "mozilla"}), title: "MozSearch2" }, ]
+  });
+
   yield cleanup();
 });
\ No newline at end of file