Return undefined if fractionalSecondDigits is 0

Bug: v8:10686
Change-Id: I5a7b47dd4ed10142a795de56c4739ab072e63421
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2286814
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Frank Tang <ftang@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68773}
This commit is contained in:
Frank Tang 2020-07-09 15:18:10 -07:00 committed by Commit Bot
parent 34871eddc0
commit d3fe0e29c3
4 changed files with 10 additions and 12 deletions

View File

@ -650,10 +650,12 @@ MaybeHandle<JSObject> JSDateTimeFormat::ResolvedOptions(
}
if (FLAG_harmony_intl_dateformat_fractional_second_digits) {
int fsd = FractionalSecondDigitsFromPattern(pattern);
CHECK(JSReceiver::CreateDataProperty(
isolate, options, factory->fractionalSecondDigits_string(),
factory->NewNumberFromInt(fsd), Just(kDontThrow))
.FromJust());
if (fsd > 0) {
CHECK(JSReceiver::CreateDataProperty(
isolate, options, factory->fractionalSecondDigits_string(),
factory->NewNumberFromInt(fsd), Just(kDontThrow))
.FromJust());
}
}
}

View File

@ -71,7 +71,6 @@ var expectedProperties = [
'minute',
'second',
'timeZoneName',
'fractionalSecondDigits',
];
assertEquals(expectedProperties.length, properties.length);

View File

@ -5,7 +5,7 @@
// Flags: --harmony_intl_dateformat_fractional_second_digits
assertEquals(
0,
undefined,
(new Intl.DateTimeFormat("en", {fractionalSecondDigits: 0}))
.resolvedOptions().fractionalSecondDigits);
@ -25,14 +25,14 @@ assertEquals(
.resolvedOptions().fractionalSecondDigits);
// When timeStyle and dateStyle is not present, GetNumberOption will fallback
// to 0 as default regardless fractionalSecondDigits is present in the option or
// to undefined as default regardless fractionalSecondDigits is present in the option or
// not.
assertEquals(
0,
undefined,
(new Intl.DateTimeFormat()).resolvedOptions().fractionalSecondDigits);
assertEquals(
0,
undefined,
(new Intl.DateTimeFormat("en", {fractionalSecondDigits: undefined}))
.resolvedOptions().fractionalSecondDigits);

View File

@ -665,9 +665,6 @@
# https://crbug.com/v8/10688
'language/expressions/optional-chaining/eval-optional-call': [FAIL],
# https://crbug.com/v8/10686
'intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-valid': [FAIL],
######################## NEEDS INVESTIGATION ###########################
# https://bugs.chromium.org/p/v8/issues/detail?id=7833