Bug 1223728 - Remove the unifiedcomplete pref. r=adw draft
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 05 May 2016 00:14:51 +0200
changeset 379600 981376f480b12d75a3d718ef5380634db105fea9
parent 379599 da4a9eed33bdbc5f5bd1002cc07f998a1eb037fa
child 523531 a7b64b90c6271a58da2f9ef4660186a1437a206e
push id21011
push usermak77@bonardo.net
push dateThu, 16 Jun 2016 13:40:45 +0000
reviewersadw
bugs1223728
milestone48.0
Bug 1223728 - Remove the unifiedcomplete pref. r=adw MozReview-Commit-ID: B0g6wN0Ehw0
browser/app/profile/firefox.js
browser/base/content/browser.xul
browser/base/content/tabbrowser.xml
browser/base/content/test/urlbar/browser.ini
browser/base/content/test/urlbar/browser_action_keyword.js
browser/base/content/test/urlbar/browser_action_keyword_override.js
browser/base/content/test/urlbar/browser_action_searchengine.js
browser/base/content/test/urlbar/browser_action_searchengine_alias.js
browser/base/content/test/urlbar/browser_autocomplete_a11y_label.js
browser/base/content/test/urlbar/browser_autocomplete_autoselect.js
browser/base/content/test/urlbar/browser_autocomplete_cursor.js
browser/base/content/test/urlbar/browser_autocomplete_edit_completed.js
browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
browser/base/content/test/urlbar/browser_autocomplete_no_title.js
browser/base/content/test/urlbar/browser_autocomplete_oldschool_wrap.js
browser/base/content/test/urlbar/browser_autocomplete_tag_star_visibility.js
browser/base/content/test/urlbar/browser_bug1003461-switchtab-override.js
browser/base/content/test/urlbar/browser_bug1070778.js
browser/base/content/test/urlbar/browser_search_favicon.js
browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js
browser/base/content/test/urlbar/browser_urlbarAutoFillTrimURLs.js
browser/base/content/test/urlbar/browser_urlbarDelete.js
browser/base/content/test/urlbar/browser_urlbarEnterAfterMouseOver.js
browser/base/content/test/urlbar/browser_urlbarSearchSuggestionsNotification.js
browser/base/content/test/urlbar/browser_urlbar_autoFill_backspaced.js
browser/base/content/urlbarBindings.xml
browser/components/preferences/in-content/main.xul
browser/components/preferences/in-content/privacy.js
browser/components/preferences/in-content/search.js
browser/components/sessionstore/test/browser_599909.js
toolkit/components/places/UnifiedComplete.js
toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -299,18 +299,16 @@ pref("browser.urlbar.doubleClickSelectsA
 #else
 pref("browser.urlbar.doubleClickSelectsAll", false);
 #endif
 
 // Control autoFill behavior
 pref("browser.urlbar.autoFill", true);
 pref("browser.urlbar.autoFill.typed", true);
 
-pref("browser.urlbar.unifiedcomplete", true);
-
 // 0: Match anywhere (e.g., middle of words)
 // 1: Match on word boundaries and then try matching anywhere
 // 2: Match only on word boundaries (e.g., after / or .)
 // 3: Match at the beginning of the url or title
 pref("browser.urlbar.matchBehavior", 1);
 pref("browser.urlbar.filter.javascript", true);
 
 // the maximum number of results to show in autocomplete when doing richResults
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -689,17 +689,17 @@
                            label="&forwardCmd.label;"
                            command="Browser:ForwardOrForwardDuplicate"
                            onclick="checkForMiddleClick(this, event);"
                            tooltip="forward-button-tooltip"
                            context="backForwardMenu"/>
             <textbox id="urlbar" flex="1"
                      placeholder="&urlbar.placeholder2;"
                      type="autocomplete"
-                     autocompletesearch="urlinline history"
+                     autocompletesearch="unifiedcomplete"
                      autocompletesearchparam="enable-actions"
                      autocompletepopup="PopupAutoCompleteRichResult"
                      completeselectedindex="true"
                      shrinkdelay="250"
                      tabscrolling="true"
                      showcommentcolumn="true"
                      showimagecolumn="true"
                      enablehistory="true"
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -58,20 +58,16 @@
       <field name="closingTabsEnum" readonly="true">({ ALL: 0, OTHER: 1, TO_END: 2 });</field>
 
       <field name="_visibleTabs">null</field>
 
       <field name="mURIFixup" readonly="true">
         Components.classes["@mozilla.org/docshell/urifixup;1"]
                   .getService(Components.interfaces.nsIURIFixup);
       </field>
-      <field name="_placesAutocomplete" readonly="true">
-         Components.classes["@mozilla.org/autocomplete/search;1?name=history"]
-                   .getService(Components.interfaces.mozIPlacesAutoComplete);
-      </field>
       <field name="_unifiedComplete" readonly="true">
          Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
                    .getService(Components.interfaces.mozIPlacesAutoComplete);
       </field>
       <field name="AppConstants" readonly="true">
         (Components.utils.import("resource://gre/modules/AppConstants.jsm", {})).AppConstants;
       </field>
       <field name="mTabBox" readonly="true">
@@ -785,29 +781,26 @@
 
                 // Don't clear the favicon if this onLocationChange was
                 // triggered by a pushState or a replaceState (bug 550565) or
                 // a hash change (bug 408415).
                 if (aWebProgress.isLoadingDocument && !isSameDocument) {
                   this.mBrowser.mIconURL = null;
                 }
 
-                let autocomplete = this.mTabBrowser._placesAutocomplete;
                 let unifiedComplete = this.mTabBrowser._unifiedComplete;
                 if (this.mBrowser.registeredOpenURI) {
-                  autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI);
                   unifiedComplete.unregisterOpenPage(this.mBrowser.registeredOpenURI);
                   delete this.mBrowser.registeredOpenURI;
                 }
                 // Tabs in private windows aren't registered as "Open" so
                 // that they don't appear as switch-to-tab candidates.
                 if (!isBlankPageURL(aLocation.spec) &&
                     (!PrivateBrowsingUtils.isWindowPrivate(window) ||
                     PrivateBrowsingUtils.permanentPrivateBrowsing)) {
-                  autocomplete.registerOpenPage(aLocation);
                   unifiedComplete.registerOpenPage(aLocation);
                   this.mBrowser.registeredOpenURI = aLocation;
                 }
               }
 
               if (!this.mBlank) {
                 this._callProgressListeners("onLocationChange",
                                             [aWebProgress, aRequest, aLocation,
@@ -2383,17 +2376,16 @@
 
             browser.webProgress.removeProgressListener(filter);
 
             const listener = this._tabListeners.get(aTab);
             filter.removeProgressListener(listener);
             listener.destroy();
 
             if (browser.registeredOpenURI && !aAdoptedByTab) {
-              this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
               this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI);
               delete browser.registeredOpenURI;
             }
 
             // We are no longer the primary content area.
             browser.setAttribute("type", "content-targetable");
 
             // Remove this tab as the owner of any other tabs, since it's going away.
@@ -2732,17 +2724,16 @@
 
       <method name="_swapRegisteredOpenURIs">
         <parameter name="aOurBrowser"/>
         <parameter name="aOtherBrowser"/>
         <body>
           <![CDATA[
             // If the current URI is registered as open remove it from the list.
             if (aOurBrowser.registeredOpenURI) {
-              this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI);
               this._unifiedComplete.unregisterOpenPage(aOurBrowser.registeredOpenURI);
               delete aOurBrowser.registeredOpenURI;
             }
 
             // If the other/new URI is registered as open then copy it over.
             if (aOtherBrowser.registeredOpenURI) {
               aOurBrowser.registeredOpenURI = aOtherBrowser.registeredOpenURI;
               delete aOtherBrowser.registeredOpenURI;
@@ -4510,17 +4501,16 @@
       <destructor>
         <![CDATA[
           Services.obs.removeObserver(this, "live-resize-start", false);
           Services.obs.removeObserver(this, "live-resize-end", false);
 
           for (let tab of this.tabs) {
             let browser = tab.linkedBrowser;
             if (browser.registeredOpenURI) {
-              this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
               this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI);
               delete browser.registeredOpenURI;
             }
             let filter = this._tabFilters.get(tab);
             let listener = this._tabListeners.get(tab);
 
             browser.webProgress.removeProgressListener(filter);
             filter.removeProgressListener(listener);
--- a/browser/base/content/test/urlbar/browser.ini
+++ b/browser/base/content/test/urlbar/browser.ini
@@ -10,17 +10,16 @@ skip-if = (os == "linux" || os == "mac")
 [browser_action_searchengine.js]
 [browser_action_searchengine_alias.js]
 [browser_autocomplete_a11y_label.js]
 [browser_autocomplete_autoselect.js]
 [browser_autocomplete_cursor.js]
 [browser_autocomplete_edit_completed.js]
 [browser_autocomplete_enter_race.js]
 [browser_autocomplete_no_title.js]
-[browser_autocomplete_oldschool_wrap.js]
 [browser_autocomplete_tag_star_visibility.js]
 [browser_bug1104165-switchtab-decodeuri.js]
 [browser_bug1003461-switchtab-override.js]
 [browser_bug1024133-switchtab-override-keynav.js]
 [browser_bug1025195_switchToTabHavingURI_aOpenParams.js]
 [browser_bug1070778.js]
 [browser_bug1225194-remotetab.js]
 [browser_bug304198.js]
--- a/browser/base/content/test/urlbar/browser_action_keyword.js
+++ b/browser/base/content/test/urlbar/browser_action_keyword.js
@@ -7,23 +7,16 @@ function* promise_first_result(inputText
   yield promiseAutocompleteResultPopup(inputText);
 
   let firstResult = gURLBar.popup.richlistbox.firstChild;
   return firstResult;
 }
 
 
 add_task(function*() {
-  // This test is only relevant if UnifiedComplete is enabled.
-  let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  registerCleanupFunction(() => {
-    Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
-  });
-
   let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla");
   let tabs = [tab];
   registerCleanupFunction(function* () {
     for (let tab of tabs)
       gBrowser.removeTab(tab);
     yield PlacesUtils.bookmarks.remove(bm);
   });
 
--- a/browser/base/content/test/urlbar/browser_action_keyword_override.js
+++ b/browser/base/content/test/urlbar/browser_action_keyword_override.js
@@ -1,16 +1,9 @@
 add_task(function*() {
-  // This test is only relevant if UnifiedComplete is enabled.
-  let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  registerCleanupFunction(() => {
-    Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
-  });
-
   let bm = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
                                                 url: "http://example.com/?q=%s",
                                                 title: "test" });
   yield PlacesUtils.keywords.insert({ keyword: "keyword",
                                       url: "http://example.com/?q=%s" })
 
   registerCleanupFunction(function* () {
     yield PlacesUtils.bookmarks.remove(bm);
--- a/browser/base/content/test/urlbar/browser_action_searchengine.js
+++ b/browser/base/content/test/urlbar/browser_action_searchengine.js
@@ -1,19 +1,9 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
 add_task(function* () {
-  // This test is only relevant if UnifiedComplete is enabled.
-  let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  registerCleanupFunction(() => {
-    Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
-  });
-
   Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
                                        "http://example.com/?q={searchTerms}");
   let engine = Services.search.getEngineByName("MozSearch");
   let originalEngine = Services.search.currentEngine;
   Services.search.currentEngine = engine;
 
   let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
   yield promiseTabLoaded(gBrowser.selectedTab);
--- a/browser/base/content/test/urlbar/browser_action_searchengine_alias.js
+++ b/browser/base/content/test/urlbar/browser_action_searchengine_alias.js
@@ -1,21 +1,9 @@
-/**
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- **/
-
 add_task(function* () {
-  // This test is only relevant if UnifiedComplete is enabled.
-  let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  registerCleanupFunction(() => {
-    Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
-  });
-
   let iconURI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC";
   Services.search.addEngineWithDetails("MozSearch", iconURI, "moz", "", "GET",
                                        "http://example.com/?q={searchTerms}");
   let engine = Services.search.getEngineByName("MozSearch");
   let originalEngine = Services.search.currentEngine;
   Services.search.currentEngine = engine;
 
   let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
--- a/browser/base/content/test/urlbar/browser_autocomplete_a11y_label.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_a11y_label.js
@@ -1,24 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const UNIFIEDCOMPLETE_PREF = "browser.urlbar.unifiedcomplete";
 const SUGGEST_ALL_PREF = "browser.search.suggest.enabled";
 const SUGGEST_URLBAR_PREF = "browser.urlbar.suggest.searches";
 const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
 
-add_task(function* prepare() {
-  // This test is only relevant if UnifiedComplete is enabled.
-  Services.prefs.setBoolPref(UNIFIEDCOMPLETE_PREF, true);
-  registerCleanupFunction(() => {
-    Services.prefs.clearUserPref(UNIFIEDCOMPLETE_PREF);
-  });
-});
-
 add_task(function* switchToTab() {
   let tab = gBrowser.addTab("about:about");
   yield promiseTabLoaded(tab);
 
   let actionURL = makeActionURI("switchtab", {url: "about:about"}).spec;
   yield promiseAutocompleteResultPopup("% about");
 
   ok(gURLBar.popup.richlistbox.children.length > 1, "Should get at least 2 results");
--- a/browser/base/content/test/urlbar/browser_autocomplete_autoselect.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_autoselect.js
@@ -4,23 +4,16 @@ function repeat(limit, func) {
   }
 }
 
 function is_selected(index) {
   is(gURLBar.popup.richlistbox.selectedIndex, index, `Item ${index + 1} should be selected`);
 }
 
 add_task(function*() {
-  // This test is only relevant if UnifiedComplete is enabled.
-  let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  registerCleanupFunction(() => {
-    Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
-  });
-
   let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
 
   registerCleanupFunction(function* () {
     yield PlacesTestUtils.clearHistory();
   });
 
   let visits = [];
   repeat(maxResults, i => {
--- a/browser/base/content/test/urlbar/browser_autocomplete_cursor.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_cursor.js
@@ -1,16 +1,9 @@
 add_task(function*() {
-  // This test is only relevant if UnifiedComplete is enabled.
-  let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  registerCleanupFunction(() => {
-    Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
-  });
-
   let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
   yield promiseTabLoaded(tab);
   yield promiseAutocompleteResultPopup("www.mozilla.org");
 
   gURLBar.selectTextRange(4, 4);
 
   is(gURLBar.popup.state, "open", "Popup should be open");
   is(gURLBar.popup.richlistbox.selectedIndex, 0, "Should have selected something");
--- a/browser/base/content/test/urlbar/browser_autocomplete_edit_completed.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_edit_completed.js
@@ -1,28 +1,20 @@
 add_task(function*() {
   yield PlacesTestUtils.clearHistory();
 
   yield PlacesTestUtils.addVisits([
     { uri: makeURI("http://example.com/foo") },
     { uri: makeURI("http://example.com/foo/bar") },
   ]);
 
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  yield* do_test();
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", false);
-  yield* do_test();
-});
+  registerCleanupFunction(function* () {
+    yield PlacesTestUtils.clearHistory();
+  });
 
-registerCleanupFunction(function* () {
-  Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
-  yield PlacesTestUtils.clearHistory();
-});
-
-function* do_test() {
   gBrowser.selectedTab = gBrowser.addTab("about:blank");
   gURLBar.focus();
 
   yield promiseAutocompleteResultPopup("http://example.com");
 
   let popup = gURLBar.popup;
   let list = popup.richlistbox;
   let initialIndex = list.selectedIndex;
@@ -45,9 +37,9 @@ function* do_test() {
 
   info("Press return to load edited URL.");
   EventUtils.synthesizeKey("VK_RETURN", {});
   yield Promise.all([
     promisePopupHidden(gURLBar.popup),
     waitForDocLoadAndStopIt("http://" + editedValue)]);
 
   gBrowser.removeTab(gBrowser.selectedTab);
-}
+});
--- a/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
@@ -1,14 +1,10 @@
 add_task(function*() {
-  // This test is only relevant if UnifiedComplete is enabled.
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-
   registerCleanupFunction(function* () {
-    Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
     yield PlacesUtils.bookmarks.remove(bm);
   });
 
   let bm = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
                                                 url: "http://example.com/?q=%s",
                                                 title: "test" });
   yield PlacesUtils.keywords.insert({ keyword: "keyword",
                                       url: "http://example.com/?q=%s" });
--- a/browser/base/content/test/urlbar/browser_autocomplete_no_title.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_no_title.js
@@ -1,19 +1,9 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
 add_task(function*() {
-  // This test is only relevant if UnifiedComplete is enabled.
-  let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  registerCleanupFunction(() => {
-    Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
-  });
-
   let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
   yield promiseTabLoaded(tab);
 
   let uri = NetUtil.newURI("http://bug1060642.example.com/beards/are/pretty/great");
   yield PlacesTestUtils.addVisits([{uri: uri, title: ""}]);
 
   yield promiseAutocompleteResultPopup("bug1060642");
   ok(gURLBar.popup.richlistbox.children.length > 1, "Should get at least 2 results");
deleted file mode 100644
--- a/browser/base/content/test/urlbar/browser_autocomplete_oldschool_wrap.js
+++ /dev/null
@@ -1,74 +0,0 @@
-function repeat(limit, func) {
-  for (let i = 0; i < limit; i++) {
-    func(i);
-  }
-}
-
-function is_selected(index) {
-  is(gURLBar.popup.richlistbox.selectedIndex, index, `Item ${index + 1} should be selected`);
-}
-
-add_task(function*() {
-  // This test is only relevant if UnifiedComplete is *disabled*.
-  if (Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
-    ok(true, "Don't run this test with UnifiedComplete enabled.")
-    return;
-  }
-
-  yield PlacesTestUtils.clearHistory();
-  let visits = [];
-  repeat(10, i => {
-    visits.push({
-      uri: makeURI("http://example.com/autocomplete/?" + i),
-    });
-  });
-  yield PlacesTestUtils.addVisits(visits);
-
-  registerCleanupFunction(function* () {
-    yield PlacesTestUtils.clearHistory();
-  });
-
-  let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
-  yield promiseTabLoaded(tab);
-  yield promiseAutocompleteResultPopup("example.com/autocomplete");
-
-  let popup = gURLBar.popup;
-  let results = popup.richlistbox.children.filter(is_visible);
-
-  is(results.length, 10, "Should get 10 results");
-  is_selected(-1);
-
-  info("Key Down to select the next item");
-  EventUtils.synthesizeKey("VK_DOWN", {});
-  is_selected(0);
-
-  info("Key Up to select the previous item");
-  EventUtils.synthesizeKey("VK_UP", {});
-  is_selected(-1);
-
-  info("Key Down to select the next item");
-  EventUtils.synthesizeKey("VK_DOWN", {});
-  is_selected(0);
-
-  info("Key Down 11 times should wrap around all the way around");
-  repeat(11, () => EventUtils.synthesizeKey("VK_DOWN", {}));
-  is_selected(0);
-
-  info("Key Up 11 times should wrap around the other way");
-  repeat(11, () => EventUtils.synthesizeKey("VK_UP", {}));
-  is_selected(0);
-
-  info("Page Up will go up the list, but not wrap");
-  repeat(4, () => EventUtils.synthesizeKey("VK_DOWN", {}));
-  is_selected(4);
-  EventUtils.synthesizeKey("VK_PAGE_UP", {})
-  is_selected(0);
-
-  info("Page Up again will wrap around to the end of the list");
-  EventUtils.synthesizeKey("VK_PAGE_UP", {})
-  is_selected(-1);
-
-  EventUtils.synthesizeKey("VK_ESCAPE", {});
-  yield promisePopupHidden(gURLBar.popup);
-  gBrowser.removeTab(tab);
-});
--- a/browser/base/content/test/urlbar/browser_autocomplete_tag_star_visibility.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_tag_star_visibility.js
@@ -1,16 +1,11 @@
 add_task(function*() {
-  // This test is only relevant if UnifiedComplete is enabled.
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-
   registerCleanupFunction(() => {
     PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
-    Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
-    Services.prefs.clearUserPref("browser.urlbar.suggest.bookmark");
   });
 
   function* addTagItem(tagName) {
     let uri = NetUtil.newURI(`http://example.com/this/is/tagged/${tagName}`);
     PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
                                          uri,
                                          PlacesUtils.bookmarks.DEFAULT_INDEX,
                                          `test ${tagName}`);
--- a/browser/base/content/test/urlbar/browser_bug1003461-switchtab-override.js
+++ b/browser/base/content/test/urlbar/browser_bug1003461-switchtab-override.js
@@ -1,20 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 add_task(function* test_switchtab_override() {
-  // This test is only relevant if UnifiedComplete is enabled.
-  let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  registerCleanupFunction(() => {
-    Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
-  });
-
   let testURL = "http://example.org/browser/browser/base/content/test/urlbar/dummy_page.html";
 
   info("Opening first tab");
   let tab = gBrowser.addTab(testURL);
   let deferred = Promise.defer();
   whenTabLoaded(tab, deferred.resolve);
   yield deferred.promise;
 
--- a/browser/base/content/test/urlbar/browser_bug1070778.js
+++ b/browser/base/content/test/urlbar/browser_bug1070778.js
@@ -1,23 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function is_selected(index) {
   is(gURLBar.popup.richlistbox.selectedIndex, index, `Item ${index + 1} should be selected`);
 }
 
 add_task(function*() {
-  // This test is only relevant if UnifiedComplete is enabled.
-  let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  registerCleanupFunction(() => {
-    Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
-  });
-
   let bookmarks = [];
   bookmarks.push((yield PlacesUtils.bookmarks
                                    .insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
                                              url: "http://example.com/?q=%s",
                                              title: "test" })));
   yield PlacesUtils.keywords.insert({ keyword: "keyword",
                                       url: "http://example.com/?q=%s" });
 
--- a/browser/base/content/test/urlbar/browser_search_favicon.js
+++ b/browser/base/content/test/urlbar/browser_search_favicon.js
@@ -1,26 +1,20 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
 var gOriginalEngine;
 var gEngine;
-var gUnifiedCompletePref = "browser.urlbar.unifiedcomplete";
 var gRestyleSearchesPref = "browser.urlbar.restyleSearches";
 
 registerCleanupFunction(() => {
-  Services.prefs.clearUserPref(gUnifiedCompletePref);
   Services.prefs.clearUserPref(gRestyleSearchesPref);
   Services.search.currentEngine = gOriginalEngine;
   Services.search.removeEngine(gEngine);
   return PlacesTestUtils.clearHistory();
 });
 
 add_task(function*() {
-  Services.prefs.setBoolPref(gUnifiedCompletePref, true);
   Services.prefs.setBoolPref(gRestyleSearchesPref, true);
 });
 
 add_task(function*() {
 
   Services.search.addEngineWithDetails("SearchEngine", "", "", "",
                                        "GET", "http://s.example.com/search");
   gEngine = Services.search.getEngineByName("SearchEngine");
--- a/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js
+++ b/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js
@@ -15,17 +15,18 @@ var gController = Cc["@mozilla.org/autoc
                   getService(Ci.nsIAutoCompleteController);
 
 var gTabWaitCount = 0;
 var gTabCounter = 0;
 
 var gTestSteps = [
   function() {
     info("Running step 1");
-    for (let i = 0; i < 10; i++) {
+    let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
+    for (let i = 0; i < maxResults - 1; i++) {
       let tab = gBrowser.addTab();
       loadTab(tab, TEST_URL_BASES[0] + (++gTabCounter));
     }
   },
   function() {
     info("Running step 2");
     gBrowser.selectTabAtIndex(1);
     gBrowser.removeCurrentTab();
@@ -186,31 +187,36 @@ function ensure_opentabs_match_db(aCallb
   checkAutocompleteResults(tabs, aCallback);
 }
 
 function checkAutocompleteResults(aExpected, aCallback)
 {
   gController.input = {
     timeout: 10,
     textValue: "",
-    searches: ["history"],
+    searches: ["unifiedcomplete"],
     searchParam: "enable-actions",
     popupOpen: false,
     minResultsForPopup: 0,
     invalidate: function() {},
     disableAutoComplete: false,
     completeDefaultIndex: false,
     get popup() { return this; },
     onSearchBegin: function() {},
     onSearchComplete:  function ()
     {
       info("Found " + gController.matchCount + " matches.");
       // Check to see the expected uris and titles match up (in any order)
       for (let i = 0; i < gController.matchCount; i++) {
-        let uri = gController.getValueAt(i).replace(/^moz-action:[^,]+,/i, "");
+        if (gController.getStyleAt(i).includes("heuristic")) {
+          info("Skip heuristic match");
+          continue;
+        }
+        let action = gURLBar.popup.input._parseActionUrl(gController.getValueAt(i));
+        let uri = action.params.url;
 
         info("Search for '" + uri + "' in open tabs.");
         let expected = uri in aExpected;
         ok(expected, uri + " was found in autocomplete, was " + (expected ? "" : "not ") + "expected");
         // Remove the found entry from expected results.
         delete aExpected[uri];
       }
 
--- a/browser/base/content/test/urlbar/browser_urlbarAutoFillTrimURLs.js
+++ b/browser/base/content/test/urlbar/browser_urlbarAutoFillTrimURLs.js
@@ -49,20 +49,17 @@ function continue_test() {
       aCallback();
     });
   }
 
   test_autoFill("http://", "http://", function () {
     test_autoFill("http://au", "http://autofilltrimurl.com/", function () {
       test_autoFill("http://www.autofilltrimurl.com", "http://www.autofilltrimurl.com/", function () {
         // Now ensure selecting from the popup correctly trims.
-        if (Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete"))
-          is(gURLBar.controller.matchCount, 2, "Found the expected number of matches");
-        else
-          is(gURLBar.controller.matchCount, 1, "Found the expected number of matches");
+        is(gURLBar.controller.matchCount, 2, "Found the expected number of matches");
         EventUtils.synthesizeKey("VK_DOWN", {});
         is(gURLBar.textValue, "www.autofilltrimurl.com/whatever", "trim was applied correctly");
         gURLBar.closePopup();
         PlacesTestUtils.clearHistory().then(finish);
       });
     });
   });
 }
--- a/browser/base/content/test/urlbar/browser_urlbarDelete.js
+++ b/browser/base/content/test/urlbar/browser_urlbarDelete.js
@@ -2,25 +2,16 @@ add_task(function*() {
   let bm = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
                                                 url: "http://bug1105244.example.com/",
                                                 title: "test" });
 
   registerCleanupFunction(function* () {
     yield PlacesUtils.bookmarks.remove(bm);
   });
 
-  // We do this test with both unifiedcomplete disabled and enabled.
-  let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-  registerCleanupFunction(() => {
-    Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
-  });
-
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", false);
-  yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, testDelete);
-
   Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
   yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, testDelete);
 });
 
 function sendHome() {
   // unclear why VK_HOME doesn't work on Mac, but it doesn't...
   if (Services.appinfo.OS == "Darwin") {
     EventUtils.synthesizeKey("VK_LEFT", { altKey: true });
--- a/browser/base/content/test/urlbar/browser_urlbarEnterAfterMouseOver.js
+++ b/browser/base/content/test/urlbar/browser_urlbarEnterAfterMouseOver.js
@@ -30,24 +30,16 @@ add_task(function*() {
   let visits = [];
   repeat(gMaxResults, i => {
     visits.push({
       uri: makeURI("http://example.com/autocomplete/?" + i),
     });
   });
   yield PlacesTestUtils.addVisits(visits);
 
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-  yield* do_test();
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", false);
-  yield* do_test();
-  Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
-});
-
-function* do_test() {
   gBrowser.selectedTab = gBrowser.addTab("about:blank");
   yield promiseAutoComplete("http://example.com/autocomplete/");
 
   let popup = gURLBar.popup;
   let results = popup.richlistbox.children;
   is(results.length, gMaxResults,
      "Should get gMaxResults=" + gMaxResults + " results");
 
@@ -70,9 +62,9 @@ function* do_test() {
   is_selected(3);
 
   let autocompletePopupHidden = promisePopupHidden(gURLBar.popup);
   let openedExpectedPage = waitForDocLoadAndStopIt(expectedURL);
   EventUtils.synthesizeKey("VK_RETURN", {});
   yield Promise.all([autocompletePopupHidden, openedExpectedPage]);
 
   gBrowser.removeCurrentTab();
-}
+});
--- a/browser/base/content/test/urlbar/browser_urlbarSearchSuggestionsNotification.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchSuggestionsNotification.js
@@ -1,22 +1,19 @@
 const SUGGEST_ALL_PREF = "browser.search.suggest.enabled";
 const SUGGEST_URLBAR_PREF = "browser.urlbar.suggest.searches";
 const CHOICE_PREF = "browser.urlbar.userMadeSearchSuggestionsChoice";
 const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
 
 // Must run first.
 add_task(function* prepare() {
-  // The test makes only sense if unified complete is enabled.
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
   let engine = yield promiseNewSearchEngine(TEST_ENGINE_BASENAME);
   let oldCurrentEngine = Services.search.currentEngine;
   Services.search.currentEngine = engine;
-  registerCleanupFunction(function () {
-    Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
+  registerCleanupFunction(function* () {
     Services.search.currentEngine = oldCurrentEngine;
     Services.prefs.clearUserPref(SUGGEST_ALL_PREF);
     Services.prefs.clearUserPref(SUGGEST_URLBAR_PREF);
 
     // Disable the notification for future tests so it doesn't interfere with
     // them.  clearUserPref() won't work because by default the pref is false.
     yield setUserMadeChoicePref(true);
 
--- a/browser/base/content/test/urlbar/browser_urlbar_autoFill_backspaced.js
+++ b/browser/base/content/test/urlbar/browser_urlbar_autoFill_backspaced.js
@@ -21,26 +21,24 @@ function* test_autocomplete(data) {
   let result = gURLBar.popup.richlistbox.children[0];
   let type = result.getAttribute("type");
   let types = type.split(/\s+/);
   ok(types.indexOf(action) >= 0, `The type attribute "${type}" includes the expected action "${action}"`);
 
   gURLBar.popup.hidePopup();
   yield promisePopupHidden(gURLBar.popup);
   gURLBar.blur();
-};
+}
 
 add_task(function* () {
   registerCleanupFunction(function* () {
-    Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
     Services.prefs.clearUserPref("browser.urlbar.autoFill");
     gURLBar.handleRevert();
     yield PlacesTestUtils.clearHistory();
   });
-  Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
   Services.prefs.setBoolPref("browser.urlbar.autoFill", true);
 
   // Add a typed visit, so it will be autofilled.
   yield PlacesTestUtils.addVisits({
     uri: NetUtil.newURI("http://example.com/"),
     transition: Ci.nsINavHistoryService.TRANSITION_TYPED
   });
 
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -72,23 +72,16 @@ file, You can obtain one at http://mozil
         this.inputField.controllers.insertControllerAt(0, this._copyCutController);
         this.inputField.addEventListener("paste", this, false);
         this.inputField.addEventListener("mousedown", this, false);
         this.inputField.addEventListener("mousemove", this, false);
         this.inputField.addEventListener("mouseout", this, false);
         this.inputField.addEventListener("overflow", this, false);
         this.inputField.addEventListener("underflow", this, false);
 
-        try {
-          if (this._prefs.getBoolPref("unifiedcomplete")) {
-            this.setAttribute("autocompletesearch", "unifiedcomplete");
-            this.mSearchNames = null;
-          }
-        } catch (ex) {}
-
         const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
         var textBox = document.getAnonymousElementByAttribute(this,
                                                 "anonid", "textbox-input-box");
         var cxmenu = document.getAnonymousElementByAttribute(textBox,
                                             "anonid", "input-box-contextmenu");
         var pasteAndGo;
         cxmenu.addEventListener("popupshowing", function() {
           if (!pasteAndGo)
@@ -727,25 +720,16 @@ file, You can obtain one at http://mozil
                   this.popup.searchSuggestionsNotificationWasDismissed(
                     this._prefs.getBoolPref("suggest.searches")
                   );
                 }
                 break;
               case "trimURLs":
                 this._mayTrimURLs = this._prefs.getBoolPref(aData);
                 break;
-              case "unifiedcomplete":
-                let useUnifiedComplete = false;
-                try {
-                  useUnifiedComplete = this._prefs.getBoolPref(aData);
-                } catch (ex) {}
-                this.setAttribute("autocompletesearch",
-                                  useUnifiedComplete ? "unifiedcomplete"
-                                                     : "urlinline history");
-                this.mSearchNames = null;
             }
           }
         ]]></body>
       </method>
 
       <method name="handleEvent">
         <parameter name="aEvent"/>
         <body><![CDATA[
@@ -862,29 +846,19 @@ file, You can obtain one at http://mozil
           // URL is in the format moz-action:ACTION,PARAMS
           // Where PARAMS is a JSON encoded object.
           let [, type, params] = aUrl.match(MOZ_ACTION_REGEX);
 
           let action = {
             type: type,
           };
 
-          try {
-            action.params = JSON.parse(params);
-            for (let key in action.params) {
-              action.params[key] = decodeURIComponent(action.params[key]);
-            }
-          } catch (e) {
-            // If this failed, we assume that params is not a JSON object, and
-            // is instead just a flat string. This will happen when
-            // UnifiedComplete is disabled - in which case, the param is always
-            // a URL.
-            action.params = {
-              url: params,
-            };
+          action.params = JSON.parse(params);
+          for (let key in action.params) {
+            action.params[key] = decodeURIComponent(action.params[key]);
           }
 
           if ("url" in action.params) {
             let uri;
             try {
               uri = makeURI(action.params.url);
               action.params.displayUrl = losslessDecodeURI(uri);
             } catch (e) {
@@ -922,32 +896,23 @@ file, You can obtain one at http://mozil
             this.mController.handleText();
           }
           this.resetActionType();
         ]]></body>
       </method>
 
       <method name="handleEnter">
         <body><![CDATA[
-          // When UnifiedComplete is enabled, we need to ensure we're using
-          // a selected autocomplete result. A result should automatically be
-          // selected by default (UnifiedComplete guarantees at least one
-          // result), however autocomplete is async and therefore we may not
+          // We need to ensure we're using a selected autocomplete result.
+          // A result should automatically be selected by default,
+          // however autocomplete is async and therefore we may not
           // have a result set relating to the current input yet. If that
           // happens, we need to mark that when the first result does get added,
           // it needs to be handled as if enter was pressed with that first
           // result selected.
-          // With UnifiedComplete disabled we don't have this problem, as the
-          // default is to use the value directly from the input field (without
-          // relying on autocomplete).
-
-          if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
-            return this.mController.handleEnter(false);
-          }
-
           // If anything other than the default (first) result is selected, then
           // it must have been manually selected by the human. We let this
           // explicit choice be used, even if it may be related to a previous
           // input.
           // However, if the default result is automatically selected, we
           // ensure that it corresponds to the current input.
 
           if (this.popup.selectedIndex != 0 || this.gotResultForCurrentQuery) {
@@ -988,18 +953,17 @@ file, You can obtain one at http://mozil
 
       <property name="shouldShowSearchSuggestionsNotification" readonly="true">
         <getter><![CDATA[
           return !this._userMadeSearchSuggestionsChoice &&
                  !this.inPrivateContext &&
                  // When _urlbarFocused is true, tabbrowser would close the
                  // popup if it's opened here, so don't show the notification.
                  !gBrowser.selectedBrowser._urlbarFocused &&
-                 Services.prefs.getBoolPref("browser.search.suggest.enabled") &&
-                 this._prefs.getBoolPref("unifiedcomplete");
+                 Services.prefs.getBoolPref("browser.search.suggest.enabled");
         ]]></getter>
       </property>
 
     </implementation>
 
     <handlers>
       <handler event="keydown"><![CDATA[
         if ((event.keyCode === KeyEvent.DOM_VK_ALT ||
@@ -1249,21 +1213,18 @@ file, You can obtain one at http://mozil
           );
           Services.prefs.setBoolPref(
             "browser.urlbar.userMadeSearchSuggestionsChoice", true
           );
           // The input's pref observer will now hide the notification.
         ]]></body>
       </method>
 
-      <!-- Override this so that when UnifiedComplete is enabled, navigating
-           between items results in an item always being selected. This is
-           contrary to the old behaviour (UnifiedComplete disabled) where
-           if you navigate beyond either end of the list, no item will be
-           selected. -->
+      <!-- Override this so that navigating between items results in an item
+           always being selected. -->
       <method name="getNextIndex">
         <parameter name="reverse"/>
         <parameter name="amount"/>
         <parameter name="index"/>
         <parameter name="maxRow"/>
         <body><![CDATA[
           if (maxRow < 0)
             return -1;
@@ -1603,19 +1564,16 @@ file, You can obtain one at http://mozil
             return parts.filter(str => str).join(" ");
           ]]>
         </body>
       </method>
 
       <method name="onResultsAdded">
         <body>
           <![CDATA[
-            if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete"))
-              return;
-
             // If nothing is selected yet, select the first result if it is a
             // pre-selected "heuristic" result.  (See UnifiedComplete.js.)
             if (this.selectedIndex == -1 && this._isFirstResultHeuristic) {
               // Don't handle this as a user-initiated action.
               this._ignoreNextSelect = true;
 
               // Don't fire DOMMenuItemActive so that screen readers still see
               // the input as being focused.
--- a/browser/components/preferences/in-content/main.xul
+++ b/browser/components/preferences/in-content/main.xul
@@ -187,17 +187,17 @@
       <html:td class="label-cell">
         <label accesskey="&homepage.accesskey;"
                control="browserHomePage">&homepage.label;</label>
       </html:td>
       <html:td class="content-cell">
         <textbox id="browserHomePage"
                  class="padded uri-element content-cell-item"
                  type="autocomplete"
-                 autocompletesearch="history"
+                 autocompletesearch="unifiedcomplete"
                  onsyncfrompreference="return gMainPane.syncFromHomePref();"
                  onsynctopreference="return gMainPane.syncToHomePref(this.value);"
                  placeholder="&abouthome.pageTitle;"
                  preference="browser.startup.homepage"/>
       </html:td>
     </html:tr>
     <html:tr>
       <html:td class="label-cell" />
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -44,29 +44,18 @@ var gPrivacyPane = {
     let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection-pbm";
     link.setAttribute("href", url);
   },
 
   /**
    * Initialize autocomplete to ensure prefs are in sync.
    */
   _initAutocomplete: function () {
-    let unifiedCompletePref = false;
-    try {
-      unifiedCompletePref =
-        Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-    } catch (ex) {}
-
-    if (unifiedCompletePref) {
-      Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
-                .getService(Components.interfaces.mozIPlacesAutoComplete);
-    } else {
-      Components.classes["@mozilla.org/autocomplete/search;1?name=history"]
-                .getService(Components.interfaces.mozIPlacesAutoComplete);
-    }
+    Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
+              .getService(Components.interfaces.mozIPlacesAutoComplete);
   },
 
   /**
    * Sets up the UI for the number of days of history to keep, and updates the
    * label of the "Clear Now..." button.
    */
   init: function ()
   {
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -21,29 +21,18 @@ document.addEventListener("Initialized",
 var gEngineView = null;
 
 var gSearchPane = {
 
   /**
    * Initialize autocomplete to ensure prefs are in sync.
    */
   _initAutocomplete: function () {
-    let unifiedCompletePref = false;
-    try {
-      unifiedCompletePref =
-        Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-    } catch (ex) {}
-
-    if (unifiedCompletePref) {
-      Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
-                .getService(Components.interfaces.mozIPlacesAutoComplete);
-    } else {
-      Components.classes["@mozilla.org/autocomplete/search;1?name=history"]
-                .getService(Components.interfaces.mozIPlacesAutoComplete);
-    }
+    Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
+              .getService(Components.interfaces.mozIPlacesAutoComplete);
   },
 
   init: function ()
   {
     gEngineView = new EngineView(new EngineStore());
     document.getElementById("engineList").view = gEngineView;
     this.buildDefaultEngineDropDown();
 
@@ -65,24 +54,21 @@ var gSearchPane = {
       document.getElementById("browser.search.suggest.enabled");
     suggestsPref.addEventListener("change", () => {
       this.updateSuggestsCheckbox();
     });
     this.updateSuggestsCheckbox();
   },
 
   updateSuggestsCheckbox() {
-    let urlbarSuggests = document.getElementById("urlBarSuggestion");
-    urlbarSuggests.hidden =
-      !Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-
     let suggestsPref =
       document.getElementById("browser.search.suggest.enabled");
     let permanentPB =
       Services.prefs.getBoolPref("browser.privatebrowsing.autostart");
+    let urlbarSuggests = document.getElementById("urlBarSuggestion");
     urlbarSuggests.disabled = !suggestsPref.value || permanentPB;
 
     let urlbarSuggestsPref =
       document.getElementById("browser.urlbar.suggest.searches");
     urlbarSuggests.checked = urlbarSuggestsPref.value;
     if (urlbarSuggests.disabled) {
       urlbarSuggests.checked = false;
     }
--- a/browser/components/sessionstore/test/browser_599909.js
+++ b/browser/components/sessionstore/test/browser_599909.js
@@ -65,31 +65,36 @@ function test() {
 // so that we could do the same sort of checking.
 var gController = Cc["@mozilla.org/autocomplete/controller;1"].
                   getService(Ci.nsIAutoCompleteController);
 
 function checkAutocompleteResults(aExpected, aCallback) {
   gController.input = {
     timeout: 10,
     textValue: "",
-    searches: ["history"],
+    searches: ["unifiedcomplete"],
     searchParam: "enable-actions",
     popupOpen: false,
     minResultsForPopup: 0,
     invalidate: function() {},
     disableAutoComplete: false,
     completeDefaultIndex: false,
     get popup() { return this; },
     onSearchBegin: function() {},
     onSearchComplete:  function ()
     {
       info("Found " + gController.matchCount + " matches.");
       // Check to see the expected uris and titles match up (in any order)
       for (let i = 0; i < gController.matchCount; i++) {
-        let uri = gController.getValueAt(i).replace(/^moz-action:[^,]+,/i, "");
+        if (gController.getStyleAt(i).includes("heuristic")) {
+          info("Skip heuristic match");
+          continue;
+        }
+        let action = gURLBar.popup.input._parseActionUrl(gController.getValueAt(i));
+        let uri = action.params.url;
 
         info("Search for '" + uri + "' in open tabs.");
         ok(uri in aExpected, "Registered open page found in autocomplete.");
         // Remove the found entry from expected results.
         delete aExpected[uri];
       }
 
       // Make sure there is no reported open page that is not open.
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -903,19 +903,21 @@ Search.prototype = {
 
     // We sleep a little between adding the heuristicFirstMatch and matching
     // any other searches so we aren't kicking off potentially expensive
     // searches on every keystroke.
     yield this._sleep(Prefs.delay);
     if (!this.pending)
       return;
 
-    yield this._matchSearchSuggestions();
-    if (!this.pending)
-      return;
+    if (this._enableActions) {
+      yield this._matchSearchSuggestions();
+      if (!this.pending)
+        return;
+    }
 
     for (let [query, params] of queries) {
       yield conn.executeCached(query, params, this._onResultRow.bind(this));
       if (!this.pending)
         return;
     }
 
     if (this._enableActions && this.hasBehavior("openpage")) {
@@ -1955,16 +1957,18 @@ UnifiedComplete.prototype = {
    *        Indicates if we should notify the AutoComplete listener about our
    *        results or not.
    */
   finishSearch: function (notify=false) {
     TelemetryStopwatch.cancel(TELEMETRY_1ST_RESULT, this);
     TelemetryStopwatch.cancel(TELEMETRY_6_FIRST_RESULTS, this);
     // Clear state now to avoid race conditions, see below.
     let search = this._currentSearch;
+    if (!search)
+      return;
     this._lastLowResultsSearchSuggestion = search._lastLowResultsSearchSuggestion;
     delete this._currentSearch;
 
     if (!notify)
       return;
 
     // There is a possible race condition here.
     // When a search completes it calls finishSearch that notifies results
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -114,17 +114,17 @@ function _check_autocomplete_matches(mat
   let { uri, title, tags, searchEngine, style } = match;
   if (tags)
     title += " \u2013 " + tags.sort().join(", ");
   if (style)
     style = style.sort();
   else
     style = ["favicon"];
 
-  do_print("Checking against expected '" + uri.spec + "', '" + title + "'...");
+  do_print(`Checking against expected "${uri.spec}", "${title}"`);
   // Got a match on both uri and title?
   if (stripPrefix(uri.spec) != stripPrefix(result.value) || title != result.comment) {
     return false;
   }
 
   let actualStyle = result.style.split(/\s+/).sort();
   if (style)
     Assert.equal(actualStyle.toString(), style.toString(), "Match should have expected style");
@@ -188,57 +188,59 @@ function* check_autocomplete(test) {
   // is specified, we check that the first specified match is the first
   // controller value (as this is the "special" always selected item), but the
   // rest can match in any order.
   // If 'enable-actions' is not specified, they can match in any order.
   if (test.matches) {
     // Do not modify the test original matches.
     let matches = test.matches.slice();
 
-    let firstIndexToCheck = 0;
-    if (test.searchParam && test.searchParam == "enable-actions") {
-      firstIndexToCheck = 1;
-      do_print("Checking first match is first autocomplete entry")
-      let result = {
-        value: controller.getValueAt(0),
-        comment: controller.getCommentAt(0),
-        style: controller.getStyleAt(0),
-        image: controller.getImageAt(0),
-      }
-      do_print(`First match is "${result.value}", " ${result.comment}"`);
-      Assert.ok(_check_autocomplete_matches(matches[0], result), "first item is correct");
-      do_print("Checking rest of the matches");
-    }
-
-    for (let i = firstIndexToCheck; i < controller.matchCount; i++) {
-      let result = {
-        value: controller.getValueAt(i),
-        comment: controller.getCommentAt(i),
-        style: controller.getStyleAt(i),
-        image: controller.getImageAt(i),
-      }
-      do_print(`Looking for "${result.value}", "${result.comment}" in expected results...`);
-      let lowerBound = test.checkSorting ? i : firstIndexToCheck;
-      let upperBound = test.checkSorting ? i + 1 : matches.length;
-      let found = false;
-      for (let j = lowerBound; j < upperBound; ++j) {
-        // Skip processed expected results
-        if (matches[j] == undefined)
-          continue;
-        if (_check_autocomplete_matches(matches[j], result)) {
-          do_print("Got a match at index " + j + "!");
-          // Make it undefined so we don't process it again
-          matches[j] = undefined;
-          found = true;
-          break;
+    if (matches.length) {
+      let firstIndexToCheck = 0;
+      if (test.searchParam && test.searchParam.includes("enable-actions")) {
+        firstIndexToCheck = 1;
+        do_print("Checking first match is first autocomplete entry")
+        let result = {
+          value: controller.getValueAt(0),
+          comment: controller.getCommentAt(0),
+          style: controller.getStyleAt(0),
+          image: controller.getImageAt(0),
         }
+        do_print(`First match is "${result.value}", "${result.comment}"`);
+        Assert.ok(_check_autocomplete_matches(matches[0], result), "first item is correct");
+        do_print("Checking rest of the matches");
       }
 
-      if (!found)
-        do_throw(`Didn't find the current result ("${result.value}", "${result.comment}") in matches`); //' (Emacs syntax highlighting fix)
+      for (let i = firstIndexToCheck; i < controller.matchCount; i++) {
+        let result = {
+          value: controller.getValueAt(i),
+          comment: controller.getCommentAt(i),
+          style: controller.getStyleAt(i),
+          image: controller.getImageAt(i),
+        }
+        do_print(`Looking for "${result.value}", "${result.comment}" in expected results...`);
+        let lowerBound = test.checkSorting ? i : firstIndexToCheck;
+        let upperBound = test.checkSorting ? i + 1 : matches.length;
+        let found = false;
+        for (let j = lowerBound; j < upperBound; ++j) {
+          // Skip processed expected results
+          if (matches[j] == undefined)
+            continue;
+          if (_check_autocomplete_matches(matches[j], result)) {
+            do_print("Got a match at index " + j + "!");
+            // Make it undefined so we don't process it again
+            matches[j] = undefined;
+            found = true;
+            break;
+          }
+        }
+
+        if (!found)
+          do_throw(`Didn't find the current result ("${result.value}", "${result.comment}") in matches`); //' (Emacs syntax highlighting fix)
+      }
     }
 
     Assert.equal(controller.matchCount, matches.length,
                  "Got as many results as expected");
 
     // If we expect results, make sure we got matches.
     do_check_eq(controller.searchStatus, matches.length ?
                 Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH :
--- a/toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
@@ -47,50 +47,60 @@ add_task(function* setUp() {
   Services.search.currentEngine = engine;
 });
 
 add_task(function* disabled_urlbarSuggestions() {
   Services.prefs.setBoolPref(SUGGEST_PREF, false);
   Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
   yield check_autocomplete({
     search: "hello",
-    matches: [],
+    searchParam: "enable-actions",
+    matches: [
+      makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+    ],
   });
   yield cleanUpSuggestions();
 });
 
 add_task(function* disabled_allSuggestions() {
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
   Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, false);
   yield check_autocomplete({
     search: "hello",
-    matches: [],
+    searchParam: "enable-actions",
+    matches: [
+      makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+    ],
   });
   yield cleanUpSuggestions();
 });
 
 add_task(function* disabled_privateWindow() {
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
   Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
   yield check_autocomplete({
     search: "hello",
-    matches: [],
-    searchParam: "private-window",
+    searchParam: "private-window enable-actions",
+    matches: [
+      makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+    ],
   });
   yield cleanUpSuggestions();
 });
 
 add_task(function* singleWordQuery() {
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
   Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
 
   yield check_autocomplete({
     search: "hello",
-    matches: [{
-      uri: makeActionURI(("searchengine"), {
+    searchParam: "enable-actions",
+    matches: [
+      makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+      { uri: makeActionURI(("searchengine"), {
         engineName: ENGINE_NAME,
         input: "hello foo",
         searchQuery: "hello",
         searchSuggestion: "hello foo",
       }),
       title: ENGINE_NAME,
       style: ["action", "searchengine"],
       icon: "",
@@ -111,18 +121,20 @@ add_task(function* singleWordQuery() {
 });
 
 add_task(function* multiWordQuery() {
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
   Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
 
   yield check_autocomplete({
     search: "hello world",
-    matches: [{
-      uri: makeActionURI(("searchengine"), {
+    searchParam: "enable-actions",
+    matches: [
+      makeSearchMatch("hello world", { engineName: ENGINE_NAME, heuristic: true }),
+      { uri: makeActionURI(("searchengine"), {
         engineName: ENGINE_NAME,
         input: "hello world foo",
         searchQuery: "hello world",
         searchSuggestion: "hello world foo",
       }),
       title: ENGINE_NAME,
       style: ["action", "searchengine"],
       icon: "",
@@ -148,18 +160,20 @@ add_task(function* suffixMatch() {
 
   setSuggestionsFn(searchStr => {
     let prefixes = ["baz", "quux"];
     return prefixes.map(p => p + " " + searchStr);
   });
 
   yield check_autocomplete({
     search: "hello",
-    matches: [{
-      uri: makeActionURI(("searchengine"), {
+    searchParam: "enable-actions",
+    matches: [
+      makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+      { uri: makeActionURI(("searchengine"), {
         engineName: ENGINE_NAME,
         input: "baz hello",
         searchQuery: "hello",
         searchSuggestion: "baz hello",
       }),
       title: ENGINE_NAME,
       style: ["action", "searchengine"],
       icon: "",
@@ -183,18 +197,20 @@ add_task(function* queryIsNotASubstring(
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
 
   setSuggestionsFn(searchStr => {
     return ["aaa", "bbb"];
   });
 
   yield check_autocomplete({
     search: "hello",
-    matches: [{
-      uri: makeActionURI(("searchengine"), {
+    searchParam: "enable-actions",
+    matches: [
+      makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+      { uri: makeActionURI(("searchengine"), {
         engineName: ENGINE_NAME,
         input: "aaa",
         searchQuery: "hello",
         searchSuggestion: "aaa",
       }),
       title: ENGINE_NAME,
       style: ["action", "searchengine"],
       icon: "",
@@ -236,17 +252,19 @@ add_task(function* restrictToken() {
     uri: NetUtil.newURI("http://example.com/hello-bookmark"),
     title: "hello bookmark",
   });
 
   // Do an unrestricted search to make sure everything appears in it, including
   // the visit and bookmark.
   yield check_autocomplete({
     search: "hello",
+    searchParam: "enable-actions",
     matches: [
+      makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
       {
         uri: NetUtil.newURI("http://example.com/hello-visit"),
         title: "hello visit",
       },
       {
         uri: NetUtil.newURI("http://example.com/hello-bookmark"),
         title: "hello bookmark",
         style: ["bookmark"],
@@ -274,17 +292,20 @@ add_task(function* restrictToken() {
         icon: "",
       },
     ],
   });
 
   // Now do a restricted search to make sure only suggestions appear.
   yield check_autocomplete({
     search: SUGGEST_RESTRICT_TOKEN + " hello",
+    searchParam: "enable-actions",
     matches: [
+      // TODO (bug 1177895) This is wrong.
+      makeSearchMatch(SUGGEST_RESTRICT_TOKEN + " hello", { engineName: ENGINE_NAME, heuristic: true }),
       {
         uri: makeActionURI(("searchengine"), {
           engineName: ENGINE_NAME,
           input: "hello foo",
           searchQuery: "hello",
           searchSuggestion: "hello foo",
         }),
         title: ENGINE_NAME,
@@ -359,33 +380,33 @@ add_task(function* mixup_frecency() {
               `frecency for ${href}: ${frecency}, should be higher than ${FRECENCY_DEFAULT}`);
   }
 
   // Do an unrestricted search to make sure everything appears in it, including
   // the visit and bookmark.
   yield check_autocomplete({
     checkSorting: true,
     search: "frecency",
+    searchParam: "enable-actions",
     matches: [
+      makeSearchMatch("frecency", { engineName: ENGINE_NAME, heuristic: true }),
       { uri: NetUtil.newURI("http://example.com/hi3"),
         title: "high frecency 3",
         style: [ "bookmark" ] },
       { uri: NetUtil.newURI("http://example.com/hi2"),
         title: "high frecency 2",
         style: [ "bookmark" ] },
       { uri: NetUtil.newURI("http://example.com/hi1"),
         title: "high frecency 1",
         style: [ "bookmark" ] },
       { uri: NetUtil.newURI("http://example.com/hi0"),
         title: "high frecency 0",
         style: [ "bookmark" ] },
       { uri: NetUtil.newURI("http://example.com/lo4"),
         title: "low frecency 4" },
-      { uri: NetUtil.newURI("http://example.com/lo3"),
-        title: "low frecency 3" },
       {
         uri: makeActionURI(("searchengine"), {
           engineName: ENGINE_NAME,
           input: "frecency foo",
           searchQuery: "frecency",
           searchSuggestion: "frecency foo",
         }),
         title: ENGINE_NAME,
@@ -398,16 +419,18 @@ add_task(function* mixup_frecency() {
           input: "frecency bar",
           searchQuery: "frecency",
           searchSuggestion: "frecency bar",
         }),
         title: ENGINE_NAME,
         style: ["action", "searchengine"],
         icon: "",
       },
+      { uri: NetUtil.newURI("http://example.com/lo3"),
+        title: "low frecency 3" },
       { uri: NetUtil.newURI("http://example.com/lo2"),
         title: "low frecency 2" },
       { uri: NetUtil.newURI("http://example.com/lo1"),
         title: "low frecency 1" },
       { uri: NetUtil.newURI("http://example.com/lo0"),
         title: "low frecency 0" },
     ],
   });
@@ -415,17 +438,19 @@ add_task(function* mixup_frecency() {
   yield cleanUpSuggestions();
 });
 
 add_task(function* prohibit_suggestions() {
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
 
   yield check_autocomplete({
     search: "localhost",
+    searchParam: "enable-actions",
     matches: [
+      makeSearchMatch("localhost", { engineName: ENGINE_NAME, heuristic: true }),
       {
         uri: makeActionURI(("searchengine"), {
           engineName: ENGINE_NAME,
           input: "localhost foo",
           searchQuery: "localhost",
           searchSuggestion: "localhost foo",
         }),
         title: ENGINE_NAME,
@@ -446,59 +471,82 @@ add_task(function* prohibit_suggestions(
     ],
   });
   Services.prefs.setBoolPref("browser.fixup.domainwhitelist.localhost", true);
   do_register_cleanup(() => {
     Services.prefs.clearUserPref("browser.fixup.domainwhitelist.localhost");
   });
   yield check_autocomplete({
     search: "localhost",
-    matches: [],
+    searchParam: "enable-actions",
+    matches: [
+      makeVisitMatch("localhost", "http://localhost/", { heuristic: true }),
+    ],
   });
 
   yield check_autocomplete({
     search: "1.2.3.4",
-    matches: [],
+    searchParam: "enable-actions",
+    matches: [
+      makeVisitMatch("1.2.3.4", "http://1.2.3.4/", { heuristic: true }),
+    ],
   });
   yield check_autocomplete({
     search: "[2001::1]:30",
-    matches: [],
+    searchParam: "enable-actions",
+    matches: [
+      makeVisitMatch("[2001::1]:30", "http://[2001::1]:30/", { heuristic: true }),
+    ],
   });
   yield check_autocomplete({
     search: "user:pass@test",
-    matches: [],
+    searchParam: "enable-actions",
+    matches: [
+      makeSearchMatch("user:pass@test", { engineName: ENGINE_NAME, heuristic: true }),
+    ],
   });
   yield check_autocomplete({
     search: "test/test",
-    matches: [],
+    searchParam: "enable-actions",
+    matches: [
+      makeSearchMatch("test/test", { engineName: ENGINE_NAME, heuristic: true }),
+    ],
   });
   yield check_autocomplete({
     search: "data:text/plain,Content",
-    matches: [],
+    searchParam: "enable-actions",
+    matches: [
+      makeVisitMatch("data:text/plain,Content", "data:text/plain,Content", { heuristic: true }),
+    ],
   });
 
   yield check_autocomplete({
     search: "a",
-    matches: [],
+    searchParam: "enable-actions",
+    matches: [
+      makeSearchMatch("a", { engineName: ENGINE_NAME, heuristic: true }),
+    ],
   });
 
   yield cleanUpSuggestions();
 });
 
 add_task(function* avoid_url_suggestions() {
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
 
   setSuggestionsFn(searchStr => {
     let suffixes = [".com", "/test", ":1]", "@test", ". com"];
     return suffixes.map(s => searchStr + s);
   });
 
   yield check_autocomplete({
     search: "test",
+    searchParam: "enable-actions",
     matches: [
+      makeSearchMatch("test", { engineName: ENGINE_NAME, heuristic: true }),
       {
         uri: makeActionURI(("searchengine"), {
           engineName: ENGINE_NAME,
           input: "test. com",
           searchQuery: "test",
           searchSuggestion: "test. com",
         }),
         title: ENGINE_NAME,