Bug 1532761 - Add regionOverrides engine to jarNames. r=daleharvey,adw
authorMichael Kaply <mozilla@kaply.com>
Sat, 09 Mar 2019 07:57:06 +0000
changeset 521263 c7d8b2c0ada2332e724fc8940d6fb2f38cfc63e0
parent 521262 070e1065af52d1a8ea91a7939a4c6e9263228156
child 521264 654492de5212c9ee50796d77c62287b0db26424d
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaleharvey, adw
bugs1532761
milestone67.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 1532761 - Add regionOverrides engine to jarNames. r=daleharvey,adw Differential Revision: https://phabricator.services.mozilla.com/D22181
toolkit/components/search/SearchService.jsm
--- a/toolkit/components/search/SearchService.jsm
+++ b/toolkit/components/search/SearchService.jsm
@@ -3234,16 +3234,18 @@ SearchService.prototype = {
     try {
       json = JSON.parse(list);
     } catch (e) {
       Cu.reportError("parseListJSON: Failed to parse list.json: " + e);
       dump("parseListJSON: Failed to parse list.json: " + e + "\n");
       return;
     }
 
+    let searchRegion = Services.prefs.getCharPref("browser.search.region", null);
+
     let searchSettings;
     let locale = Services.locale.appLocaleAsBCP47;
     if ("locales" in json &&
         locale in json.locales) {
       searchSettings = json.locales[locale];
     } else {
       // No locales were found, so use the JSON as is.
       // It should have a default section.
@@ -3266,16 +3268,22 @@ SearchService.prototype = {
         // Artifact builds use the full list.json which parses
         // slightly differently
         if (!("visibleDefaultEngines" in searchSettings[region])) {
           continue;
         }
         for (let engine of searchSettings[region].visibleDefaultEngines) {
           jarNames.add(engine);
         }
+        if ("regionOverrides" in json &&
+            searchRegion in json.regionOverrides) {
+          for (let engine in json.regionOverrides[searchRegion]) {
+            jarNames.add(json.regionOverrides[searchRegion][engine]);
+          }
+        }
       }
 
       engineNames = visibleDefaultEngines.split(",");
       // absearch can't be modified to use the new engine names.
       // Convert them here.
       engineNames = convertGoogleEngines(engineNames);
 
       for (let engineName of engineNames) {
@@ -3289,21 +3297,16 @@ SearchService.prototype = {
           LOG("_parseListJSON: ignoring visibleDefaultEngines value because " +
               engineName + " is not in the jar engines we have found");
           engineNames = null;
           break;
         }
       }
     }
 
-    let searchRegion;
-    if (Services.prefs.prefHasUserValue("browser.search.region")) {
-      searchRegion = Services.prefs.getCharPref("browser.search.region");
-    }
-
     // Fallback to building a list based on the regions in the JSON
     if (!engineNames || !engineNames.length) {
       if (searchRegion && searchRegion in searchSettings &&
           "visibleDefaultEngines" in searchSettings[searchRegion]) {
         engineNames = searchSettings[searchRegion].visibleDefaultEngines;
       } else {
         engineNames = searchSettings.default.visibleDefaultEngines;
       }