Backed out 2 changesets (bug 1541419) for frequent xpcshell failures e.g. test_duckduckgo.js. CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Fri, 10 May 2019 18:55:08 +0300
changeset 535297 44db460adb2b732a8444e0f35c968bd828313e12
parent 535296 2c7be26078fe281ecfe9ad2d10e31a9b42a55fec
child 535298 6166be9aa8666ffcf128bec8f30ecaa165b1ce9a
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1541419
milestone68.0a1
backs oute661822f67309406c695209d4be605ff281a2777
3d13d2cb56d1f1ed2f09dbc630f206f76f2aa368
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
Backed out 2 changesets (bug 1541419) for frequent xpcshell failures e.g. test_duckduckgo.js. CLOSED TREE Backed out changeset e661822f6730 (bug 1541419) Backed out changeset 3d13d2cb56d1 (bug 1541419)
browser/components/search/extensions/ebay/_locales/be/messages.json
toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js
toolkit/components/search/tests/xpcshell/searchconfigs/test_amazon.js
toolkit/components/search/tests/xpcshell/searchconfigs/test_baidu.js
toolkit/components/search/tests/xpcshell/searchconfigs/test_bing.js
toolkit/components/search/tests/xpcshell/searchconfigs/test_duckduckgo.js
toolkit/components/search/tests/xpcshell/searchconfigs/test_ebay.js
toolkit/components/search/tests/xpcshell/searchconfigs/test_google.js
toolkit/components/search/tests/xpcshell/searchconfigs/test_yandex.js
--- a/browser/components/search/extensions/ebay/_locales/be/messages.json
+++ b/browser/components/search/extensions/ebay/_locales/be/messages.json
@@ -4,14 +4,14 @@
   },
   "extensionDescription": {
     "message": "eBay - Online auctions"
   },
   "searchUrl": {
     "message": "https://rover.ebay.com/rover/1/1553-53471-19255-0/1"
   },
   "searchForm": {
-    "message": "https://www.befr.ebay.be/"
+    "message": "https://www.ebay.at/"
   },
   "searchUrlGetParams": {
     "message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.befr.ebay.be/sch/{searchTerms}"
   }
-}
+}
\ No newline at end of file
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js
@@ -8,19 +8,16 @@ XPCOMUtils.defineLazyModuleGetters(this,
   AddonTestUtils: "resource://testing-common/AddonTestUtils.jsm",
   OS: "resource://gre/modules/osfile.jsm",
   SearchTestUtils: "resource://testing-common/SearchTestUtils.jsm",
   Services: "resource://gre/modules/Services.jsm",
 });
 
 const GLOBAL_SCOPE = this;
 
-const URLTYPE_SUGGEST_JSON = "application/x-suggestions+json";
-const URLTYPE_SEARCH_HTML  = "text/html";
-
 /**
  * This class implements the test harness for search configuration tests.
  * These tests are designed to ensure that the correct search engines are
  * loaded for the various region/locale configurations.
  *
  * The configuration for each test is represented by an object having the
  * following properties:
  *
@@ -99,21 +96,17 @@ class SearchConfigTest {
     // We loop on region and then locale, so that we always cause a re-init
     // when updating the requested/available locales.
     for (let region of regions) {
       for (let locale of locales) {
         info(`Checking region: "${region}" locale: "${locale}"`);
         await this._reinit(region, locale);
 
         this._assertDefaultEngines(region, locale);
-        const engines = await Services.search.getVisibleEngines();
-        const isPresent = this._assertAvailableEngines(region, locale, engines);
-        if (isPresent) {
-          this._assertCorrectDomains(region, locale, engines);
-        }
+        await this._assertAvailableEngines(region, locale);
       }
     }
 
     Assert.ok(!this._testDebug, "Should not have test debug turned on in production");
   }
 
   /**
    * Causes re-initialization of the SearchService with the new region and locale.
@@ -203,146 +196,96 @@ class SearchConfigTest {
       if (inRegions && inLocales) {
         return true;
       }
     }
     return false;
   }
 
   /**
-   * Helper function to find an engine from within a list.
+   * Helper function to determine if an engine matches within a list.
    * Due to Amazon's current complex setup with three different identifiers,
    * if the identifier is 'amazon', then we do a startsWith match. Otherwise
    * we expect the names to equal.
    *
    * @param {Array} engines
    *   The list of engines to check.
    * @param {string} identifier
    *   The identifier to look for in the list.
-   * @returns {Engine}
-   *   Returns the engine if found, null otherwise.
+   * @returns {boolean}
+   *   Returns true if the engine is found within the list.
    */
