Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9d0510b40b57822c4095858d4295a2d8b501244a
https://github.com/WebKit/WebKit/commit/9d0510b40b57822c4095858d4295a2d8b501244a
Author: Yijia Huang <[email protected]>
Date: 2026-06-19 (Fri, 19 Jun 2026)
Changed paths:
A JSTests/stress/temporal-parseisodatetime.js
M Source/JavaScriptCore/API/tests/TemporalCoreTest.cpp
M Source/JavaScriptCore/runtime/ISO8601.cpp
M Source/JavaScriptCore/runtime/ISO8601.h
M Source/JavaScriptCore/runtime/TemporalDuration.cpp
M Source/JavaScriptCore/runtime/TemporalInstant.cpp
M Source/JavaScriptCore/runtime/TemporalObject.cpp
M Source/JavaScriptCore/runtime/TemporalPlainDate.cpp
M Source/JavaScriptCore/runtime/TemporalPlainDateTime.cpp
M Source/JavaScriptCore/runtime/TemporalPlainMonthDay.cpp
M Source/JavaScriptCore/runtime/TemporalPlainTime.cpp
M Source/JavaScriptCore/runtime/TemporalPlainYearMonth.cpp
M Source/JavaScriptCore/runtime/TemporalZonedDateTime.cpp
Log Message:
-----------
[JSC][Temporal] Unify ParseISODateTime
https://bugs.webkit.org/show_bug.cgi?id=317463
rdar://180084451
Reviewed by Yusuke Suzuki.
The four overlapping parsers (parseTime, parseCalendarTime,
parseDateTime, parseCalendarDateTime) duplicated date/time/offset/
annotation logic and produced real ambiguity bugs: length-10 strings
matching either DateSpec* or full Date; the Time goal clobbering
MonthDay matches in calendar canonicalization; PlainDate accepting
Z+bracket inputs that [~Zoned] should reject; ParseTemporalCalendarString
silently accepting YearMonth/MonthDay short forms paired with non-iso8601
calendars (a Step 4.a.ii.(3)/(4) violation).
Replaced with one ISO8601::parseISODateTime mirroring the algorithm at
https://tc39.es/proposal-temporal/#sec-temporal-parseisodatetime, with
each of the 29 spec steps annotated. Every Temporal consumer passes the
TemporalProductionSet its spec citation specifies. Per-production
tokenizers replace the loose-mode parseDate, and strict primitives
(parseDateSpecYearMonth / parseDateSpecMonthDay) eliminate the length-10
ambiguity by matching the named grammar productions. The AnnotatedTime
early-error rule is now implemented as literal ParseText calls.
parseISODateTime enforces Step 4.a.ii.(3)/(4) internally — short-form
YearMonth/MonthDay with a non-iso8601 calendar returns std::nullopt,
surfacing as RangeError at every consumer. This fixes the property-bag
calendar path (e.g. Temporal.PlainDate.from({calendar:
"2024-01[u-ca=hebrew]"})) which previously slipped through.
A FIXME above parseISODateTime references temporal_rs/parsers.rs and
icu4x/utils/ixdtf as the upstream single-pass tokenizer; ICU4C has no
equivalent, so the in-house per-production tokenizers stay.
Tests:
JSTests/stress/temporal-parseisodatetime.js
Source/JavaScriptCore/API/tests/TemporalCoreTest.cpp
Canonical link: https://commits.webkit.org/315556@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications