Bug 1603393 - Perma failure in test_UrlbarQueryContext_restrictSource.js when merging to beta. r=Standard8
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 13 Dec 2019 15:27:56 +0000
changeset 506920 bcb4ec274c077d72f32f8b1781cde3e489436303
parent 506919 c836766f6842cad238bd43b931ca52f006f6a8f4
child 506921 8590ed6875bed721318fb8223e00933cf822b3ee
push id36915
push userrgurzau@mozilla.com
push dateFri, 13 Dec 2019 21:43:22 +0000
treeherdermozilla-central@f09f24f2b545 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1603393
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1603393 - Perma failure in test_UrlbarQueryContext_restrictSource.js when merging to beta. r=Standard8 Differential Revision: https://phabricator.services.mozilla.com/D56953
browser/components/urlbar/tests/unit/head.js
browser/components/urlbar/tests/unit/test_UrlbarQueryContext_restrictSource.js
toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
toolkit/components/places/tests/unifiedcomplete/test_search_suggestions.js
--- a/browser/components/urlbar/tests/unit/head.js
+++ b/browser/components/urlbar/tests/unit/head.js
@@ -175,16 +175,23 @@ function makeTestServer(port = -1) {
  * @returns {Promise} Resolved once the addition is complete.
  */
 async function addTestEngine(basename, httpServer = undefined) {
   httpServer = httpServer || makeTestServer();
   httpServer.registerDirectory("/", do_get_cwd());
   let dataUrl =
     "http://localhost:" + httpServer.identity.primaryPort + "/data/";
 
+  // Before initializing the search service, set the geo IP url pref to a dummy
+  // string.  When the search service is initialized, it contacts the URI named
+  // in this pref, causing unnecessary error logs.
+  let geoPref = "browser.search.geoip.url";
+  Services.prefs.setCharPref(geoPref, "");
+  registerCleanupFunction(() => Services.prefs.clearUserPref(geoPref));
+
   info("Adding engine: " + basename);
   return new Promise(resolve => {
     Services.obs.addObserver(function obs(subject, topic, data) {
       let engine = subject.QueryInterface(Ci.nsISearchEngine);
       info("Observed " + data + " for " + engine.name);
       if (data != "engine-added" || engine.name != basename) {
         return;
       }
--- a/browser/components/urlbar/tests/unit/test_UrlbarQueryContext_restrictSource.js
+++ b/browser/components/urlbar/tests/unit/test_UrlbarQueryContext_restrictSource.js
@@ -2,17 +2,16 @@
  * 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/. */
 
 /**
  * Test for restrictions set through UrlbarQueryContext.sources.
  */
 
 add_task(async function setup() {
-  Services.prefs.setBoolPref("browser.urlbar.geoSpecificDefaults", false);
   let engine = await addTestSuggestionsEngine();
   let oldDefaultEngine = await Services.search.getDefault();
   Services.search.setDefault(engine);
   registerCleanupFunction(async () =>
     Services.search.setDefault(oldDefaultEngine)
   );
 });
 
@@ -64,20 +63,19 @@ add_task(async function test_restriction
     "http://openpagematch.com/",
   ]);
 
   info("search restrict");
   results = await get_results({
     sources: [UrlbarUtils.RESULT_SOURCE.SEARCH],
     searchString: "match",
   });
-  // Heuristic, private window, 2 suggestions.
-  Assert.deepEqual(
-    results.map(r => r.payload.engine),
-    new Array(4).fill("engine-suggestions.xml")
+  Assert.ok(
+    !results.some(r => r.payload.engine != "engine-suggestions.xml"),
+    "All the results should be search results"
   );
 });
 
 async function get_results(test) {
   let controller = UrlbarTestUtils.newMockController();
   let queryContext = createContext(test.searchString, {
     allowAutofill: false,
     isPrivate: false,
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -586,20 +586,19 @@ async function addTestSuggestionsEngine(
 }
 
 // Ensure we have a default search engine and the keyword.enabled preference
 // set.
 add_task(async function ensure_search_engine() {
   // keyword.enabled is necessary for the tests to see keyword searches.
   Services.prefs.setBoolPref("keyword.enabled", true);
 
-  // Initialize the search service, but first set this geo IP pref to a dummy
+  // Before initializing the search service, set the geo IP url pref to a dummy
   // string.  When the search service is initialized, it contacts the URI named
-  // in this pref, which breaks the test since outside connections aren't
-  // allowed.
+  // in this pref, causing unnecessary error logs.
   let geoPref = "browser.search.geoip.url";
   Services.prefs.setCharPref(geoPref, "");
   registerCleanupFunction(() => Services.prefs.clearUserPref(geoPref));
   // Remove any existing engines before adding ours.
   for (let engine of await Services.search.getEngines()) {
     await Services.search.removeEngine(engine);
   }
   await Services.search.addEngineWithDetails("MozSearch", {
--- a/toolkit/components/places/tests/unifiedcomplete/test_search_suggestions.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_search_suggestions.js
@@ -25,17 +25,16 @@ async function cleanUpSuggestions() {
   }
 }
 
 add_task(async function setup() {
   Services.prefs.setCharPref(
     "browser.urlbar.matchBuckets",
     "general:5,suggestion:Infinity"
   );
-  Services.prefs.setBoolPref("browser.urlbar.geoSpecificDefaults", false);
 
   let engine = await addTestSuggestionsEngine(searchStr => {
     return suggestionsFn(searchStr);
   });
   setSuggestionsFn(searchStr => {
     let suffixes = ["foo", "bar"];
     return [searchStr].concat(suffixes.map(s => searchStr + " " + s));
   });