-  _findEngine(engines, identifier) {
+  _enginesMatch(engines, identifier) {
     if (identifier == "amazon") {
-      return engines.find(engine => engine.identifier.startsWith(identifier));
+      return !!engines.find(engine => engine.startsWith(identifier));
     }
-    return engines.find(engine => engine.identifier == identifier);
+    return engines.includes(identifier);
   }
 
   /**
    * Asserts whether the engines rules defined in the configuration are met.
    *
    * @param {Array} engines
    *   The list of engines to check.
    * @param {string} region
    *   The two-letter region code.
    * @param {string} locale
    *   The two-letter locale code.
    * @param {string} section
    *   The section of the configuration to check.
-   * @returns {boolean}
-   *   Returns true if the engine is expected to be present, false otherwise.
    */
   _assertEngineRules(engines, region, locale, section) {
     const infoString = `region: "${region}" locale: "${locale}"`;
     const config = this._config[section];
     const hasIncluded = "included" in config;
     const hasExcluded = "excluded" in config;
-    const identifierIncluded = !!this._findEngine(engines, this._config.identifier);
+    const identifierIncluded = this._enginesMatch(engines, this._config.identifier);
 
     // If there's not included/excluded, then this shouldn't be the default anywhere.
     if (section == "default" && !hasIncluded && !hasExcluded) {
       Assert.ok(!identifierIncluded,
         `Should not be ${section} for any locale/region,
          currently set for ${infoString}`);
-      return false;
+      return;
     }
 
     // If there's no included section, we assume the engine is default everywhere
     // and we should apply the exclusions instead.
     let included = (hasIncluded &&
       this._localeRegionInSection(config.included, region, locale));
 
     let notExcluded = (hasExcluded &&
      !this._localeRegionInSection(config.excluded, region, locale));
 
     if (included || notExcluded) {
       Assert.ok(identifierIncluded, `Should be ${section} for ${infoString}`);
-      return true;
+      return;
     }
     Assert.ok(!identifierIncluded, `Should not be ${section} for ${infoString}`);
-    return false;
   }
 
   /**
    * Asserts whether the engine is correctly set as default or not.
    *
    * @param {string} region
    *   The two-letter region code.
    * @param {string} locale
    *   The two-letter locale code.
    */
   _assertDefaultEngines(region, locale) {
-    this._assertEngineRules([Services.search.originalDefaultEngine], region,
-                            locale, "default");
+    const identifier = Services.search.originalDefaultEngine.identifier;
+    this._assertEngineRules([identifier], region, locale, "default");
   }
 
   /**
    * Asserts whether the engine is correctly available or not.
    *
    * @param {string} region
    *   The two-letter region code.
    * @param {string} locale
    *   The two-letter locale code.
-   * @param {array} engines
-   *   The current visible engines.
-   * @returns {boolean}
-   *   Returns true if the engine is expected to be present, false otherwise.
    */
-  _assertAvailableEngines(region, locale, engines) {
-    return this._assertEngineRules(engines, region, locale, "available");
-  }
-
-  /**
-   * Asserts whether the engine is using the correct domains or not.
-   *
-   * @param {string} region
-   *   The two-letter region code.
-   * @param {string} locale
-   *   The two-letter locale code.
-   * @param {array} engines
-   *   The current visible engines.
-   */
-  _assertCorrectDomains(region, locale, engines) {
-    const [expectedDomain, domainConfig] =
-      Object.entries(this._config.domains).find(([key, value]) =>
-        this._localeRegionInSection(value.included, region, locale));
-
-    Assert.ok(expectedDomain,
-      `Should have an expectedDomain for the engine in region: "${region}" locale: "${locale}"`);
-
-    const engine = this._findEngine(engines, this._config.identifier);
-    Assert.ok(engine, "Should have an engine present");
-
-    const searchForm = new URL(engine.searchForm);
-    Assert.ok(searchForm.host.endsWith(expectedDomain),
-      `Should have the correct search form domain for region: "${region}" locale: "${locale}".
-       Got "${searchForm.host}", expected to end with "${expectedDomain}".`);
-
-    for (const urlType of [URLTYPE_SUGGEST_JSON, URLTYPE_SEARCH_HTML]) {
-      info(`Checking urlType ${urlType}`);
-
-      const submission = engine.getSubmission("test", urlType);
-      if (urlType == URLTYPE_SUGGEST_JSON &&
-          (this._config.noSuggestionsURL || domainConfig.noSuggestionsURL)) {
-        Assert.ok(!submission, "Should not have a submission url");
-      } else if (this._config.searchUrlBase) {
-          Assert.equal(submission.uri.prePath + submission.uri.filePath,
-            this._config.searchUrlBase + domainConfig.searchUrlEnd,
-            `Should have the correct domain for region: "${region}" locale: "${locale}".`);
-      } else {
-        Assert.ok(submission.uri.host.endsWith(expectedDomain),
-          `Should have the correct domain for region: "${region}" locale: "${locale}".
-           Got "${submission.uri.host}", expected to end with "${expectedDomain}".`);
-      }
-    }
+  async _assertAvailableEngines(region, locale) {
+    const engines = await Services.search.getVisibleEngines();
+    const engineNames = engines.map(engine => engine._shortName);
+    this._assertEngineRules(engineNames, region, locale, "available");
   }
 }
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_amazon.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_amazon.js
@@ -24,157 +24,16 @@ const test = new SearchConfigTest({
           "ml", "mr", "ms", "my", "nb-NO", "nn-NO", "or", "pa-IN", "pt-PT", "ro",
           "si", "son", "sq", "sr", "ta", "te", "th", "tl", "trs", "ur", "uz",
           "wo", "zh-CN",
         ],
         startsWith: ["en"],
       },
     }],
   },
