tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 07ce1049262e4f000454a902747e7c0eba65cb32
parent e5e72e2bf3a96bc607933d9eeeae3bf225d31867
Author: André Bargull <andre.bargull@gmail.com>
Date:   Fri, 28 Nov 2025 07:47:10 +0000

Bug 2002844 - Part 2: Move NegateRoundingMode in GetDifferenceSettings. r=spidermonkey-reviewers,mgaudet

Editorial change from <https://github.com/tc39/proposal-temporal/pull/3187>.

Differential Revision: https://phabricator.services.mozilla.com/D274332

Diffstat:
Mjs/src/builtin/temporal/Temporal.cpp | 26+++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/js/src/builtin/temporal/Temporal.cpp b/js/src/builtin/temporal/Temporal.cpp @@ -1319,20 +1319,15 @@ bool js::temporal::GetDifferenceSettings( } // Step 9. - if (operation == TemporalDifference::Since) { - roundingMode = NegateRoundingMode(roundingMode); - } - - // Step 10. if (!ValidateTemporalUnitValue(cx, TemporalUnitKey::SmallestUnit, smallestUnit, unitGroup)) { return false; } - // Step 11. (Not applicable in our implementation.) + // Step 10. (Not applicable in our implementation.) MOZ_ASSERT(smallestUnit != TemporalUnit::Unset); - // Step 12. + // Step 11. if (smallestUnit > smallestAllowedUnit) { JS_ReportErrorNumberASCII( cx, GetErrorMessage, nullptr, JSMSG_TEMPORAL_INVALID_UNIT_OPTION, @@ -1340,33 +1335,38 @@ bool js::temporal::GetDifferenceSettings( return false; } - // Step 13. (Inlined call to LargerOfTwoTemporalUnits) + // Step 12. (Inlined call to LargerOfTwoTemporalUnits) auto defaultLargestUnit = std::min(smallestLargestDefaultUnit, smallestUnit); - // Step 14. + // Step 13. if (largestUnit == TemporalUnit::Auto) { largestUnit = defaultLargestUnit; } - // Step 15. + // Step 14. if (largestUnit > smallestUnit) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_TEMPORAL_INVALID_UNIT_RANGE); return false; } - // Steps 16-17. + // Steps 15-16. if (smallestUnit > TemporalUnit::Day) { - // Step 16. + // Step 15. auto maximum = MaximumTemporalDurationRoundingIncrement(smallestUnit); - // Step 17. + // Step 16. if (!ValidateTemporalRoundingIncrement(cx, roundingIncrement, maximum, false)) { return false; } } + // Step 17. + if (operation == TemporalDifference::Since) { + roundingMode = NegateRoundingMode(roundingMode); + } + // Step 18. *result = {smallestUnit, largestUnit, roundingMode, roundingIncrement}; return true;