1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

LibJS: Convert canonicalize_locale_list() to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-09-18 19:24:28 +03:00
parent 5426901521
commit 3758e65293
8 changed files with 27 additions and 42 deletions

View file

@ -57,9 +57,7 @@ Value DisplayNamesConstructor::construct(FunctionObject& new_target)
auto* display_names = TRY_OR_DISCARD(ordinary_create_from_constructor<DisplayNames>(global_object, new_target, &GlobalObject::intl_display_names_prototype));
// 3. Let requestedLocales be ? CanonicalizeLocaleList(locales).
auto requested_locales = canonicalize_locale_list(global_object, locale_value);
if (vm.exception())
return {};
auto requested_locales = TRY_OR_DISCARD(canonicalize_locale_list(global_object, locale_value));
// 4. If options is undefined, throw a TypeError exception.
if (options_value.is_undefined()) {
@ -136,7 +134,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisplayNamesConstructor::supported_locales_of)
// No-op, availability of each requested locale is checked via Unicode::is_locale_available()
// 2. Let requestedLocales be ? CanonicalizeLocaleList(locales).
auto requested_locales = canonicalize_locale_list(global_object, locales);
auto requested_locales = TRY_OR_DISCARD(canonicalize_locale_list(global_object, locales));
if (vm.exception())
return {};