Bug 1088660 - Improve the search bar UI to support one-off searches - fix tests that failed on fx-team, r=felipe over email, a=lmandel.
authorFlorian Quèze <florian@queze.net>
Thu, 27 Nov 2014 17:15:05 +0100
changeset 234081 b97e451b0e6763cfd4a49309b021bde65dff7868
parent 234080 3c2c29abfa354cc119cd664e53d88ee4d149c8d9
child 234082 21754ccc7751baa7c1d08268c5faae45f2379109
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersfelipe, lmandel
bugs1088660
milestone35.0a2
Bug 1088660 - Improve the search bar UI to support one-off searches - fix tests that failed on fx-team, r=felipe over email, a=lmandel.
browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
toolkit/components/search/SearchSuggestionController.jsm
--- a/browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
+++ b/browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
@@ -96,16 +96,17 @@ add_task(function*() {
   ok(isPanelUIOpen(), "Panel should still be open");
 
   let hiddenPanelPromise = promisePanelHidden(window);
   EventUtils.synthesizeKey("VK_ESCAPE", {});
   yield hiddenPanelPromise;
   ok(!isPanelUIOpen(), "Panel should no longer be open");
 
   Services.prefs.setBoolPref("browser.search.suggest.enabled", suggestEnabled);
+  CustomizableUI.reset();
 });
 
 add_task(function*() {
   button = document.createElement("toolbarbutton");
   button.id = "browser_946166_button_disabled";
   button.setAttribute("disabled", "true");
   button.setAttribute("label", "Button");
   PanelUI.contents.appendChild(button);
--- a/toolkit/components/search/SearchSuggestionController.jsm
+++ b/toolkit/components/search/SearchSuggestionController.jsm
@@ -313,17 +313,23 @@ this.SearchSuggestionController.prototyp
     }
   },
 
   /**
    * @param {Array} suggestResults - an array of result objects from different sources (local or remote)
    * @return {Object}
    */
   _dedupeAndReturnResults: function(suggestResults) {
-    NS_ASSERT(this._searchString !== null, "this._searchString shouldn't be null when returning results");
+    if (this._searchString === null) {
+      // _searchString can be null if stop() was called and remote suggestions
+      // were disabled (stopping if we are fetching remote suggestions will
+      // cause a promise rejection before we reach _dedupeAndReturnResults).
+      return null;
+    }
+
     let results = {
       term: this._searchString,
       remote: [],
       local: [],
       formHistoryResult: null,
     };
 
     for (let result of suggestResults) {