mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
LibJS: Correctly disallow certain calendar-based Temporal strings
This is an editorial change in the Temporal proposal. See:
d83241f
This commit is contained in:
parent
3f75cf270a
commit
e95f225362
Notes:
github-actions[bot]
2025-07-23 20:06:30 +00:00
Author: https://github.com/trflynn89
Commit: e95f225362
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5575
1 changed files with 11 additions and 6 deletions
|
@ -1178,17 +1178,22 @@ ThrowCompletionOr<ParsedISODateTime> parse_iso_date_time(VM& vm, StringView iso_
|
|||
}
|
||||
}
|
||||
|
||||
// 3. If goal is TemporalMonthDayString or TemporalYearMonthString, calendar is not EMPTY, and the
|
||||
// ASCII-lowercase of calendar is not "iso8601", throw a RangeError exception.
|
||||
if (goal == Production::TemporalMonthDayString || goal == Production::TemporalYearMonthString) {
|
||||
// 3. If goal is TemporalYearMonthString and parseResult does not contain a DateDay Parse Node, then
|
||||
if (goal == Production::TemporalYearMonthString && !parse_result->date_day.has_value()) {
|
||||
// a. If calendar is not empty and the ASCII-lowercase of calendar is not "iso8601", throw a RangeError exception.
|
||||
if (calendar.has_value() && !calendar->equals_ignoring_ascii_case("iso8601"sv))
|
||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarIdentifier, *calendar);
|
||||
}
|
||||
|
||||
// 4. If goal is TemporalMonthDayString and parseResult does not contain a DateYear Parse Node, set
|
||||
// yearAbsent to true.
|
||||
if (goal == Production::TemporalMonthDayString && !parse_result->date_year.has_value())
|
||||
// 4. If goal is TemporalMonthDayString and parseResult does not contain a DateYear Parse Node, then
|
||||
if (goal == Production::TemporalMonthDayString && !parse_result->date_year.has_value()) {
|
||||
// a. If calendar is not empty and the ASCII-lowercase of calendar is not "iso8601", throw a RangeError exception.
|
||||
if (calendar.has_value() && !calendar->equals_ignoring_ascii_case("iso8601"sv))
|
||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarIdentifier, *calendar);
|
||||
|
||||
// b. Set yearAbsent to true.
|
||||
year_absent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue