EncodedJSValue JSC_HOST_CALL IntlCollatorConstructorFuncSupportedLocalesOf(ExecState* state) { // 10.2.2 Intl.Collator.supportedLocalesOf(locales [, options]) (ECMA-402 2.0) // 1. Let requestedLocales be CanonicalizeLocaleList(locales). Vector<String> requestedLocales = canonicalizeLocaleList(*state, state->argument(0)); // 2. ReturnIfAbrupt(requestedLocales). if (state->hadException()) return JSValue::encode(jsUndefined()); // 3. Return SupportedLocales(%Collator%.[[availableLocales]], requestedLocales, options). JSGlobalObject* globalObject = state->callee()->globalObject(); return JSValue::encode(supportedLocales(*state, globalObject->intlCollatorAvailableLocales(), requestedLocales, state->argument(1))); }
EncodedJSValue JSC_HOST_CALL IntlCollatorConstructorFuncSupportedLocalesOf(ExecState* state) { VM& vm = state->vm(); auto scope = DECLARE_THROW_SCOPE(vm); // 10.2.2 Intl.Collator.supportedLocalesOf(locales [, options]) (ECMA-402 2.0) // 1. Let requestedLocales be CanonicalizeLocaleList(locales). Vector<String> requestedLocales = canonicalizeLocaleList(*state, state->argument(0)); // 2. ReturnIfAbrupt(requestedLocales). RETURN_IF_EXCEPTION(scope, encodedJSValue()); // 3. Return SupportedLocales(%Collator%.[[availableLocales]], requestedLocales, options). JSGlobalObject* globalObject = state->jsCallee()->globalObject(vm); RELEASE_AND_RETURN(scope, JSValue::encode(supportedLocales(*state, globalObject->intlCollatorAvailableLocales(), requestedLocales, state->argument(1)))); }