commit 2de925702d50d7c81b0b7091f0f7943d361c059e
parent 94e008929aede14ae1b4c6dadc2f6da4a0152701
Author: André Bargull <andre.bargull@gmail.com>
Date: Thu, 27 Nov 2025 10:03:33 +0000
Bug 1971346: Fix type assertion in BubbleRelativeDuration. r=spidermonkey-reviewers,dminor
Implements the changes from <https://github.com/tc39/proposal-temporal/pull/3123>.
Differential Revision: https://phabricator.services.mozilla.com/D272020
Diffstat:
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/js/src/builtin/temporal/Duration.cpp b/js/src/builtin/temporal/Duration.cpp
@@ -2569,19 +2569,17 @@ static bool BubbleRelativeDuration(
MOZ_ASSERT(IsValidDuration(duration));
MOZ_ASSERT(IsValidDuration(nudge.duration));
MOZ_ASSERT(ISODateTimeWithinLimits(isoDateTime));
- MOZ_ASSERT(largestUnit <= TemporalUnit::Day);
MOZ_ASSERT(smallestUnit <= TemporalUnit::Day);
- MOZ_ASSERT(largestUnit <= smallestUnit);
-
- int32_t sign = InternalDurationSign(duration) < 0 ? -1 : 1;
- // Step 1.
- if (smallestUnit == largestUnit) {
+ // Step 1. (Modified to use `<=` to return early.)
+ if (smallestUnit <= largestUnit) {
*result = nudge.duration;
return true;
}
MOZ_ASSERT(smallestUnit != TemporalUnit::Year);
+ int32_t sign = InternalDurationSign(duration) < 0 ? -1 : 1;
+
// Steps 2-6.
auto dateDuration = nudge.duration.date;
auto timeDuration = nudge.duration.time;
diff --git a/js/src/tests/jstests.list b/js/src/tests/jstests.list
@@ -1094,8 +1094,3 @@ skip script test262/intl402/Temporal/PlainYearMonth/from/reference-day-chinese.j
skip script test262/intl402/Temporal/PlainYearMonth/from/reference-day-hebrew.js
skip script test262/intl402/Temporal/PlainDate/from/calendar-not-supporting-eras.js
skip script test262/intl402/Temporal/PlainDateTime/from/calendar-not-supporting-eras.js
-
-# https://bugzilla.mozilla.org/show_bug.cgi?id=1971346
-skip script test262/built-ins/Temporal/PlainDateTime/prototype/until/bubble-time-unit.js
-skip script test262/built-ins/Temporal/PlainDateTime/prototype/since/bubble-time-unit.js
-skip script test262/built-ins/Temporal/Duration/prototype/round/bubble-time-unit.js