[intl] Reject _ in calendar id to fix test262 test

see https://github.com/tc39/test262/pull/3173

Bug: v8:12167
Change-Id: I49bed6bf361dbc216a5174be16d747fe2b104208
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3152714
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76778}
This commit is contained in:
Frank Tang 2021-09-09 20:03:35 -07:00 committed by V8 LUCI CQ
parent c2ac4811aa
commit 983ed35461
2 changed files with 3 additions and 14 deletions

View File

@ -183,19 +183,11 @@ bool JSLocale::Is38AlphaNumList(const std::string& in) {
std::string value = in;
while (true) {
std::size_t found_dash = value.find("-");
std::size_t found_underscore = value.find("_");
if (found_dash == std::string::npos &&
found_underscore == std::string::npos) {
if (found_dash == std::string::npos) {
return IsAlphanum(value, 3, 8);
}
if (found_underscore == std::string::npos ||
found_dash < found_underscore) {
if (!IsAlphanum(value.substr(0, found_dash), 3, 8)) return false;
value = value.substr(found_dash + 1);
} else {
if (!IsAlphanum(value.substr(0, found_underscore), 3, 8)) return false;
value = value.substr(found_underscore + 1);
}
if (!IsAlphanum(value.substr(0, found_dash), 3, 8)) return false;
value = value.substr(found_dash + 1);
}
}

View File

@ -236,9 +236,6 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=7472
'intl402/NumberFormat/currency-digits': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=12167
'intl402/DisplayNames/prototype/of/type-calendar-invalid': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=12209
'intl402/Intl/supportedValuesOf/calendars-accepted-by-DateTimeFormat': [FAIL],
'intl402/Intl/supportedValuesOf/collations-accepted-by-Collator': [FAIL],