Commit 0f901f00 authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

[Temporal] Sync PR 2297 change ToSecondsStringPrecision

Validate fractionalSecondDigits after truncation

https://github.com/tc39/proposal-temporal/pull/2297

Spec text:
https://tc39.es/proposal-temporal/#sec-temporal-tosecondsstringprecision

Bug: v8:11544
Change-Id: I648f087f4fa2cfd6245c7946cfa625a7c5e3b3b9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3855702
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82801}
parent a7c7c4dc
......@@ -15698,18 +15698,18 @@ Maybe<StringPrecision> ToSecondsStringPrecision(
factory->fractionalSecondDigits_string()),
Nothing<StringPrecision>());
}
// 12. If ℝ(fractionalDigitsVal) < 0 or ℝ(fractionalDigitsVal) > 9, throw a
// 12. Let fractionalDigitCount be RoundTowardsZero(ℝ(fractionalDigitsVal)).
int64_t fractional_digit_count =
RoundTowardsZero(fractional_digits_val->Number());
// 13. If fractionalDigitCount < 0 or fractionalDigitCount > 9, throw a
// RangeError exception.
if (fractional_digits_val->Number() < 0 ||
fractional_digits_val->Number() > 9) {
if (fractional_digit_count < 0 || fractional_digit_count > 9) {
THROW_NEW_ERROR_RETURN_VALUE(
isolate,
NewRangeError(MessageTemplate::kPropertyValueOutOfRange,
factory->fractionalSecondDigits_string()),
Nothing<StringPrecision>());
}
// 13. Let fractionalDigitCount be floor(ℝ(fractionalDigitsVal)).
int32_t fractional_digit_count = std::floor(fractional_digits_val->Number());
// 14. If fractionalDigitCount is 0, then
switch (fractional_digit_count) {
case 0:
......
......@@ -685,14 +685,9 @@
'intl402/Temporal/TimeZone/prototype/getNextTransition/subtract-second-and-nanosecond-from-last-transition': [FAIL],
'intl402/Temporal/TimeZone/prototype/getPreviousTransition/nanoseconds-subtracted-or-added-at-dst-transition': [FAIL],
'built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
'built-ins/Temporal/Instant/prototype/add/minimum-maximum-instant': [FAIL],
'built-ins/Temporal/Instant/prototype/subtract/minimum-maximum-instant': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
'built-ins/Temporal/PlainMonthDay/refisoyear-out-of-range': [FAIL],
'built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
'intl402/Temporal/TimeZone/from/etc-timezone': [FAIL],
'intl402/Temporal/TimeZone/from/iana-legacy-names': [FAIL],
'intl402/Temporal/TimeZone/prototype/getNextTransition/transition-at-instant-boundaries': [FAIL],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment