[intl] Sync number format v3 to pr92

Change the return value to fallback while the property
is not one specified in the value.
https://github.com/tc39/proposal-intl-numberformat-v3/pull/92

Bug: v8:13053
Change-Id: I40e430152c71258f1ff85fec1d69928937d0ad99
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3759224
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81795}
This commit is contained in:
Frank Tang 2022-07-12 14:59:29 -07:00 committed by V8 LUCI CQ
parent 3d31f99124
commit d99f78c219
3 changed files with 6 additions and 12 deletions

View File

@ -104,8 +104,7 @@ V8_WARN_UNUSED_RESULT static Maybe<T> GetStringOrBooleanOption(
// 6. Let value be ? ToString(value).
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, value_str, Object::ToString(isolate, value), Nothing<T>());
// 7. If values does not contain an element equal to value, throw a
// RangeError exception.
// If values does not contain an element equal to value, return fallback.
// 8. Return value.
value_str = String::Flatten(isolate, value_str);
{
@ -128,12 +127,7 @@ V8_WARN_UNUSED_RESULT static Maybe<T> GetStringOrBooleanOption(
}
}
} // end of no_gc
THROW_NEW_ERROR_RETURN_VALUE(
isolate,
NewRangeError(MessageTemplate::kValueOutOfRange, value,
isolate->factory()->NewStringFromAsciiChecked(method),
property_str),
Nothing<T>());
return Just(fallback_value);
}
// ECMA402 9.2.10. GetOption( options, property, type, values, fallback)

View File

@ -22,8 +22,8 @@ validUseGrouping.forEach(function(useGrouping) {
});
invalidUseGrouping.forEach(function(useGrouping) {
assertThrows(() => {
let nf = new Intl.NumberFormat(undefined, {useGrouping}); });
let nf = new Intl.NumberFormat(undefined, {useGrouping});
assertEquals("auto", nf.resolvedOptions().useGrouping);
});
// useGrouping: undefined get "auto"

View File

@ -1157,8 +1157,8 @@
'intl402/DurationFormat/prototype/format/invalid-negative-duration-throws': [FAIL],
'intl402/DurationFormat/prototype/formatToParts/invalid-negative-duration-throws': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=13053
'intl402/NumberFormat/test-option-useGrouping-extended': [FAIL],
# https://github.com/tc39/test262/pull/3603
'intl402/NumberFormat/test-option-useGrouping': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=12763
'language/expressions/class/decorator/syntax/class-valid/decorator-member-expr-private-identifier': [FAIL],