Backed out 1 changesets (bug 1423463) for failing due to syntax errors in /builds/worker/workspace/build/src/intl/locale/LocaleService.cpp r=backout on a CLOSED TREE

Backed out changeset 97f4bb99a1a9 (bug 1423463)
This commit is contained in:
Bogdan Tara 2017-12-07 19:43:03 +02:00
Родитель e882c9b394
Коммит 8c4a5326da
1 изменённых файлов: 13 добавлений и 8 удалений

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

@ -81,12 +81,14 @@ ReadRequestedLocales(nsTArray<nsCString>& aRetVal)
if (str.Length() > 0) { if (str.Length() > 0) {
for (const nsACString& part : str.Split(',')) { for (const nsACString& part : str.Split(',')) {
nsAutoCString locale(part); nsAutoCString locale(part);
if (locale.EqualsLiteral("ja-JP-mac")) { if (SanitizeForBCP47(locale, true)) {
// This is a hack required to handle the special Mozilla `ja-JP-mac` locale. // This is a hack required for us to handle the special Mozilla `ja-JP-mac`
if (!aRetVal.Contains(locale)) { // locales. We sanitize the input to normalize the case etc. but in result
aRetVal.AppendElement(locale); // the `ja-JP-mac` will get turned into a BCP47 tag. Here we're turning it
// back into the form expected by Gecko resources.
if (locale.EqualsLiteral("ja-JP-x-lvariant-mac")) {
locale.Assign("ja-JP-mac");
} }
} else if (SanitizeForBCP47(locale, true)) {
if (!aRetVal.Contains(locale)) { if (!aRetVal.Contains(locale)) {
aRetVal.AppendElement(locale); aRetVal.AppendElement(locale);
} }
@ -835,7 +837,7 @@ LocaleService::Locale::Locale(const nsCString& aLocale, bool aRange)
} }
break; break;
case 3: case 3:
if (part.EqualsLiteral("*") || part.Length() >= 3 && part.Length() <= 8) { if (part.EqualsLiteral("*") || part.Length() == 3) {
mVariant.Assign(part); mVariant.Assign(part);
} }
break; break;
@ -990,11 +992,14 @@ LocaleService::SetRequestedLocales(const char** aRequested,
for (uint32_t i = 0; i < aRequestedCount; i++) { for (uint32_t i = 0; i < aRequestedCount; i++) {
nsAutoCString locale(aRequested[i]); nsAutoCString locale(aRequested[i]);
if (!locale.EqualsLiteral("ja-JP-mac") && if (!SanitizeForBCP47(locale, true)) {
!SanitizeForBCP47(locale, true)) {
NS_ERROR("Invalid language tag provided to SetRequestedLocales!"); NS_ERROR("Invalid language tag provided to SetRequestedLocales!");
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;
} }
if (locale.EqualsLiteral("ja-JP-x-lvariant-mac")) {
// This is a hack for our code to handle `ja-JP-mac` special case.
locale.Assign("ja-JP-mac");
}
if (i > 0) { if (i > 0) {
str.AppendLiteral(","); str.AppendLiteral(",");