Bug 1617455 - Use empty array for empty locale string. r=zbraniecki

Differential Revision: https://phabricator.services.mozilla.com/D65223

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Kaply 2020-03-03 23:03:38 +00:00
Родитель 50de7581c8
Коммит ff1e2ff383
2 изменённых файлов: 24 добавлений и 1 удалений

Просмотреть файл

@ -1210,8 +1210,10 @@ var Policies = {
onBeforeAddons(manager, param) {
if (Array.isArray(param)) {
Services.locale.requestedLocales = param;
} else {
} else if (param) {
Services.locale.requestedLocales = param.split(",");
} else {
Services.locale.requestedLocales = [];
}
},
},

Просмотреть файл

@ -45,3 +45,24 @@ add_task(async function test_requested_locale_string() {
await localePromise;
Services.locale.requestedLocales = originalLocales;
});
add_task(async function test_system_locale_string() {
let originalLocales = Services.locale.requestedLocales;
let localePromise = promiseLocaleChanged("und");
Services.locale.requestedLocales = ["und"];
await localePromise;
let systemLocale = Cc["@mozilla.org/intl/ospreferences;1"].getService(
Ci.mozIOSPreferences
).systemLocale;
localePromise = promiseLocaleChanged(systemLocale);
await setupPolicyEngineWithJson({
policies: {
RequestedLocales: "",
},
});
await localePromise;
Services.locale.requestedLocales = originalLocales;
});