-  domains: {
-    // Note: These should be based on region, but we don't currently enforce that.
-    // Note: the order here is important. A region/locale match higher up in the
-    // list will override a region/locale match lower down.
-    "amazon.com.au": {
-      included: [{
-        regions: ["au"],
-        locales: {
-          matches: [
-            "ach", "af", "ar", "as", "az", "bg", "bn-IN", "cak", "eo", "en-US",
-            "en-ZA", "es-AR", "fa", "gn", "hy-AM", "ia", "is", "ka", "km", "lt",
-            "mk", "ms", "my", "ro", "si", "th", "tl", "trs", "uz",
-          ],
-        },
-      }, {
-        regions: ["au"],
-        locales: {
-          matches: [
-            "cy", "da", "el", "en-GB", "eu", "ga-IE", "gd", "gl", "hr", "nb-NO",
-            "nn-NO", "pt-PT", "sq", "sr",
-          ],
-        },
-      }],
-      noSuggestionsURL: true,
-    },
-    "amazon.ca": {
-      included: [{
-        locales: {
-          matches: ["ca", "en-CA"],
-        },
-      }, {
-        regions: ["ca"],
-        locales: {
-          matches: [
-            "ach", "af", "ar", "as", "az", "bg", "bn-IN", "cak", "eo", "en-US",
-            "en-ZA", "es-AR", "fa", "gn", "hy-AM", "ia", "is", "ka", "km", "lt",
-            "mk", "ms", "my", "ro", "si", "th", "tl", "trs", "uz",
-          ],
-        },
-      }, {
-        regions: ["ca"],
-        locales: {
-          matches: [
-            "br", "fr", "ff", "son", "wo",
-          ],
-        },
-      }],
-      noSuggestionsURL: true,
-    },
-    "amazon.fr": {
-      included: [{
-        locales: {
-          matches: ["br", "fr", "ff", "son", "wo"],
-        },
-      }, {
-        regions: ["fr"],
-        locales: {
-          matches: [
-            "ach", "af", "ar", "as", "az", "bg", "bn-IN", "cak", "eo", "en-US",
-            "en-ZA", "es-AR", "fa", "gn", "hy-AM", "ia", "is", "ka", "km", "lt",
-            "mk", "ms", "my", "ro", "si", "th", "tl", "trs", "uz",
-          ],
-        },
-      }],
-      noSuggestionsURL: true,
-    },
-    "amazon.co.uk": {
-      included: [{
-        locales: {
-          matches: [
-            "cy", "da", "el", "en-GB", "eu", "ga-IE", "gd", "gl", "hr", "nb-NO",
-            "nn-NO", "pt-PT", "sq", "sr",
-          ],
-        },
-      }, {
-        regions: ["gb"],
-        locales: {
-          matches: [
-            "ach", "af", "ar", "as", "az", "bg", "bn-IN", "cak", "eo", "en-US",
-            "en-ZA", "es-AR", "fa", "gn", "hy-AM", "ia", "is", "ka", "km", "lt",
-            "mk", "ms", "my", "ro", "si", "th", "tl", "trs", "uz",
-          ],
-        },
-      }],
-      noSuggestionsURL: true,
-    },
-    "amazon.com": {
-      included: [{
-        locales: {
-          matches: [
-            "ach", "af", "ar", "as", "az", "bg", "bn-IN", "cak", "eo", "en-US",
-            "en-ZA", "es-AR", "fa", "gn", "hy-AM", "ia", "is", "ka", "km", "lt",
-            "mk", "ms", "my", "ro", "si", "th", "tl", "trs", "uz",
-          ],
-        },
-      }],
-    },
-    "amazon.cn": {
-      included: [{
-        locales: {
-          matches: ["zh-CN"],
-        },
-      }],
-      noSuggestionsURL: true,
-    },
-    "amazon.co.jp": {
-      included: [{
-        locales: {
-          startsWith: ["ja"],
-        },
-      }],
-      noSuggestionsURL: true,
-    },
-    "amazon.de": {
-      included: [{
-        locales: {
-          matches: ["de", "dsb", "hsb"],
-        },
-      }],
-      noSuggestionsURL: true,
-    },
-    "amazon.in": {
-      included: [{
-        locales: {
-          matches: [
-            "bn", "gu-IN", "kn", "mai", "ml", "mr", "or", "pa-IN", "ta",
-            "te", "ur",
-          ],
-        },
-      }],
-      noSuggestionsURL: true,
-    },
-    "amazon.it": {
-      included: [{
-        locales: {
-          matches: ["it", "lij"],
-        },
-      }],
-      noSuggestionsURL: true,
-    },
-  },
 });
 
 add_task(async function setup() {
   // We only need to do setup on one of the tests.
   await test.setup();
 });
 
 add_task(async function test_searchConfig_amazon() {
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_baidu.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_baidu.js
@@ -17,21 +17,16 @@ const test = new SearchConfigTest({
   },
   available: {
     included: [{
       locales: {
         matches: ["zh-CN"],
       },
     }],
   },
-  domains: {
-    "baidu.com": {
-      included: [{}],
-    },
-  },
 });
 
 add_task(async function setup() {
   await test.setup();
 });
 
 add_task(async function test_searchConfig_baidu() {
   await test.run();
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_bing.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_bing.js
@@ -27,21 +27,16 @@ const test = new SearchConfigTest({
           "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"],
       },
     }],
   },
