Bug 1667470 - Enable tab-to-search on Nightly. r=adw
authorHarry Twyford <htwyford@mozilla.com>
Fri, 02 Oct 2020 07:01:46 +0000
changeset 551233 c25899d7b631470b983650ee254177381a62eaad
parent 551232 7522f85207c6e7919e70fb0f8a370340df61aca1
child 551234 a7713a786523f42caa8f5a2cad40b1fa460dbf37
child 551236 b684585c33b677e893b73b617249f0028d4b14bd
push id37827
push userapavel@mozilla.com
push dateFri, 02 Oct 2020 15:43:27 +0000
treeherdermozilla-central@c25899d7b631 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1667470
milestone83.0a1
first release with
nightly linux32
c25899d7b631 / 83.0a1 / 20201002154327 / files
nightly linux64
c25899d7b631 / 83.0a1 / 20201002154327 / files
nightly mac
c25899d7b631 / 83.0a1 / 20201002154327 / files
nightly win32
c25899d7b631 / 83.0a1 / 20201002154327 / files
nightly win64
c25899d7b631 / 83.0a1 / 20201002154327 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1667470 - Enable tab-to-search on Nightly. r=adw Tests are passing: https://treeherder.mozilla.org/#/jobs?repo=try&revision=2de70d799eb0d0f4a5ae3d2c0b76c96bc7a34bbd Differential Revision: https://phabricator.services.mozilla.com/D92156
browser/app/profile/firefox.js
browser/components/urlbar/tests/unit/test_search_engine_host.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -349,32 +349,33 @@ pref("browser.urlbar.update2.disableOneO
 pref("browser.urlbar.update2.localOneOffs", true);
 // Whether the urlbar one-offs act as search filters instead of executing a
 // search immediately.
 pref("browser.urlbar.update2.oneOffsRefresh", true);
 // Whether browsing history that is recognized as a previous search should
 // be restyled and deduped against form history. This only happens when
 // search mode is active.
 pref("browser.urlbar.update2.restyleBrowsingHistoryAsSearch", true);
+// Whether we display a tab-to-complete result when the user types an engine
+// name.
+pref("browser.urlbar.update2.tabToComplete", true);
 #else
 pref("browser.urlbar.update2", false);
 pref("browser.urlbar.update2.disableOneOffsHorizontalKeyNavigation", false);
 pref("browser.urlbar.update2.localOneOffs", false);
 pref("browser.urlbar.update2.oneOffsRefresh", false);
 pref("browser.urlbar.update2.restyleBrowsingHistoryAsSearch", false);
+pref("browser.urlbar.update2.tabToComplete", false);
 #endif
 
 // Controls the empty search behavior in Search Mode:
 //  0 - Show nothing
 //  1 - Show search history
 //  2 - Show search and browsing history
 pref("browser.urlbar.update2.emptySearchBehavior", 2);
-// Whether we display a tab-to-complete result when the user types an engine
-// name.
-pref("browser.urlbar.update2.tabToComplete", false);
 
 pref("browser.urlbar.eventTelemetry.enabled", false);
 
 // Controls when to DNS resolve single word search strings, after they were
 // searched for. If the string is resolved as a valid host, show a
 // "Did you mean to go to 'host'" prompt.
 // 0 - never resolve; 1 - use heuristics (default); 2 - always resolve
 pref("browser.urlbar.dnsResolveSingleWordsAfterSearch", 1);
--- a/browser/components/urlbar/tests/unit/test_search_engine_host.js
+++ b/browser/components/urlbar/tests/unit/test_search_engine_host.js
@@ -1,19 +1,21 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
+let engine;
+
 add_task(async function test_searchEngine_autoFill() {
   Services.prefs.setBoolPref("browser.urlbar.autoFill.searchEngines", true);
   Services.prefs.setBoolPref("browser.urlbar.suggest.searches", false);
   await Services.search.addEngineWithDetails("MySearchEngine", {
     method: "GET",
     template: "http://my.search.com/",
   });
-  let engine = Services.search.getEngineByName("MySearchEngine");
+  engine = Services.search.getEngineByName("MySearchEngine");
   registerCleanupFunction(async () => {
     Services.prefs.clearUserPref("browser.urlbar.autoFill.searchEngines");
     Services.prefs.clearUserPref("browser.urlbar.suggest.searches");
     Services.search.removeEngine(engine);
   });
 
   // Add an uri that matches the search string with high frecency.
   let uri = Services.io.newURI("http://www.example.com/my/");
@@ -46,16 +48,18 @@ add_task(async function test_searchEngin
       }),
     ],
   });
 
   await cleanupPlaces();
 });
 
 add_task(async function test_searchEngine_noautoFill() {
+  Services.prefs.setBoolPref("browser.urlbar.update2", true);
+  Services.prefs.setBoolPref("browser.urlbar.update2.tabToComplete", true);
   await PlacesTestUtils.addVisits(
     Services.io.newURI("http://my.search.com/samplepage/")
   );
 
   info("Check search domain is not autoFilled if it matches a visited domain");
   let context = createContext("my", { isPrivate: false });
   await check_results({
     context,
@@ -63,18 +67,27 @@ add_task(async function test_searchEngin
     completed: "http://my.search.com/",
     matches: [
       // Note this result is a normal Autofill result and not a priority engine.
       makeVisitResult(context, {
         uri: "http://my.search.com/",
         title: "my.search.com",
         heuristic: true,
       }),
+      makeSearchResult(context, {
+        engineName: engine.name,
+        uri: engine.getResultDomain(),
+        keywordOffer: UrlbarUtils.KEYWORD_OFFER.SHOW,
+        query: "",
+        providerName: "TabToSearch",
+      }),
       makeVisitResult(context, {
         uri: "http://my.search.com/samplepage/",
         title: "test visit for http://my.search.com/samplepage/",
         providerName: "UnifiedComplete",
       }),
     ],
   });
 
   await cleanupPlaces();
+  Services.prefs.clearUserPref("browser.urlbar.update2.tabToComplete");
+  Services.prefs.clearUserPref("browser.urlbar.update2");
 });