File webkit2gtk3-old-icu.patch of Package webkit2gtk3.27283

diff -urp webkitgtk-2.37.91.glib/Source/cmake/OptionsGTK.cmake webkitgtk-2.37.91/Source/cmake/OptionsGTK.cmake
--- webkitgtk-2.37.91.glib/Source/cmake/OptionsGTK.cmake	2022-09-09 17:49:32.309218907 -0500
+++ webkitgtk-2.37.91/Source/cmake/OptionsGTK.cmake	2022-09-09 17:51:45.349921312 -0500
@@ -19,7 +19,7 @@ find_package(Freetype 2.4.2 REQUIRED)
 find_package(LibGcrypt 1.6.0 REQUIRED)
 find_package(GLIB 2.44.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
 find_package(HarfBuzz 0.9.18 REQUIRED COMPONENTS ICU)
-find_package(ICU 61.2 REQUIRED COMPONENTS data i18n uc)
+find_package(ICU 60.2 REQUIRED COMPONENTS data i18n uc)
 find_package(JPEG REQUIRED)
 find_package(LibXml2 2.8.0 REQUIRED)
 find_package(PNG REQUIRED)
diff -urp webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/CommonIdentifiers.h webkitgtk-2.37.91/Source/JavaScriptCore/runtime/CommonIdentifiers.h
--- webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/CommonIdentifiers.h	2022-08-31 02:59:51.750492600 -0500
+++ webkitgtk-2.37.91/Source/JavaScriptCore/runtime/CommonIdentifiers.h	2022-09-09 17:51:45.349921312 -0500
@@ -119,7 +119,6 @@
     macro(exec) \
     macro(executionCount) \
     macro(exitKind) \
-    macro(fallback) \
     macro(flags) \
     macro(forEach) \
     macro(formatMatcher) \
@@ -166,7 +165,6 @@
     macro(jettisonReason) \
     macro(join) \
     macro(language) \
-    macro(languageDisplay) \
     macro(largestUnit) \
     macro(lastIndex) \
     macro(length) \
diff -urp webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlCache.cpp webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlCache.cpp
--- webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlCache.cpp	2022-08-31 02:59:51.770492800 -0500
+++ webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlCache.cpp	2022-09-09 17:51:45.349921312 -0500
@@ -53,16 +53,4 @@ Vector<UChar, 32> IntlCache::getBestDate
     return patternBuffer;
 }
 
-Vector<UChar, 32> IntlCache::getFieldDisplayName(const CString& locale, UDateTimePatternField field, UDateTimePGDisplayWidth width, UErrorCode& status)
-{
-    auto sharedGenerator = getSharedPatternGenerator(locale, status);
-    if (U_FAILURE(status))
-        return { };
-    Vector<UChar, 32> buffer;
-    status = callBufferProducingFunction(udatpg_getFieldDisplayName, sharedGenerator, field, width, buffer);
-    if (U_FAILURE(status))
-        return { };
-    return buffer;
-}
-
 } // namespace JSC
diff -urp webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlCache.h webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlCache.h
--- webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlCache.h	2022-08-31 02:59:51.770492800 -0500
+++ webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlCache.h	2022-09-09 17:51:45.353921333 -0500
@@ -39,7 +39,6 @@ public:
     IntlCache() = default;
 
     Vector<UChar, 32> getBestDateTimePattern(const CString& locale, const UChar* skeleton, unsigned skeletonSize, UErrorCode&);
-    Vector<UChar, 32> getFieldDisplayName(const CString& locale, UDateTimePatternField, UDateTimePGDisplayWidth, UErrorCode&);
 
 private:
     UDateTimePatternGenerator* getSharedPatternGenerator(const CString& locale, UErrorCode& status)
diff -urp webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlDisplayNames.cpp webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlDisplayNames.cpp
--- webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlDisplayNames.cpp	2022-08-31 02:59:51.770492800 -0500
+++ webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlDisplayNames.cpp	2022-09-09 18:01:02.172861353 -0500
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "IntlDisplayNames.h"
 
-#include "IntlCache.h"
 #include "IntlObjectInlines.h"
 #include "JSCInlines.h"
 #include "ObjectConstructor.h"
@@ -96,7 +95,7 @@ void IntlDisplayNames::initializeDisplay
     m_style = intlOption<Style>(globalObject, options, vm.propertyNames->style, { { "narrow"_s, Style::Narrow }, { "short"_s, Style::Short }, { "long"_s, Style::Long } }, "style must be either \"narrow\", \"short\", or \"long\""_s, Style::Long);
     RETURN_IF_EXCEPTION(scope, void());
 
