зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset dfd2dc592f0f (bug 1572030) for ES Lint failure. CLOSED TREE
This commit is contained in:
Родитель
a38c7e2387
Коммит
89a7765a1b
|
@ -14,7 +14,6 @@ XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);
|
|||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
SearchUtils: "resource://gre/modules/SearchUtils.jsm",
|
||||
Services: "resource://gre/modules/Services.jsm",
|
||||
});
|
||||
|
||||
const EXT_SEARCH_PREFIX = "resource://search-extensions/";
|
||||
|
@ -58,7 +57,6 @@ class SearchEngineSelector {
|
|||
throw new Error("region and locale parameters required");
|
||||
}
|
||||
log(`fetchEngineConfiguration ${region}:${locale}`);
|
||||
let cohort = Services.prefs.getCharPref("browser.search.cohort", null);
|
||||
let engines = [];
|
||||
for (let config of this.configuration) {
|
||||
const appliesTo = config.appliesTo || [];
|
||||
|
@ -69,9 +67,6 @@ class SearchEngineSelector {
|
|||
let excluded =
|
||||
"excluded" in section &&
|
||||
this._isInSection(region, locale, section.excluded);
|
||||
if ("cohort" in section && cohort != section.cohort) {
|
||||
return false;
|
||||
}
|
||||
return included && !excluded;
|
||||
});
|
||||
|
||||
|
|
|
@ -132,36 +132,6 @@ configuration object with the users locale. For example:
|
|||
Will report either ``us`` or ``gb`` as the ``webExtensionLocale``
|
||||
depending on the user.
|
||||
|
||||
Experiments
|
||||
-----------
|
||||
|
||||
We can run experiments by giving sections within ``appliesTo`` a
|
||||
``cohort`` value, the Search Service can then optionally pass in a
|
||||
matching ``cohort`` value to match those sections.
|
||||
|
||||
Sections which have a ``cohort`` will not be used unless a matching
|
||||
``cohort`` has been passed in, for example:
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
"engine1": {
|
||||
"webExtensionId": "webext",
|
||||
"webExtensionVersion": "1.0",
|
||||
"appliesTo": [{
|
||||
"included": {
|
||||
"everywhere": true
|
||||
},
|
||||
"cohort": "nov-16",
|
||||
"webExtensionId": "webext-experimental",
|
||||
}, {
|
||||
"included": {
|
||||
"everywhere": true
|
||||
},
|
||||
"webExtensionId": "webext-gb",
|
||||
"webExtensionVersion": "1.2"
|
||||
}]
|
||||
}
|
||||
|
||||
Engine Defaults
|
||||
---------------
|
||||
|
||||
|
|
|
@ -54,10 +54,6 @@ const CONFIG_URL =
|
|||
included: { everywhere: true },
|
||||
excluded: { regions: ["us"] },
|
||||
},
|
||||
{
|
||||
included: { everywhere: true },
|
||||
cohort: "acohortid",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -100,15 +96,4 @@ add_task(async function() {
|
|||
["excite", "aol"],
|
||||
"The engines should be in the correct order"
|
||||
);
|
||||
|
||||
Services.prefs.setCharPref("browser.search.cohort", "acohortid");
|
||||
({ engines, privateDefault } = engineSelector.fetchEngineConfiguration(
|
||||
"us",
|
||||
"en-US"
|
||||
));
|
||||
Assert.deepEqual(
|
||||
engines.map(obj => obj.engineName),
|
||||
["lycos","altavista","aol","excite"],
|
||||
"Engines are in the correct order and include the cohort engine"
|
||||
);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче