Backed out changeset c35bab726b03 (bug 1493483) for multiple browser-chrome failures e.g browser_extension_controlled.js. CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Tue, 09 Oct 2018 23:26:24 +0300
changeset 496064 dd418f0ef29cf4082b1379211b601fcf950836da
parent 496063 5bdbf3c25285fb446af25ce28ec945b856a29bb4
child 496065 91e7bbcc957a87805acaf96fe699df741f6a20ce
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1493483
milestone64.0a1
backs outc35bab726b030312c53f48a654d5fcc2e1264ac2
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
Backed out changeset c35bab726b03 (bug 1493483) for multiple browser-chrome failures e.g browser_extension_controlled.js. CLOSED TREE
browser/base/content/browser.js
browser/base/content/nsContextMenu.js
browser/base/content/urlbarBindings.xml
browser/components/enterprisepolicies/Policies.jsm
browser/components/extensions/parent/ext-chrome-settings-overrides.js
browser/components/extensions/parent/ext-search.js
browser/components/newtab/lib/TopSitesFeed.jsm
browser/components/nsBrowserGlue.js
browser/components/preferences/in-content/search.js
browser/components/search/content/search.xml
browser/components/search/content/searchReset.js
browser/components/search/content/searchbar.js
browser/modules/ContentSearch.jsm
toolkit/components/places/PlacesSearchAutocompleteProvider.jsm
toolkit/components/search/nsSearchService.js
toolkit/components/search/nsSearchSuggestions.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3823,17 +3823,17 @@ const BrowserSearch = {
 
   delayedStartupInit() {
     // Asynchronously initialize the search service if necessary, to get the
     // current engine for working out the placeholder.
     Services.search.init(rv => {
       if (Components.isSuccessCode(rv)) {
         // Delay the update for this until so that we don't change it while
         // the user is looking at it / isn't expecting it.
-        this._updateURLBarPlaceholder(Services.search.defaultEngine, true);
+        this._updateURLBarPlaceholder(Services.search.currentEngine, true);
         this._searchInitComplete = true;
       }
     });
   },
 
   uninit() {
     Services.obs.removeObserver(this, "browser-search-engine-modified");
   },
@@ -4115,21 +4115,27 @@ const BrowserSearch = {
    *        A string meant to indicate the context of the search request. This
    *        allows the search service to provide a different nsISearchSubmission
    *        depending on e.g. where the search is triggered in the UI.
    *
    * @return engine The search engine used to perform a search, or null if no
    *                search was performed.
    */
   _loadSearch(searchText, useNewTab, purpose, triggeringPrincipal) {
+    let engine;
     if (!triggeringPrincipal) {
       throw new Error("Required argument triggeringPrincipal missing within _loadSearch");
     }
 
-    let engine = Services.search.defaultEngine;
+    // If the search bar is visible, use the current engine, otherwise, fall
+    // back to the default engine.
+    if (isElementVisible(this.searchBar))
+      engine = Services.search.currentEngine;
+    else
+      engine = Services.search.defaultEngine;
 
     let submission = engine.getSubmission(searchText, null, purpose); // HTML response
 
     // getSubmission can return null if the engine doesn't have a URL
     // with a text/html response type.  This is unlikely (since
     // SearchService._addEngineToStore() should fail for such an engine),
     // but let's be on the safe side.
     if (!submission) {
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -1501,17 +1501,17 @@ nsContextMenu.prototype = {
       let truncLength = 15;
       let truncChar = selectedText[15].charCodeAt(0);
       if (truncChar >= 0xDC00 && truncChar <= 0xDFFF)
         truncLength++;
       selectedText = selectedText.substr(0, truncLength) + this.ellipsis;
     }
 
     // format "Search <engine> for <selection>" string to show in menu
-    let engineName = Services.search.defaultEngine.name;
+    let engineName = Services.search.currentEngine.name;
     var menuLabel = gNavigatorBundle.getFormattedString("contextMenuSearch",
                                                         [engineName,
                                                          selectedText]);
     menuItem.label = menuLabel;
     menuItem.accessKey = gNavigatorBundle.getString("contextMenuSearch.accesskey");
   },
 
   createContainerMenu(aEvent) {
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -2470,17 +2470,17 @@ file, You can obtain one at http://mozil
               if (firstStyle.includes("autofill")) {
                 let uri = this.input.mController.getFinalCompleteValueAt(0);
                 this.maybeSetupSpeculativeConnect(uri);
               } else if (firstStyle.includes("searchengine") &&
                          this.input.browserSearchSuggestEnabled &&
                          this.input.urlbarSearchSuggestEnabled) {
                 // Preconnect to the current search engine only if the search
                 // suggestions are enabled.
-                let engine = Services.search.defaultEngine;
+                let engine = Services.search.currentEngine;
                 engine.speculativeConnect({window,
                                            originAttributes: gBrowser.contentPrincipal.originAttributes});
               }
             }
 
             // When a result is present the footer should always be visible.
             this.footer.collapsed = false;
             this.input.tabScrolling = true;
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -758,17 +758,17 @@ var Policies = {
               }
             } catch (ex) {
               log.error(`Search engine lookup failed when attempting to set ` +
                         `the default engine. Requested engine was ` +
                         `"${param.Default}".`, ex);
             }
             if (defaultEngine) {
               try {
-                Services.search.defaultEngine = defaultEngine;
+                Services.search.currentEngine = defaultEngine;
               } catch (ex) {
                 log.error("Unable to set the default search engine", ex);
               }
             }
           });
         }
       });
     },
