Bug 1548639 - Fix handling of 'startsWith' checks for the search engine configuration tests. r=daleharvey
authorMark Banner <standard8@mozilla.com>
Tue, 07 May 2019 16:40:29 +0000
changeset 531739 d59bc9316e781b0620f534692a5e104578f87157
parent 531738 796149a6d1b6e28ca83307dc6ad10f8882c3ca67
child 531740 90e7019e0fa8e062f4b887d2802e203e4bd39300
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaleharvey
bugs1548639
milestone68.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 1548639 - Fix handling of 'startsWith' checks for the search engine configuration tests. r=daleharvey Depends on D28856 Differential Revision: https://phabricator.services.mozilla.com/D29808
toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js
toolkit/components/search/tests/xpcshell/searchconfigs/test_bing.js
toolkit/components/search/tests/xpcshell/searchconfigs/test_google.js
toolkit/components/search/tests/xpcshell/searchconfigs/test_yandex.js
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js
@@ -164,17 +164,17 @@ class SearchConfigTest {
    *   True if the locale matches.
    */
   _localeIncludes(locales, locale) {
     if ("matches" in locales &&
         locales.matches.includes(locale)) {
       return true;
     }
     if ("startsWith" in locales) {
-      return locales.startsWith.find(element => element.startsWith(locale));
+      return !!locales.startsWith.find(element => locale.startsWith(element));
     }
 
     return false;
   }
 
   /**
    * Determines if a locale/region pair match a section of the configuration.
    *
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_bing.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_bing.js
@@ -13,27 +13,27 @@ const test = new SearchConfigTest({
       // regions: [
         // These arent currently enforced.
         // "au", "at", "be", "br", "ca", "fi", "fr", "de",
         // "in", "ie", "it", "jp", "my", "mx", "nl", "nz",
         // "no", "sg", "es", "se", "ch", "gb", "us",
       // ],
       locales: {
         matches: [
-          "ach", "af", "an", "ar", "ast", "az", "bn", "bn-BD",
-          "bn-ID", "ca", "cak", "da", "de", "dsb", "el", "en-CA",
-          "en-GB", "en-US", "en-ZA", "eo", "es-CL", "es-ES",
+          "ach", "af", "an", "ar", "ast", "az", "ca", "cak", "da", "de",
+          "dsb", "el", "eo", "es-CL", "es-ES",
           "es-MX", "eu", "fa", "ff", "fi", "fr", "fy-NL", "gn",
           "gu-IN", "hi-IN", "hr", "hsb", "ia", "is", "it",
           "ja-JP-mac", "ja", "ka", "kab", "km", "kn", "lij", "lo",
           "lt", "mai", "mk", "ml", "ms", "my", "nb-NO", "ne-NP", "nl",
           "nn-NO", "oc", "or", "pa-IN", "pt-BR", "rm", "ro", "son",
           "sq", "sr", "sv-SE", "th", "tl", "trs", "uk", "ur", "uz",
           "wo", "xh", "zh-CN",
         ],
+        startsWith: ["bn", "en"],
       },
     }],
   },
 });
 
 add_task(async function setup() {
   await test.setup();
 });
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_google.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_google.js
@@ -9,17 +9,18 @@ const test = new SearchConfigTest({
     // Included everywhere apart from the exclusions below. These are basically
     // just excluding what Yandex and Baidu include.
     excluded: [{
       regions: [
         "ru", "tr", "by", "kz",
       ],
       locales: {
         matches: ["ru", "tr", "be", "kk"],
-        startsWith: ["en"],
+        // We don't currently enforce this.
+        // startsWith: ["en"],
       },
     }, {
       regions: ["cn"],
       locales: {
         matches: ["zh-CN"],
       },
     }],
   },
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_yandex.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_yandex.js
@@ -7,17 +7,18 @@ const test = new SearchConfigTest({
   identifier: "yandex",
   default: {
     included: [{
       regions: [
         "ru", "tr", "by", "kz",
       ],
       locales: {
         matches: ["ru", "tr", "be", "kk"],
-        startsWith: ["en"],
+        // We don't currently enforce this.
+        // startsWith: ["en"],
       },
     }],
   },
   available: {
     included: [{
       locales: {
         matches: ["az", "ru", "be", "kk", "tr"],
       },