File webkit2gtk3-old-icu.patch of Package webkit2gtk3.31575
diff -urp webkitgtk-2.41.91.orig/Source/cmake/OptionsGTK.cmake webkitgtk-2.41.91/Source/cmake/OptionsGTK.cmake
--- webkitgtk-2.41.91.orig/Source/cmake/OptionsGTK.cmake 2023-09-01 13:39:36.887134236 -0500
+++ webkitgtk-2.41.91/Source/cmake/OptionsGTK.cmake 2023-09-01 13:40:50.030855873 -0500
@@ -18,7 +18,7 @@ find_package(Fontconfig 2.12.6 REQUIRED)
find_package(Freetype 2.9.0 REQUIRED)
find_package(LibGcrypt 1.6.0 REQUIRED)
find_package(HarfBuzz 1.4.2 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(LibEpoxy 1.4.0 REQUIRED)
find_package(LibXml2 2.8.0 REQUIRED)
diff -urp webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/IntlCache.cpp webkitgtk-2.41.91/Source/JavaScriptCore/runtime/IntlCache.cpp
--- webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/IntlCache.cpp 2023-08-09 03:49:32.463903400 -0500
+++ webkitgtk-2.41.91/Source/JavaScriptCore/runtime/IntlCache.cpp 2023-09-01 13:40:14.650667996 -0500
@@ -26,6 +26,7 @@
#include "config.h"
#include "IntlCache.h"
+#include "IntlDisplayNames.h"
#include <wtf/Vector.h>
namespace JSC {
@@ -53,6 +54,7 @@ Vector<UChar, 32> IntlCache::getBestDate
return patternBuffer;
}
+#if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
Vector<UChar, 32> IntlCache::getFieldDisplayName(const CString& locale, UDateTimePatternField field, UDateTimePGDisplayWidth width, UErrorCode& status)
{
auto sharedGenerator = getSharedPatternGenerator(locale, status);
@@ -64,5 +66,6 @@ Vector<UChar, 32> IntlCache::getFieldDis
return { };
return buffer;
}
+#endif
} // namespace JSC
diff -urp webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/IntlCache.h webkitgtk-2.41.91/Source/JavaScriptCore/runtime/IntlCache.h
--- webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/IntlCache.h 2023-08-09 03:49:32.463903400 -0500
+++ webkitgtk-2.41.91/Source/JavaScriptCore/runtime/IntlCache.h 2023-09-01 13:40:14.650667996 -0500
@@ -25,6 +25,7 @@
#pragma once
+#include "IntlDisplayNames.h"
#include <unicode/udatpg.h>
#include <wtf/Noncopyable.h>
#include <wtf/text/CString.h>
@@ -39,7 +40,9 @@ public:
IntlCache() = default;
Vector<UChar, 32> getBestDateTimePattern(const CString& locale, const UChar* skeleton, unsigned skeletonSize, UErrorCode&);
+#if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
Vector<UChar, 32> getFieldDisplayName(const CString& locale, UDateTimePatternField, UDateTimePGDisplayWidth, UErrorCode&);
+#endif
private:
UDateTimePatternGenerator* getSharedPatternGenerator(const CString& locale, UErrorCode& status)
diff -urp webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/IntlDisplayNames.cpp webkitgtk-2.41.91/Source/JavaScriptCore/runtime/IntlDisplayNames.cpp
--- webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/IntlDisplayNames.cpp 2023-08-09 03:49:32.467903400 -0500
+++ webkitgtk-2.41.91/Source/JavaScriptCore/runtime/IntlDisplayNames.cpp 2023-09-01 13:40:14.654001348 -0500
@@ -104,6 +104,7 @@ void IntlDisplayNames::initializeDisplay
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);
RETURN_IF_EXCEPTION(scope, void());
+#if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
UErrorCode status = U_ZERO_ERROR;
UDisplayContext contexts[] = {
@@ -131,6 +132,10 @@ void IntlDisplayNames::initializeDisplay
throwTypeError(globalObject, scope, "failed to initialize DisplayNames"_s);
return;
}
+#else
+ throwTypeError(globalObject, scope, "failed to initialize Intl.DisplayNames since feature is not supported by the ICU version"_s);
+ return;
+#endif
}
// https://tc39.es/proposal-intl-displaynames/#sec-Intl.DisplayNames.prototype.of
@@ -140,6 +145,7 @@ 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, { });
@@ -344,6 +350,11 @@ JSValue IntlDisplayNames::of(JSGlobalObj
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 feature is not supported by the ICU version"_s);
+ return { };
+#endif
}
// https://tc39.es/proposal-intl-displaynames/#sec-Intl.DisplayNames.prototype.resolvedOptions
diff -urp webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/IntlDisplayNames.h webkitgtk-2.41.91/Source/JavaScriptCore/runtime/IntlDisplayNames.h
--- webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/IntlDisplayNames.h 2023-08-09 03:49:32.467903400 -0500
+++ webkitgtk-2.41.91/Source/JavaScriptCore/runtime/IntlDisplayNames.h 2023-09-01 13:40:14.654001348 -0500
@@ -29,6 +29,13 @@
#include <unicode/uldnames.h>
#include <wtf/unicode/icu/ICUHelpers.h>
+#if !defined(HAVE_ICU_U_LOCALE_DISPLAY_NAMES)
+// We need 61 or later since part of implementation uses UCURR_NARROW_SYMBOL_NAME.
+#if U_ICU_VERSION_MAJOR_NUM >= 61
+#define HAVE_ICU_U_LOCALE_DISPLAY_NAMES 1
+#endif
+#endif
+
namespace JSC {
enum class RelevantExtensionKey : uint8_t;
diff -urp webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/IntlObject.cpp webkitgtk-2.41.91/Source/JavaScriptCore/runtime/IntlObject.cpp
--- webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/IntlObject.cpp 2023-08-09 03:49:32.479904000 -0500
+++ webkitgtk-2.41.91/Source/JavaScriptCore/runtime/IntlObject.cpp 2023-09-01 13:40:14.657334699 -0500
@@ -40,9 +40,6 @@
#include "IntlDisplayNames.h"
#include "IntlDisplayNamesConstructor.h"
#include "IntlDisplayNamesPrototype.h"
-#include "IntlDurationFormat.h"
-#include "IntlDurationFormatConstructor.h"
-#include "IntlDurationFormatPrototype.h"
#include "IntlListFormat.h"
#include "IntlListFormatConstructor.h"
#include "IntlListFormatPrototype.h"
@@ -104,13 +101,6 @@ static JSValue createDisplayNamesConstru
return IntlDisplayNamesConstructor::create(vm, IntlDisplayNamesConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<IntlDisplayNamesPrototype*>(globalObject->displayNamesStructure()->storedPrototypeObject()));
}
-static JSValue createDurationFormatConstructor(VM& vm, JSObject* object)
-{
- IntlObject* intlObject = jsCast<IntlObject*>(object);
- JSGlobalObject* globalObject = intlObject->globalObject();
- return IntlDurationFormatConstructor::create(vm, IntlDurationFormatConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<IntlDurationFormatPrototype*>(globalObject->durationFormatStructure()->storedPrototypeObject()));
-}
-
static JSValue createListFormatConstructor(VM& vm, JSObject* object)
{
IntlObject* intlObject = jsCast<IntlObject*>(object);
@@ -165,7 +155,6 @@ namespace JSC {
supportedValuesOf intlObjectFuncSupportedValuesOf DontEnum|Function 1
Collator createCollatorConstructor DontEnum|PropertyCallback
DateTimeFormat createDateTimeFormatConstructor DontEnum|PropertyCallback
- DisplayNames createDisplayNamesConstructor DontEnum|PropertyCallback
Locale createLocaleConstructor DontEnum|PropertyCallback
NumberFormat createNumberFormatConstructor DontEnum|PropertyCallback
PluralRules createPluralRulesConstructor DontEnum|PropertyCallback
@@ -253,12 +242,16 @@ void IntlObject::finishCreation(VM& vm,
Base::finishCreation(vm);
ASSERT(inherits(info()));
JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
+#if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
+ putDirectWithoutTransition(vm, vm.propertyNames->DisplayNames, createDisplayNamesConstructor(vm, this), static_cast<unsigned>(PropertyAttribute::DontEnum));
+#else
+ UNUSED_PARAM(&createDisplayNamesConstructor);
+#endif
#if HAVE(ICU_U_LIST_FORMATTER)
if (Options::useIntlDurationFormat())
putDirectWithoutTransition(vm, vm.propertyNames->DurationFormat, createDurationFormatConstructor(vm, this), static_cast<unsigned>(PropertyAttribute::DontEnum));
putDirectWithoutTransition(vm, vm.propertyNames->ListFormat, createListFormatConstructor(vm, this), static_cast<unsigned>(PropertyAttribute::DontEnum));
#else
- UNUSED_PARAM(&createDurationFormatConstructor);
UNUSED_PARAM(&createListFormatConstructor);
#endif
}
diff -urp webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/JSGlobalObject.cpp webkitgtk-2.41.91/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
--- webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/JSGlobalObject.cpp 2023-08-09 03:49:32.523905300 -0500
+++ webkitgtk-2.41.91/Source/JavaScriptCore/runtime/JSGlobalObject.cpp 2023-09-01 13:40:14.660668050 -0500
@@ -83,8 +83,6 @@
#include "IntlDateTimeFormatPrototype.h"
#include "IntlDisplayNames.h"
#include "IntlDisplayNamesPrototype.h"
-#include "IntlDurationFormat.h"
-#include "IntlDurationFormatPrototype.h"
#include "IntlListFormat.h"
#include "IntlListFormatPrototype.h"
#include "IntlLocale.h"
@@ -1237,12 +1235,6 @@ capitalName ## Constructor* lowerName ##
IntlDisplayNamesPrototype* displayNamesPrototype = IntlDisplayNamesPrototype::create(init.vm, IntlDisplayNamesPrototype::createStructure(init.vm, globalObject, globalObject->objectPrototype()));
init.set(IntlDisplayNames::createStructure(init.vm, globalObject, displayNamesPrototype));
});
- m_durationFormatStructure.initLater(
- [] (const Initializer<Structure>& init) {
- JSGlobalObject* globalObject = jsCast<JSGlobalObject*>(init.owner);
- IntlDurationFormatPrototype* durationFormatPrototype = IntlDurationFormatPrototype::create(init.vm, IntlDurationFormatPrototype::createStructure(init.vm, globalObject, globalObject->objectPrototype()));
- init.set(IntlDurationFormat::createStructure(init.vm, globalObject, durationFormatPrototype));
- });
m_listFormatStructure.initLater(
[] (const Initializer<Structure>& init) {
JSGlobalObject* globalObject = jsCast<JSGlobalObject*>(init.owner);
@@ -2370,7 +2362,6 @@ void JSGlobalObject::visitChildrenImpl(J
thisObject->m_defaultNumberFormat.visit(visitor);
thisObject->m_collatorStructure.visit(visitor);
thisObject->m_displayNamesStructure.visit(visitor);
- thisObject->m_durationFormatStructure.visit(visitor);
thisObject->m_listFormatStructure.visit(visitor);
thisObject->m_localeStructure.visit(visitor);
thisObject->m_pluralRulesStructure.visit(visitor);
diff -urp webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/JSGlobalObject.h webkitgtk-2.41.91/Source/JavaScriptCore/runtime/JSGlobalObject.h
--- webkitgtk-2.41.91.orig/Source/JavaScriptCore/runtime/JSGlobalObject.h 2023-08-09 03:49:32.527905200 -0500
+++ webkitgtk-2.41.91/Source/JavaScriptCore/runtime/JSGlobalObject.h 2023-09-01 13:40:14.664001400 -0500
@@ -224,7 +224,6 @@ public:
LazyProperty<JSGlobalObject, IntlNumberFormat> m_defaultNumberFormat;
LazyProperty<JSGlobalObject, Structure> m_collatorStructure;
LazyProperty<JSGlobalObject, Structure> m_displayNamesStructure;
- LazyProperty<JSGlobalObject, Structure> m_durationFormatStructure;
LazyProperty<JSGlobalObject, Structure> m_listFormatStructure;
LazyProperty<JSGlobalObject, Structure> m_localeStructure;
LazyProperty<JSGlobalObject, Structure> m_pluralRulesStructure;
@@ -821,7 +820,6 @@ public:
Structure* collatorStructure() { return m_collatorStructure.get(this); }
Structure* dateTimeFormatStructure() { return m_dateTimeFormatStructure.get(this); }
Structure* displayNamesStructure() { return m_displayNamesStructure.get(this); }
- Structure* durationFormatStructure() { return m_durationFormatStructure.get(this); }
Structure* listFormatStructure() { return m_listFormatStructure.get(this); }
Structure* numberFormatStructure() { return m_numberFormatStructure.get(this); }
Structure* localeStructure() { return m_localeStructure.get(this); }
diff -urp webkitgtk-2.41.91.orig/Source/JavaScriptCore/Sources.txt webkitgtk-2.41.91/Source/JavaScriptCore/Sources.txt
--- webkitgtk-2.41.91.orig/Source/JavaScriptCore/Sources.txt 2023-08-09 03:49:29.711816800 -0500
+++ webkitgtk-2.41.91/Source/JavaScriptCore/Sources.txt 2023-09-01 13:40:14.664001400 -0500
@@ -851,9 +851,6 @@ runtime/IntlDateTimeFormatPrototype.cpp
runtime/IntlDisplayNames.cpp
runtime/IntlDisplayNamesConstructor.cpp
runtime/IntlDisplayNamesPrototype.cpp
-runtime/IntlDurationFormat.cpp @no-unify // Confine U_HIDE_DRAFT_API's effect in this file.
-runtime/IntlDurationFormatConstructor.cpp
-runtime/IntlDurationFormatPrototype.cpp
runtime/IntlListFormat.cpp @no-unify // Confine U_HIDE_DRAFT_API's effect in this file.
runtime/IntlListFormatConstructor.cpp
runtime/IntlListFormatPrototype.cpp