--- a/browser/components/extensions/parent/ext-chrome-settings-overrides.js
+++ b/browser/components/extensions/parent/ext-chrome-settings-overrides.js
@@ -81,30 +81,30 @@ async function handleInitialHomepagePopu
 
 this.chrome_settings_overrides = class extends ExtensionAPI {
   static async processDefaultSearchSetting(action, id) {
     await ExtensionSettingsStore.initialize();
     let item = ExtensionSettingsStore.getSetting(DEFAULT_SEARCH_STORE_TYPE, DEFAULT_SEARCH_SETTING_NAME);
     if (!item) {
       return;
     }
-    if (Services.search.defaultEngine.name != item.value &&
-        Services.search.deafultEngine.name != item.initialValue) {
+    if (Services.search.currentEngine.name != item.value &&
+        Services.search.currentEngine.name != item.initialValue) {
       // The current engine is not the same as the value that the ExtensionSettingsStore has.
       // This means that the user changed the engine, so we shouldn't control it anymore.
       // Do nothing and remove our entry from the ExtensionSettingsStore.
       ExtensionSettingsStore.removeSetting(id, DEFAULT_SEARCH_STORE_TYPE, DEFAULT_SEARCH_SETTING_NAME);
       return;
     }
     item = ExtensionSettingsStore[action](id, DEFAULT_SEARCH_STORE_TYPE, DEFAULT_SEARCH_SETTING_NAME);
     if (item) {
       try {
         let engine = Services.search.getEngineByName(item.value || item.initialValue);
         if (engine) {
-          Services.search.defaultEngine = engine;
+          Services.search.currentEngine = engine;
         }
       } catch (e) {
         Cu.reportError(e);
       }
     }
   }
 
   static async removeEngine(id) {
@@ -212,27 +212,27 @@ this.chrome_settings_overrides = class e
           return;
         }
       }
       await this.addSearchEngine();
       if (searchProvider.is_default) {
         if (extension.startupReason === "ADDON_INSTALL") {
           // Don't ask if it already the current engine
           let engine = Services.search.getEngineByName(engineName);
-          if (Services.search.defaultEngine != engine) {
+          if (Services.search.currentEngine != engine) {
             let allow = await new Promise(resolve => {
               let subject = {
                 wrappedJSObject: {
                   // This is a hack because we don't have the browser of
                   // the actual install. This means the popup might show
                   // in a different window. Will be addressed in a followup bug.
                   browser: windowTracker.topWindow.gBrowser.selectedBrowser,
                   name: this.extension.name,
                   icon: this.extension.iconURL,
-                  currentEngine: Services.search.defaultEngine.name,
+                  currentEngine: Services.search.currentEngine.name,
                   newEngine: engineName,
                   resolve,
                 },
               };
               Services.obs.notifyObservers(subject, "webextension-defaultsearch-prompt");
             });
             if (!allow) {
               return;
@@ -251,50 +251,50 @@ this.chrome_settings_overrides = class e
     }
   }
 
   async setDefault(engineName) {
     let {extension} = this;
     if (extension.startupReason === "ADDON_INSTALL") {
       let item = await ExtensionSettingsStore.addSetting(
         extension.id, DEFAULT_SEARCH_STORE_TYPE, DEFAULT_SEARCH_SETTING_NAME, engineName, () => {
-          return Services.search.defaultEngine.name;
+          return Services.search.currentEngine.name;
         });
-      Services.search.defaultEngine = Services.search.getEngineByName(item.value);
+      Services.search.currentEngine = Services.search.getEngineByName(item.value);
     } else if (extension.startupReason === "ADDON_ENABLE") {
       chrome_settings_overrides.processDefaultSearchSetting("enable", extension.id);
     }
   }
 
   async addSearchEngine() {
     let {extension} = this;
     let isCurrent = false;
     let index = -1;
     if (extension.startupReason === "ADDON_UPGRADE") {
       let engines = Services.search.getEnginesByExtensionID(extension.id);
       if (engines.length > 0) {
         // There can be only one engine right now
-        isCurrent = Services.search.defaultEngine == engines[0];
+        isCurrent = Services.search.currentEngine == engines[0];
         // Get position of engine and store it
         index = Services.search.getEngines().indexOf(engines[0]);
         Services.search.removeEngine(engines[0]);
       }
     }
     try {
       Services.search.addEnginesFromExtension(extension);
       // Bug 1488516.  Preparing to support multiple engines per extension so
       // multiple locales can be loaded.
       let engines = Services.search.getEnginesByExtensionID(extension.id);
       await ExtensionSettingsStore.addSetting(
         extension.id, DEFAULT_SEARCH_STORE_TYPE, ENGINE_ADDED_SETTING_NAME,
         engines[0].name);
       if (extension.startupReason === "ADDON_UPGRADE") {
         let engine = Services.search.getEngineByName(engines[0].name);
         if (isCurrent) {
-          Services.search.defaultEngine = engine;
+          Services.search.currentEngine = engine;
         }
         if (index != -1) {
           Services.search.moveEngine(engine, index);
         }
       }
     } catch (e) {
       Cu.reportError(e);
       return false;
--- a/browser/components/extensions/parent/ext-search.js
+++ b/browser/components/extensions/parent/ext-search.js
@@ -48,33 +48,33 @@ this.search = class extends ExtensionAPI
                 favIconUrl = await getDataURI(engine.iconURI.spec);
               } else {
                 favIconUrl = engine.iconURI.spec;
               }
             }
 
             return {
               name: engine.name,
-              isDefault: engine === Services.search.defaultEngine,
+              isDefault: engine === Services.search.currentEngine,
               alias: engine.alias || undefined,
               favIconUrl,
             };
           }));
         },
 
         async search(searchProperties) {
           await searchInitialized;
           let engine;
           if (searchProperties.engine) {
             engine = Services.search.getEngineByName(searchProperties.engine);
             if (!engine) {
               throw new ExtensionError(`${searchProperties.engine} was not found`);
             }
           } else {
-            engine = Services.search.defaultEngine;
+            engine = Services.search.currentEngine;
           }
           let submission = engine.getSubmission(searchProperties.query, null, "webextension");
           let options = {
             postData: submission.postData,
             triggeringPrincipal: context.principal,
           };
           if (searchProperties.tabId === null) {
             let {gBrowser} = windowTracker.topWindow;
--- a/browser/components/newtab/lib/TopSitesFeed.jsm
+++ b/browser/components/newtab/lib/TopSitesFeed.jsm
@@ -48,17 +48,17 @@ const SEARCH_FILTERS = [
   "search.yahoo",
   "yahoo",
   "bing",
   "ask",
   "duckduckgo",
 ];
 
 function getShortURLForCurrentSearch() {
-  const url = shortURL({url: Services.search.defaultEngine.searchForm});
+  const url = shortURL({url: Services.search.currentEngine.searchForm});
   return url;
 }
 
 this.TopSitesFeed = class TopSitesFeed {
   constructor() {
     this._tippyTopProvider = new TippyTopProvider();
     XPCOMUtils.defineLazyGetter(this, "_currentSearchHostname", getShortURLForCurrentSearch);
     this.dedupe = new Dedupe(this._dedupeKey);
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -2312,17 +2312,17 @@ BrowserGlue.prototype = {
           if (data != "init-complete") {
             return;
           }
           Services.obs.removeObserver(observer, SEARCH_SERVICE_TOPIC);
           resolve();
         }, SEARCH_SERVICE_TOPIC);
       });
       searchInitializedPromise.then(() => {
-        let currentEngine = Services.search.defaultEngine.wrappedJSObject;
+        let currentEngine = Services.search.currentEngine.wrappedJSObject;
         // Only reset the current engine if it wasn't set by a WebExtension
         // and it is not one of the default engines.
         // If the original default is not a default, the user has a weird
         // configuration probably involving langpacks, it's not worth
         // attempting to reset their settings.
         if (currentEngine._extensionID || currentEngine._isDefault ||
             !Services.search.originalDefaultEngine.wrappedJSObject._isDefault)
           return;
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -144,17 +144,17 @@ var gSearchPane = {
       document.getElementById("urlBarSuggestionPermanentPBLabel");
     permanentPBLabel.hidden = urlbarSuggests.hidden || !permanentPB;
   },
 
   buildDefaultEngineDropDown() {
     // This is called each time something affects the list of engines.
     let list = document.getElementById("defaultEngine");
     // Set selection to the current default engine.
-    let currentEngine = Services.search.defaultEngine.name;
+    let currentEngine = Services.search.currentEngine.name;
 
     // If the current engine isn't in the list any more, select the first item.
     let engines = gEngineView._engineStore._engines;
     if (!engines.some(e => e.name == currentEngine))
       currentEngine = engines[0].name;
 
     // Now clean-up and rebuild the list.
     list.removeAllItems();
@@ -386,17 +386,17 @@ var gSearchPane = {
       if (!engine.shown)
         hiddenList.push(engine.name);
     }
     Preferences.get("browser.search.hiddenOneOffs").value =
       hiddenList.join(",");
   },
 
   setDefaultEngine() {
-    Services.search.defaultEngine =
+    Services.search.currentEngine =
       document.getElementById("defaultEngine").selectedItem.engine;
     ExtensionSettingsStore.setByUser(SEARCH_TYPE, SEARCH_KEY);
   },
 };
 
 function onDragEngineStart(event) {
   var selectedIndex = gEngineView.selectedIndex;
   var tree = document.getElementById("engineList");
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -474,17 +474,17 @@
 
       <field name="oneOffButtons" readonly="true">
         document.getAnonymousElementByAttribute(this, "anonid",
                                                 "search-one-off-buttons");
       </field>
 
       <method name="updateHeader">
         <body><![CDATA[
-          let currentEngine = Services.search.defaultEngine;
+          let currentEngine = Services.search.currentEngine;
           let uri = currentEngine.iconURI;
           if (uri) {
             this.setAttribute("src", uri.spec);
           } else {
             // If the default has just been changed to a provider without icon,
             // avoid showing the icon of the previous default provider.
             this.removeAttribute("src");
           }
@@ -930,17 +930,17 @@
 
       <field name="_engines">null</field>
       <property name="engines" readonly="true">
         <getter><![CDATA[
           if (this._engines)
             return this._engines;
           let currentEngineNameToIgnore;
           if (!this.getAttribute("includecurrentengine"))
-            currentEngineNameToIgnore = Services.search.defaultEngine.name;
+            currentEngineNameToIgnore = Services.search.currentEngine.name;
 
           let pref = Services.prefs.getStringPref("browser.search.hiddenOneOffs");
           let hiddenList = pref ? pref.split(",") : [];
 
           this._engines = Services.search.getVisibleEngines().filter(e => {
             let name = e.name;
             return (!currentEngineNameToIgnore ||
                     name != currentEngineNameToIgnore) &&
@@ -985,17 +985,17 @@
           // Remove the trailing empty text node introduced by the binding's
           // content markup above.
           if (this.settingsButtonCompact.nextElementSibling)
             this.settingsButtonCompact.nextElementSibling.remove();
 
           let engines = this.engines;
           let oneOffCount = engines.length;
           let collapsed = !oneOffCount ||
-                          (oneOffCount == 1 && engines[0].name == Services.search.defaultEngine.name);
+                          (oneOffCount == 1 && engines[0].name == Services.search.currentEngine.name);
 
           // header is a xul:deck so collapsed doesn't work on it, see bug 589569.
           this.header.hidden = this.buttons.collapsed = collapsed;
 
           if (collapsed)
             return;
 
           let panelWidth = parseInt(this.popup.clientWidth);
@@ -1796,46 +1796,46 @@
         let anonid = target.getAttribute("anonid");
         if (anonid == "search-one-offs-context-open-in-new-tab") {
           // Select the context-clicked button so that consumers can easily
           // tell which button was acted on.
           this.selectedButton = this._buttonForEngine(this._contextEngine);
           this.handleSearchCommand(event, this._contextEngine, true);
         }
         if (anonid == "search-one-offs-context-set-default") {
-          let currentEngine = Services.search.defaultEngine;
+          let currentEngine = Services.search.currentEngine;
 
           if (!this.getAttribute("includecurrentengine")) {
             // Make the target button of the context menu reflect the current
             // search engine first. Doing this as opposed to rebuilding all the
             // one-off buttons avoids flicker.
             let button = this._buttonForEngine(this._contextEngine);
             button.id = this._buttonIDForEngine(currentEngine);
             let uri = "chrome://browser/skin/search-engine-placeholder.png";
             if (currentEngine.iconURI)
               uri = currentEngine.iconURI.spec;
             button.setAttribute("image", uri);
             button.setAttribute("tooltiptext", currentEngine.name);
             button.engine = currentEngine;
           }
 
-          Services.search.defaultEngine = this._contextEngine;
+          Services.search.currentEngine = this._contextEngine;
         }
       ]]></handler>
 
       <handler event="contextmenu"><![CDATA[
         let target = event.originalTarget;
         // Prevent the context menu from appearing except on the one off buttons.
         if (!target.classList.contains("searchbar-engine-one-off-item") ||
             target.classList.contains("dummy")) {
           event.preventDefault();
           return;
         }
         document.getAnonymousElementByAttribute(this, "anonid", "search-one-offs-context-set-default")
-                .setAttribute("disabled", target.engine == Services.search.defaultEngine);
+                .setAttribute("disabled", target.engine == Services.search.currentEngine);
 
         this._contextEngine = target.engine;
       ]]></handler>
     </handlers>
 
   </binding>
 
 </bindings>
--- a/browser/components/search/content/searchReset.js
+++ b/browser/components/search/content/searchReset.js
@@ -36,17 +36,17 @@ function doSearch() {
     for (let param of params) {
       if (param.startsWith("data="))
         queryString = decodeURIComponent(param.slice(5));
       else if (param.startsWith("purpose="))
         purpose = param.slice(8);
     }
   }
 
-  let engine = Services.search.defaultEngine;
+  let engine = Services.search.currentEngine;
   let submission = engine.getSubmission(queryString, null, purpose);
 
   window.removeEventListener("unload", recordPageClosed);
 
   let win = window.docShell.rootTreeItem.domWindow;
   win.openTrustedLinkIn(submission.uri.spec, "current", {
     allowThirdPartyFixup: false,
     postData: submission.postData,
@@ -65,30 +65,30 @@ function savePref(value) {
     Services.prefs.setCharPref(statusPref, value);
 }
 
 function record(result) {
   Services.telemetry.getHistogramById("SEARCH_RESET_RESULT").add(result);
 }
 
 function keepCurrentEngine() {
-  // Calling the defaultEngine setter will force a correct loadPathHash to be
+  // Calling the currentEngine setter will force a correct loadPathHash to be
   // written for this engine, so that we don't prompt the user again.
   // eslint-disable-next-line no-self-assign
-  Services.search.defaultEngine = Services.search.defaultEngine;
+  Services.search.currentEngine = Services.search.currentEngine;
   record(TELEMETRY_RESULT_ENUM.KEPT_CURRENT);
   savePref("declined");
   doSearch();
 }
 
 function changeSearchEngine() {
   let engine = Services.search.originalDefaultEngine;
   if (engine.hidden)
     engine.hidden = false;
-  Services.search.defaultEngine = engine;
+  Services.search.currentEngine = engine;
 
   record(TELEMETRY_RESULT_ENUM.RESTORED_DEFAULT);
   savePref("accepted");
 
   doSearch();
 }
 
 function recordPageClosed() {
--- a/browser/components/search/content/searchbar.js
+++ b/browser/components/search/content/searchbar.js
@@ -153,22 +153,22 @@ class MozSearchbar extends MozXULElement
 
   get engines() {
     if (!this._engines)
       this._engines = Services.search.getVisibleEngines();
     return this._engines;
   }
 
   set currentEngine(val) {
-    Services.search.defaultEngine = val;
+    Services.search.currentEngine = val;
     return val;
   }
 
   get currentEngine() {
-    var currentEngine = Services.search.defaultEngine;
+    var currentEngine = Services.search.currentEngine;
     // Return a dummy engine if there is no currentEngine
     return currentEngine || { name: "", uri: null };
   }
   /**
    * textbox is used by sanitize.js to clear the undo history when
    * clearing form information.
    */
   get textbox() {
--- a/browser/modules/ContentSearch.jsm
+++ b/browser/modules/ContentSearch.jsm
@@ -329,17 +329,17 @@ var ContentSearch = {
   },
 
   async currentStateObj(uriFlag = false) {
     let state = {
       engines: [],
       currentEngine: await this._currentEngineObj(),
     };
     if (uriFlag) {
-      state.currentEngine.iconBuffer = Services.search.defaultEngine.getIconURLBySize(16, 16);
+      state.currentEngine.iconBuffer = Services.search.currentEngine.getIconURLBySize(16, 16);
     }
     let pref = Services.prefs.getCharPref("browser.search.hiddenOneOffs");
     let hiddenList = pref ? pref.split(",") : [];
     for (let engine of Services.search.getVisibleEngines()) {
       let uri = engine.getIconURLBySize(16, 16);
       let iconBuffer = uri;
       if (!uriFlag) {
         iconBuffer = await this._arrayBufferFromDataURI(uri);
@@ -415,17 +415,17 @@ var ContentSearch = {
     this._reply(msg, "Strings", this.searchSuggestionUIStrings);
   },
 
   _onMessageSearch(msg, data) {
     this.performSearch(msg, data);
   },
 
   _onMessageSetCurrentEngine(msg, data) {
-    Services.search.defaultEngine = Services.search.getEngineByName(data);
+    Services.search.currentEngine = Services.search.getEngineByName(data);
   },
 
   _onMessageManageEngines(msg) {
     msg.target.ownerGlobal.openPreferences("paneSearch", { origin: "contentSearch" });
   },
 
   async _onMessageGetSuggestions(msg, data) {
     this._ensureDataHasProperties(data, [
@@ -505,17 +505,17 @@ var ContentSearch = {
   _msgArgs(type, data) {
     return [OUTBOUND_MESSAGE, {
       type,
       data,
     }];
   },
 
   async _currentEngineObj() {
-    let engine = Services.search.defaultEngine;
+    let engine = Services.search.currentEngine;
     let favicon = engine.getIconURLBySize(16, 16);
     let placeholder = this._stringBundle.formatStringFromName(
       "searchWithEngine", [engine.name], 1);
     let obj = {
       name: engine.name,
       placeholder,
       iconBuffer: await this._arrayBufferFromDataURI(favicon),
     };
--- a/toolkit/components/places/PlacesSearchAutocompleteProvider.jsm
+++ b/toolkit/components/places/PlacesSearchAutocompleteProvider.jsm
@@ -67,17 +67,17 @@ const SearchAutocompleteProviderInternal
     }
   },
 
   _refresh() {
     this.priorityMatches = [];
     this.aliasMatches = [];
     this.defaultMatch = null;
 
-    let currentEngine = Services.search.defaultEngine;
+    let currentEngine = Services.search.currentEngine;
     // This can be null in XCPShell.
     if (currentEngine) {
       this.defaultMatch = {
         engineName: currentEngine.name,
         iconUrl: currentEngine.iconURI ? currentEngine.iconURI.spec : null,
       };
     }
 
@@ -114,17 +114,17 @@ const SearchAutocompleteProviderInternal
         iconUrl: engine.iconURI ? engine.iconURI.spec : null,
         resultDomain: domain,
       });
     }
   },
 
   getSuggestionController(searchToken, inPrivateContext, maxLocalResults,
                           maxRemoteResults, userContextId) {
-    let engine = Services.search.defaultEngine;
+    let engine = Services.search.currentEngine;
     if (!engine) {
       return null;
     }
     return new SearchSuggestionControllerWrapper(engine, searchToken,
                                                  inPrivateContext,
                                                  maxLocalResults, maxRemoteResults,
                                                  userContextId);
   },
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -2411,17 +2411,17 @@ Engine.prototype = {
       aResponseType = AppConstants.platform == "android" ? this._defaultMobileResponseType :
                                                            URLTYPE_SEARCH_HTML;
     }
 
     let resetPending;
     if (aResponseType == URLTYPE_SEARCH_HTML &&
         ((resetPending = resetStatus == "pending") ||
          resetEnabled) &&
-        this.name == Services.search.defaultEngine.name &&
+        this.name == Services.search.currentEngine.name &&
         !this._isDefault &&
         this.name != Services.search.originalDefaultEngine.name &&
         (resetPending || !this.getAttr("loadPathHash") ||
          this.getAttr("loadPathHash") != getVerificationHash(this._loadPath)) &&
         !this._isWhiteListed) {
       let url = "about:searchreset";
       let data = [];
       if (aData)
--- a/toolkit/components/search/nsSearchSuggestions.js
+++ b/toolkit/components/search/nsSearchSuggestions.js
@@ -146,17 +146,17 @@ SuggestAutoComplete.prototype = {
 
   /**
    * Actual implementation of search.
    */
   _triggerSearch(searchString, searchParam, listener, privacyMode) {
     this._listener = listener;
     this._suggestionController.fetch(searchString,
                                      privacyMode,
-                                     Services.search.defaultEngine);
+                                     Services.search.currentEngine);
   },
 
   /**
    * Ends the search result gathering process. Part of nsIAutoCompleteSearch
    * implementation.
    */
   stopSearch() {
     this._suggestionController.stop();