LibJS: Ensure relevant extension keys are included in ICU locale data

This is a normative change in the ECMA-402 spec. See:
7508197

In our implementation, we don't have the affected AOs directly, as we
delegate to ICU. So instead, we must ensure we provide ICU a locale with
the relevant extension keys present.
This commit is contained in:
Timothy Flynn 2025-03-17 16:24:09 -04:00 committed by Tim Flynn
parent 37b8ba96f1
commit 00d00b84d3
Notes: github-actions[bot] 2025-03-18 15:48:22 +00:00
17 changed files with 82 additions and 67 deletions

View file

@ -149,6 +149,7 @@ ThrowCompletionOr<GC::Ref<DateTimeFormat>> create_date_time_format(VM& vm, Funct
// 18. Set dateTimeFormat.[[Locale]] to r.[[Locale]].
date_time_format->set_locale(move(result.locale));
date_time_format->set_icu_locale(move(result.icu_locale));
// 19. Let resolvedCalendar be r.[[ca]].
// 20. Set dateTimeFormat.[[Calendar]] to resolvedCalendar.
@ -355,7 +356,7 @@ ThrowCompletionOr<GC::Ref<DateTimeFormat>> create_date_time_format(VM& vm, Funct
// d. Let styles be resolvedLocaleData.[[styles]].[[<resolvedCalendar>]].
// e. Let bestFormat be DateTimeStyleFormat(dateStyle, timeStyle, styles).
formatter = Unicode::DateTimeFormat::create_for_date_and_time_style(
date_time_format->locale(),
date_time_format->icu_locale(),
time_zone,
format_options.hour_cycle,
format_options.hour12,
@ -443,7 +444,7 @@ ThrowCompletionOr<GC::Ref<DateTimeFormat>> create_date_time_format(VM& vm, Funct
}
formatter = Unicode::DateTimeFormat::create_for_pattern_options(
date_time_format->locale(),
date_time_format->icu_locale(),
time_zone,
best_format);
}