1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38: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

@ -176,10 +176,10 @@ ThrowCompletionOr<Vector<PatternPartitionWithUnit>> partition_relative_time_patt
auto patterns = find_patterns_for_tense_or_number(tense);
// 20. Let fv be ! PartitionNumberPattern(relativeTimeFormat.[[NumberFormat]], value).
auto value_partitions = MUST_OR_THROW_OOM(partition_number_pattern(vm, relative_time_format.number_format(), Value(value)));
auto value_partitions = partition_number_pattern(vm, relative_time_format.number_format(), Value(value));
// 21. Let pr be ! ResolvePlural(relativeTimeFormat.[[PluralRules]], value).[[PluralCategory]].
auto plurality = MUST_OR_THROW_OOM(resolve_plural(vm, relative_time_format.plural_rules(), Value(value)));
auto plurality = resolve_plural(relative_time_format.plural_rules(), Value(value));
// 22. Let pattern be po.[[<pr>]].
auto pattern = patterns.find_if([&](auto& p) { return p.plurality == plurality.plural_category; });