-    auto type = intlOption<std::optional<Type>>(globalObject, options, vm.propertyNames->type, { { "language"_s, Type::Language }, { "region"_s, Type::Region }, { "script"_s, Type::Script }, { "currency"_s, Type::Currency }, { "calendar"_s, Type::Calendar }, { "dateTimeField"_s, Type::DateTimeField } }, "type must be either \"language\", \"region\", \"script\", \"currency\", \"calendar\", or \"dateTimeField\""_s, std::nullopt);
+    auto type = intlOption<std::optional<Type>>(globalObject, options, vm.propertyNames->type, { { "language"_s, Type::Language }, { "region"_s, Type::Region }, { "script"_s, Type::Script }, { "currency"_s, Type::Currency } }, "type must be either \"language\", \"region\", \"script\", or \"currency\""_s, std::nullopt);
     RETURN_IF_EXCEPTION(scope, void());
     if (!type) {
         throwTypeError(globalObject, scope, "type must not be undefined"_s);
@@ -104,18 +103,16 @@ void IntlDisplayNames::initializeDisplay
     }
     m_type = type.value();
 
-    m_fallback = intlOption<Fallback>(globalObject, options, vm.propertyNames->fallback, { { "code"_s, Fallback::Code }, { "none"_s, Fallback::None } }, "fallback must be either \"code\" or \"none\""_s, Fallback::Code);
-    RETURN_IF_EXCEPTION(scope, void());
-
-    m_languageDisplay = intlOption<LanguageDisplay>(globalObject, options, vm.propertyNames->languageDisplay, { { "dialect"_s, LanguageDisplay::Dialect }, { "standard"_s, LanguageDisplay::Standard } }, "languageDisplay must be either \"dialect\" or \"standard\""_s, LanguageDisplay::Dialect);
+    m_fallback = intlOption<Fallback>(globalObject, options, Identifier::fromString(vm, "fallback"_s), { { "code"_s, Fallback::Code }, { "none"_s, Fallback::None } }, "fallback must be either \"code\" or \"none\""_s, Fallback::Code);
     RETURN_IF_EXCEPTION(scope, void());
 
     UErrorCode status = U_ZERO_ERROR;
 
     UDisplayContext contexts[] = {
         // en_GB displays as 'English (United Kingdom)' (Standard Names) or 'British English' (Dialect Names).
+        // We use Dialect Names here, aligned to the examples in the spec draft and V8's behavior.
         // https://github.com/tc39/proposal-intl-displaynames#language-display-names
-        (m_type == Type::Language && m_languageDisplay == LanguageDisplay::Standard) ? UDISPCTX_STANDARD_NAMES : UDISPCTX_DIALECT_NAMES,
+        UDISPCTX_DIALECT_NAMES,
 
         // Capitailization mode can be picked from several options. Possibly either UDISPCTX_CAPITALIZATION_NONE or UDISPCTX_CAPITALIZATION_FOR_STANDALONE is
         // preferable in Intl.DisplayNames. We use UDISPCTX_CAPITALIZATION_FOR_STANDALONE because it makes standalone date format better (fr "Juillet 2008" in ICU test suites),
@@ -146,86 +143,15 @@ JSValue IntlDisplayNames::of(JSGlobalObj
     VM& vm = globalObject->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
 
+#if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
     ASSERT(m_displayNames);
     auto code = codeValue.toWTFString(globalObject);
     RETURN_IF_EXCEPTION(scope, { });
 
-    // https://tc39.es/proposal-intl-displaynames/#sec-canonicalcodefordisplaynames
-    auto canonicalizeCodeForDisplayNames = [](Type type, String&& code) -> CString {
-        ASSERT(code.isAllASCII());
-        switch (type) {
-        case Type::Language: {
-            return canonicalizeUnicodeLocaleID(code.ascii()).ascii();
-        }
-        case Type::Region: {
-            // Let code be the result of mapping code to upper case as described in 6.1.
-            auto result = code.ascii();
-            char* mutableData = result.mutableData();
-            for (unsigned index = 0; index < result.length(); ++index)
-                mutableData[index] = toASCIIUpper(mutableData[index]);
-            return result;
-        }
-        case Type::Script: {
-            // Let code be the result of mapping the first character in code to upper case, and mapping the second, third and fourth character in code to lower case, as described in 6.1.
-            auto result = code.ascii();
-            char* mutableData = result.mutableData();
-            if (result.length() >= 1)
-                mutableData[0] = toASCIIUpper(mutableData[0]);
-            for (unsigned index = 1; index < result.length(); ++index)
-                mutableData[index] = toASCIILower(mutableData[index]);
-            return result;
-        }
-        case Type::Currency:
-            ASSERT_NOT_REACHED();
-            break;
-        case Type::Calendar: {
-            // Let code be the result of mapping code to lower case as described in 6.1.
-            String lowered = code.convertToASCIILowercase();
-            if (auto mapped = mapBCP47ToICUCalendarKeyword(lowered))
-                lowered = WTFMove(mapped.value());
-            return lowered.ascii();
-        }
-        case Type::DateTimeField: {
-            ASSERT_NOT_REACHED();
-            break;
-        }
-        }
-        return { };
-    };
-
     Vector<UChar, 32> buffer;
     UErrorCode status = U_ZERO_ERROR;
-    CString canonicalCode;
-    switch (m_type) {
-    case Type::Language: {
-        if (!isUnicodeLanguageId(code)) {
-            throwRangeError(globalObject, scope, "argument is not a language id"_s);
-            return { };
-        }
-        canonicalCode = canonicalizeCodeForDisplayNames(m_type, WTFMove(code));
-        // Do not use uldn_languageDisplayName since it is not expected one for this "language" type. It returns "en-US" for "en-US" code, instead of "American English".
-        status = callBufferProducingFunction(uldn_localeDisplayName, m_displayNames.get(), canonicalCode.data(), buffer);
-        break;
-    }
-    case Type::Region: {
-        if (!isUnicodeRegionSubtag(code)) {
-            throwRangeError(globalObject, scope, "argument is not a region subtag"_s);
-            return { };
-        }
-        canonicalCode = canonicalizeCodeForDisplayNames(m_type, WTFMove(code));
-        status = callBufferProducingFunction(uldn_regionDisplayName, m_displayNames.get(), canonicalCode.data(), buffer);
-        break;
-    }
-    case Type::Script: {
-        if (!isUnicodeScriptSubtag(code)) {
-            throwRangeError(globalObject, scope, "argument is not a script subtag"_s);
-            return { };
-        }
-        canonicalCode = canonicalizeCodeForDisplayNames(m_type, WTFMove(code));
-        status = callBufferProducingFunction(uldn_scriptDisplayName, m_displayNames.get(), canonicalCode.data(), buffer);
-        break;
-    }
-    case Type::Currency: {
+
+    if (m_type == Type::Currency) {
         // We do not use uldn_keyValueDisplayName + "currency". This is because of the following reasons.
         //     1. ICU does not respect UDISPCTX_LENGTH_FULL / UDISPCTX_LENGTH_SHORT in its implementation.
         //     2. There is no way to set "narrow" style in ULocaleDisplayNames while currency have "narrow" symbol style.
@@ -271,85 +197,91 @@ JSValue IntlDisplayNames::of(JSGlobalObj
         // ICU API document.
         // > Returns pointer to display string of 'len' UChars. If the resource data contains no entry for 'currency', then 'currency' itself is returned.
         if (status == U_USING_DEFAULT_WARNING && result == currency)
-            return (m_fallback == Fallback::None) ? jsUndefined() : jsString(vm, String(currency, 3));
+            return (m_fallback == Fallback::None) ? jsUndefined() : codeValue;
         return jsString(vm, String(result, length));
     }
-    case Type::Calendar: {
-        // a. If code does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
-        if (!isUnicodeLocaleIdentifierType(code)) {
-            throwRangeError(globalObject, scope, "argument is not a calendar code"_s);
-            return { };
-        }
-        canonicalCode = canonicalizeCodeForDisplayNames(m_type, WTFMove(code));
-        status = callBufferProducingFunction(uldn_keyValueDisplayName, m_displayNames.get(), "calendar", canonicalCode.data(), buffer);
-        break;
-    }
-    case Type::DateTimeField: {
-        // We do not use uldn_keyValueDisplayName since it cannot handle narrow length.
-        // Instead, we use udatpg_getFieldDisplayName.
-
-        // https://tc39.es/intl-displaynames-v2/#sec-isvaliddatetimefieldcode
-        auto isValidDateTimeFieldCode = [](const String& code) -> std::optional<UDateTimePatternField> {
-            if (code == "era"_s)
-                return UDATPG_ERA_FIELD;
-            if (code == "year"_s)
-                return UDATPG_YEAR_FIELD;
-            if (code == "quarter"_s)
-                return UDATPG_QUARTER_FIELD;
-            if (code == "month"_s)
-                return UDATPG_MONTH_FIELD;
-            if (code == "weekOfYear"_s)
-                return UDATPG_WEEK_OF_YEAR_FIELD;
-            if (code == "weekday"_s)
-                return UDATPG_WEEKDAY_FIELD;
-            if (code == "day"_s)
-                return UDATPG_DAY_FIELD;
-            if (code == "dayPeriod"_s)
-                return UDATPG_DAYPERIOD_FIELD;
-            if (code == "hour"_s)
-                return UDATPG_HOUR_FIELD;
-            if (code == "minute"_s)
-                return UDATPG_MINUTE_FIELD;
-            if (code == "second"_s)
-                return UDATPG_SECOND_FIELD;
-            if (code == "timeZoneName"_s)
-                return UDATPG_ZONE_FIELD;
-            return std::nullopt;
-        };
 
-        auto field = isValidDateTimeFieldCode(code);
-        if (!field) {
-            throwRangeError(globalObject, scope, "argument is not a dateTimeField code"_s);
-            return { };
+    // https://tc39.es/proposal-intl-displaynames/#sec-canonicalcodefordisplaynames
+    auto canonicalizeCodeForDisplayNames = [](Type type, const String& code) -> CString {
+        ASSERT(code.isAllASCII());
+        auto result = code.ascii();
+        char* mutableData = result.mutableData();
+        switch (type) {
+        case Type::Language: {
+            // Let code be the result of mapping code to lower case as described in 6.1.
+            for (unsigned index = 0; index < result.length(); ++index)
+                mutableData[index] = toASCIILower(mutableData[index]);
+            break;
         }
-
-        UDateTimePGDisplayWidth style = UDATPG_WIDE;
-        switch (m_style) {
-        case Style::Long:
-            style = UDATPG_WIDE;
+        case Type::Region: {
+            // Let code be the result of mapping code to upper case as described in 6.1.
+            for (unsigned index = 0; index < result.length(); ++index)
+                mutableData[index] = toASCIIUpper(mutableData[index]);
             break;
-        case Style::Short:
-            style = UDATPG_ABBREVIATED;
+        }
+        case Type::Script: {
+            // Let code be the result of mapping the first character in code to upper case, and mapping the second, third and fourth character in code to lower case, as described in 6.1.
+            if (result.length() >= 1)
+                mutableData[0] = toASCIIUpper(mutableData[0]);
+            for (unsigned index = 1; index < result.length(); ++index)
+                mutableData[index] = toASCIILower(mutableData[index]);
             break;
-        case Style::Narrow:
-            style = UDATPG_NARROW;
+        case Type::Currency:
+            ASSERT_NOT_REACHED();
             break;
         }
+        return result;
+    };
 
-        buffer = vm.intlCache().getFieldDisplayName(m_localeCString.data(), field.value(), style, status);
-        if (U_FAILURE(status))
-            return (m_fallback == Fallback::None) ? jsUndefined() : jsString(vm, WTFMove(code));
-        return jsString(vm, String(WTFMove(buffer)));
+    switch (m_type) {
+    case Type::Language: {
+        // If code does not matches the unicode_language_id production, throw a RangeError exception
+        if (!isUnicodeLanguageId(code)) {
+            throwRangeError(globalObject, scope, "argument is not a language id"_s);
+            return { };
+        }
+        auto language = canonicalizeCodeForDisplayNames(m_type, code);
+        // Do not use uldn_languageDisplayName since it is not expected one for this "language" type. It returns "en-US" for "en-US" code, instead of "American English".
+        status = callBufferProducingFunction(uldn_localeDisplayName, m_displayNames.get(), language.data(), buffer);
+        break;
+    }
+    case Type::Region: {
+        // If code does not matches the unicode_region_subtag production, throw a RangeError exception
+        if (!isUnicodeRegionSubtag(code)) {
+            throwRangeError(globalObject, scope, "argument is not a region subtag"_s);
+            return { };
+        }
+        auto region = canonicalizeCodeForDisplayNames(m_type, code);
+        status = callBufferProducingFunction(uldn_regionDisplayName, m_displayNames.get(), region.data(), buffer);
+        break;
+    }
+    case Type::Script: {
+        // If code does not matches the unicode_script_subtag production, throw a RangeError exception
+        if (!isUnicodeScriptSubtag(code)) {
+            throwRangeError(globalObject, scope, "argument is not a script subtag"_s);
+            return { };
+        }
+        auto script = canonicalizeCodeForDisplayNames(m_type, code);
+        status = callBufferProducingFunction(uldn_scriptDisplayName, m_displayNames.get(), script.data(), buffer);
+        break;
     }
+    case Type::Currency:
+        ASSERT_NOT_REACHED();
+        break;
     }
     if (U_FAILURE(status)) {
         // uldn_localeDisplayName, uldn_regionDisplayName, and uldn_scriptDisplayName return U_ILLEGAL_ARGUMENT_ERROR if the display-name is not found.
         // We should return undefined if fallback is "none". Otherwise, we should return input value.
         if (status == U_ILLEGAL_ARGUMENT_ERROR)
-            return (m_fallback == Fallback::None) ? jsUndefined() : jsString(vm, String(canonicalCode.data(), canonicalCode.length()));
+            return (m_fallback == Fallback::None) ? jsUndefined() : codeValue;
         return throwTypeError(globalObject, scope, "Failed to query a display name."_s);
     }
     return jsString(vm, String(WTFMove(buffer)));
+#else
+    UNUSED_PARAM(codeValue);
+    throwTypeError(globalObject, scope, "Failed to initialize Intl.DisplayNames since used feature is not supported in the linked ICU version"_s);
+    return { };
+#endif
 }
 
 // https://tc39.es/proposal-intl-displaynames/#sec-Intl.DisplayNames.prototype.resolvedOptions
@@ -360,9 +292,7 @@ JSObject* IntlDisplayNames::resolvedOpti
     options->putDirect(vm, vm.propertyNames->locale, jsString(vm, m_locale));
     options->putDirect(vm, vm.propertyNames->style, jsNontrivialString(vm, styleString(m_style)));
     options->putDirect(vm, vm.propertyNames->type, jsNontrivialString(vm, typeString(m_type)));
-    options->putDirect(vm, vm.propertyNames->fallback, jsNontrivialString(vm, fallbackString(m_fallback)));
-    if (m_type == Type::Language)
-        options->putDirect(vm, vm.propertyNames->languageDisplay, jsNontrivialString(vm, languageDisplayString(m_languageDisplay)));
+    options->putDirect(vm, Identifier::fromString(vm, "fallback"_s), jsNontrivialString(vm, fallbackString(m_fallback)));
     return options;
 }
 
@@ -391,10 +321,6 @@ ASCIILiteral IntlDisplayNames::typeStrin
         return "script"_s;
     case Type::Currency:
         return "currency"_s;
-    case Type::Calendar:
-        return "calendar"_s;
-    case Type::DateTimeField:
-        return "dateTimeField"_s;
     }
     ASSERT_NOT_REACHED();
     return { };
@@ -410,18 +336,6 @@ ASCIILiteral IntlDisplayNames::fallbackS
     }
     ASSERT_NOT_REACHED();
     return { };
-}
-
-ASCIILiteral IntlDisplayNames::languageDisplayString(LanguageDisplay languageDisplay)
-{
-    switch (languageDisplay) {
-    case LanguageDisplay::Dialect:
-        return "dialect"_s;
-    case LanguageDisplay::Standard:
-        return "standard"_s;
-    }
-    ASSERT_NOT_REACHED();
-    return { };
 }
 
 } // namespace JSC
diff -urp webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlDisplayNames.h webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlDisplayNames.h
--- webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlDisplayNames.h	2022-08-31 02:59:51.770492800 -0500
+++ webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlDisplayNames.h	2022-09-09 17:51:45.353921333 -0500
@@ -65,14 +65,12 @@ private:
     void finishCreation(VM&);
 
     enum class Style : uint8_t { Narrow, Short, Long };
-    enum class Type : uint8_t { Language, Region, Script, Currency, Calendar, DateTimeField };
+    enum class Type : uint8_t { Language, Region, Script, Currency };
     enum class Fallback : uint8_t { Code, None };
-    enum class LanguageDisplay : uint8_t { Dialect, Standard };
 
     static ASCIILiteral styleString(Style);
     static ASCIILiteral typeString(Type);
     static ASCIILiteral fallbackString(Fallback);
-    static ASCIILiteral languageDisplayString(LanguageDisplay);
 
     using ULocaleDisplayNamesDeleter = ICUDeleter<uldn_close>;
     std::unique_ptr<ULocaleDisplayNames, ULocaleDisplayNamesDeleter> m_displayNames;
@@ -83,7 +81,6 @@ private:
     Style m_style { Style::Long };
     Type m_type { Type::Language };
     Fallback m_fallback { Fallback::Code };
-    LanguageDisplay m_languageDisplay { LanguageDisplay::Dialect };
 };
 
 } // namespace JSC
diff -urp webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlObject.cpp webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlObject.cpp
--- webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlObject.cpp	2022-08-31 02:59:51.770492800 -0500
+++ webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlObject.cpp	2022-09-09 17:51:45.353921333 -0500
@@ -675,7 +675,7 @@ bool isUnicodeLocaleIdentifierType(Strin
 }
 
 // https://tc39.es/ecma402/#sec-canonicalizeunicodelocaleid
-String canonicalizeUnicodeLocaleID(const CString& tag)
+static String canonicalizeLanguageTag(const CString& tag)
 {
     auto buffer = localeIDBufferForLanguageTagWithNullTerminator(tag);
     if (buffer.isEmpty())
@@ -751,7 +751,7 @@ Vector<String> canonicalizeLocaleList(JS
 
             if (isStructurallyValidLanguageTag(tag)) {
                 ASSERT(tag.isAllASCII());
-                String canonicalizedTag = canonicalizeUnicodeLocaleID(tag.ascii());
+                String canonicalizedTag = canonicalizeLanguageTag(tag.ascii());
                 if (!canonicalizedTag.isNull()) {
                     if (seenSet.add(canonicalizedTag).isNewEntry)
                         seen.append(canonicalizedTag);
@@ -788,14 +788,14 @@ String defaultLocale(JSGlobalObject* glo
     // be determined by WebCore-specific logic like some WK settings. Usually this will return the
     // same thing as userPreferredLanguages()[0].
     if (auto defaultLanguage = globalObject->globalObjectMethodTable()->defaultLanguage) {
-        String locale = canonicalizeUnicodeLocaleID(defaultLanguage().utf8());
+        String locale = canonicalizeLanguageTag(defaultLanguage().utf8());
         if (!locale.isEmpty())
             return locale;
     }
 
     Vector<String> languages = userPreferredLanguages();
     for (const auto& language : languages) {
-        String locale = canonicalizeUnicodeLocaleID(language.utf8());
+        String locale = canonicalizeLanguageTag(language.utf8());
         if (!locale.isEmpty())
             return locale;
     }
@@ -1519,19 +1519,9 @@ std::optional<String> mapICUCalendarKeyw
     return std::nullopt;
 }
 
-std::optional<String> mapBCP47ToICUCalendarKeyword(const String& calendar)
-{
-    if (calendar == "gregory"_s)
-        return "gregorian"_s;
-    if (calendar == "islamicc"_s)
-        return "islamic-civil"_s;
-    if (calendar == "ethioaa"_s)
-        return "ethiopic-amete-alem"_s;
-    return std::nullopt;
-}
-
 std::optional<String> mapICUCollationKeywordToBCP47(const String& collation)
 {
+    // Map keyword values to BCP 47 equivalents.
     if (collation == "dictionary"_s)
         return "dict"_s;
     if (collation == "gb2312han"_s)
diff -urp webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlObject.h webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlObject.h
--- webkitgtk-2.37.91.glib/Source/JavaScriptCore/runtime/IntlObject.h	2022-08-31 02:59:51.770492800 -0500
+++ webkitgtk-2.37.91/Source/JavaScriptCore/runtime/IntlObject.h	2022-09-09 17:51:45.353921333 -0500
@@ -154,7 +154,6 @@ bool isUnicodeRegionSubtag(StringView);
 bool isUnicodeVariantSubtag(StringView);
 bool isUnicodeLanguageId(StringView);
 bool isStructurallyValidLanguageTag(StringView);
-String canonicalizeUnicodeLocaleID(const CString& languageTag);
 
 bool isWellFormedCurrencyCode(StringView);
 
@@ -166,7 +165,6 @@ struct UFieldPositionIteratorDeleter {
 
 std::optional<String> mapICUCollationKeywordToBCP47(const String&);
 std::optional<String> mapICUCalendarKeywordToBCP47(const String&);
-std::optional<String> mapBCP47ToICUCalendarKeyword(const String&);
 
 
 inline CalendarID utcTimeZoneID()
openSUSE Build Service is sponsored by