-  domains: {
-    "bing.com": {
-      included: [{}],
-    },
-  },
 });
 
 add_task(async function setup() {
   await test.setup();
 });
 
 add_task(async function test_searchConfig_bing() {
   await test.run();
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_duckduckgo.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_duckduckgo.js
@@ -8,21 +8,16 @@ const test = new SearchConfigTest({
   default: {
     // Not included anywhere.
   },
   available: {
     excluded: [
       // Should be available everywhere.
     ],
   },
-  domains: {
-    "duckduckgo.com": {
-      included: [{}],
-    },
-  },
 });
 
 add_task(async function setup() {
   await test.setup();
 });
 
 add_task(async function test_searchConfig_duckduckgo() {
   await test.run();
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_ebay.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_ebay.js
@@ -14,113 +14,16 @@ const test = new SearchConfigTest({
       // regions: [
       //   "us", "gb", "ca", "ie", "fr", "it", "de", "at", "es", "nl", "ch", "au"
       // ],
       locales: {
         matches: ["an", "en-US", "ast", "br", "ca", "cy", "de", "dsb", "en-CA", "en-GB", "es-ES", "eu", "fr", "fy-NL", "ga-IE", "gd", "gl", "hsb", "it", "lij", "nl", "rm", "wo"],
       },
     }],
   },
-  searchUrlBase: "https://rover.ebay.com/rover/1/",
-  domains: {
-    // Note: These should be based on region, but we don't currently enforce that.
-    // Note: the order here is important. A region/locale match higher up in the
-    // list will override a region/locale match lower down.
-    "befr.ebay.be": {
-      included: [{
-        regions: ["be"],
-        locales: { matches: ["br", "fr", "fy-NL", "nl", "wo"]},
-      }],
-      searchUrlEnd: "1553-53471-19255-0/1",
-    },
-    "ebay.at": {
-      included: [{
-        regions: ["at"],
-        locales: { matches: ["de", "dsb", "hsb"]},
-      }],
-      searchUrlEnd: "5221-53469-19255-0/1",
-    },
-    "ebay.ca": {
-      included: [{
-        locales: { matches: ["en-CA"] },
-      }, {
-        regions: ["ca"],
-        locales: { matches: ["br", "fr", "wo"]},
-      }],
-      searchUrlEnd: "706-53473-19255-0/1",
-    },
-    "ebay.ch": {
-      included: [{
-        locales: { matches: ["rm"] },
-      }, {
-        regions: ["ch"],
-        locales: { matches: ["br", "de", "dsb", "fr", "hsb", "wo"]},
-      }],
-      searchUrlEnd: "5222-53480-19255-0/1",
-    },
-    "ebay.com": {
-      included: [{
-        locales: { matches: ["en-US"] },
-      }],
-      searchUrlEnd: "711-53200-19255-0/1",
-    },
-    "ebay.com.au": {
-      included: [{
-        regions: ["au"],
-        locales: { matches: ["cy", "en-GB", "gd"]},
-      }],
-      searchUrlEnd: "705-53470-19255-0/1",
-    },
-    "ebay.ie": {
-      included: [{
-        locales: { matches: ["ga-IE", "ie"] },
-      }, {
-        regions: ["ie"],
-        locales: { matches: ["cy", "en-GB", "gd"]},
-      }],
-      searchUrlEnd: "5282-53468-19255-0/1",
-    },
-    "ebay.co.uk": {
-      included: [{
-        locales: { matches: ["cy", "en-GB", "gd"] },
-      }],
-      searchUrlEnd: "710-53481-19255-0/1",
-    },
-    "ebay.de": {
-      included: [{
-        locales: { matches: ["de", "dsb", "hsb"] },
-      }],
-      searchUrlEnd: "707-53477-19255-0/1",
-    },
-    "ebay.es": {
-      included: [{
-        locales: { matches: ["an", "ast", "ca", "es-ES", "eu", "gl"] },
-      }],
-      searchUrlEnd: "1185-53479-19255-0/1",
-    },
-    "ebay.fr": {
-      included: [{
-        locales: { matches: ["br", "fr", "wo"] },
-      }],
-      searchUrlEnd: "709-53476-19255-0/1",
-    },
-    "ebay.it": {
-      included: [{
-        locales: { matches: ["it", "lij"] },
-      }],
-      searchUrlEnd: "724-53478-19255-0/1",
-    },
-    "ebay.nl": {
-      included: [{
-        locales: { matches: ["fy-NL", "nl"] },
-      }],
-      searchUrlEnd: "1346-53482-19255-0/1",
-    },
-  },
-  noSuggestionsURL: true,
 });
 
 add_task(async function setup() {
   await test.setup();
 });
 
 add_task(async function test_searchConfig_ebay() {
   await test.run();
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_google.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_google.js
@@ -24,21 +24,16 @@ const test = new SearchConfigTest({
       },
     }],
   },
   available: {
     excluded: [
       // Should be available everywhere.
     ],
   },
-  domains: {
-    "google.com": {
-      included: [{}],
-    },
-  },
 });
 
 add_task(async function setup() {
   await test.setup();
 });
 
 add_task(async function test_searchConfig_google() {
   await test.run();
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_yandex.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_yandex.js
@@ -19,48 +19,16 @@ const test = new SearchConfigTest({
   },
   available: {
     included: [{
       locales: {
         matches: ["az", "ru", "be", "kk", "tr"],
       },
     }],
   },
-  domains: {
-    "yandex.az": {
-      included: [{
-        locales: { matches: ["az"] },
-      }],
-    },
-    "yandex.com": {
-      included: [{
-        locales: { startsWith: ["en"] },
-      }],
-    },
-    "yandex.ru": {
-      included: [{
-        locales: { matches: ["ru"] },
-      }],
-    },
-    "yandex.by": {
-      included: [{
-        locales: { matches: ["be"] },
-      }],
-    },
-    "yandex.kz": {
-      included: [{
-        locales: { matches: ["kk"] },
-      }],
-    },
-    "yandex.com.tr": {
-      included: [{
-        locales: { matches: ["tr"] },
-      }],
-    },
-  },
 });
 
 add_task(async function setup() {
   await test.setup();
 });
 
 add_task(async function test_searchConfig_yandex() {
   await test.run();