1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00

LibJS: Stop propagating small OOM errors from Intl.NumberFormat

Note this also does the same for Intl.PluralRules. The only OOM errors
propagated from Intl.PluralRules were from Intl.NumberFormat.
This commit is contained in:
Timothy Flynn 2023-08-30 12:30:39 -04:00 committed by Andreas Kling
parent 30a812b77b
commit b3694653a7
16 changed files with 153 additions and 164 deletions

View file

@ -446,7 +446,7 @@ Vector<PatternPartition> partition_duration_format_pattern(VM& vm, DurationForma
// 3. Let dataLocaleData be %DurationFormat%.[[LocaleData]].[[<dataLocale>]].
// 4. Let num be ! FormatNumeric(nf, 𝔽(value)).
auto number = MUST(format_numeric(vm, *number_format, MathematicalValue(value)));
auto number = format_numeric(vm, *number_format, MathematicalValue(value));
// 5. Append the new Record { [[Type]]: unit, [[Value]]: num} to the end of result.
result.append({ unit, move(number) });
@ -505,7 +505,7 @@ Vector<PatternPartition> partition_duration_format_pattern(VM& vm, DurationForma
auto* number_format = static_cast<NumberFormat*>(MUST(construct(vm, realm.intrinsics().intl_number_format_constructor(), PrimitiveString::create(vm, duration_format.locale()), number_format_options)).ptr());
// 5. Let parts be ! PartitionNumberPattern(nf, 𝔽(value)).
auto parts = MUST(partition_number_pattern(vm, *number_format, MathematicalValue(value)));
auto parts = partition_number_pattern(vm, *number_format, MathematicalValue(value));
// 6. Let concat be an empty String.
StringBuilder concat;