From 49df6944ba0103965456da3a6d20be8cc9df0b86 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 8 Apr 2025 21:33:03 +0000 Subject: [PATCH] import UBI webkit2gtk3-2.48.1-1.el9_5 --- .gitignore | 2 +- .webkit2gtk3.metadata | 2 +- SOURCES/CVE-2025-24201.patch | 54 - SOURCES/denormal-disabler-build.patch | 12 + SOURCES/glib-2-68.patch | 440 +++++++ SOURCES/icu-67.patch | 1572 +++++++++++++++++++++++++ SOURCES/webkitgtk-2.46.6.tar.xz.asc | 16 - SOURCES/webkitgtk-2.48.1.tar.xz.asc | 16 + SPECS/webkit2gtk3.spec | 29 +- 9 files changed, 2066 insertions(+), 77 deletions(-) delete mode 100644 SOURCES/CVE-2025-24201.patch create mode 100644 SOURCES/denormal-disabler-build.patch create mode 100644 SOURCES/glib-2-68.patch create mode 100644 SOURCES/icu-67.patch delete mode 100644 SOURCES/webkitgtk-2.46.6.tar.xz.asc create mode 100644 SOURCES/webkitgtk-2.48.1.tar.xz.asc diff --git a/.gitignore b/.gitignore index 7f031dc..7af52c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/webkitgtk-2.46.6.tar.xz +SOURCES/webkitgtk-2.48.1.tar.xz SOURCES/webkitgtk-keys.gpg diff --git a/.webkit2gtk3.metadata b/.webkit2gtk3.metadata index 58928a5..af17198 100644 --- a/.webkit2gtk3.metadata +++ b/.webkit2gtk3.metadata @@ -1,2 +1,2 @@ -efadc17ef959747f3bef31a464bf7ce85b4b8ff1 SOURCES/webkitgtk-2.46.6.tar.xz +f7939f920f92f6b1395b8573f069d3fb9c085b3f SOURCES/webkitgtk-2.48.1.tar.xz 04b10b8a486542c4551269c20b18b5c1c6cb4f94 SOURCES/webkitgtk-keys.gpg diff --git a/SOURCES/CVE-2025-24201.patch b/SOURCES/CVE-2025-24201.patch deleted file mode 100644 index 64b676d..0000000 --- a/SOURCES/CVE-2025-24201.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 541280709a62351643fa7b456bc1f6d652fd9d0b Mon Sep 17 00:00:00 2001 -From: Kimmo Kinnunen -Date: Wed, 5 Mar 2025 16:49:53 -0800 -Subject: [PATCH] Cherry-pick b48791700366. rdar://146337054 - - WebGL context primitive restart can be toggled from WebContent process - https://bugs.webkit.org/show_bug.cgi?id=285858 - rdar://142693598 - - Reviewed by Cameron McCormack. - - Primitive restart is enabled for WebGL2 and disabled for WebGL 1 - contexts by default. There is no use-case for toggling it from - WCP. Do not pass enable/disable to ANGLE. - - * Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp: - (WebCore::GraphicsContextGLANGLE::disable): - (WebCore::GraphicsContextGLANGLE::enable): - - Canonical link: https://commits.webkit.org/289651.23@safari-7621-branch ---- - .../graphics/angle/GraphicsContextGLANGLE.cpp | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp b/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp -index 39d148172b4f..81c9dff2fb89 100644 ---- a/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp -+++ b/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp -@@ -1169,7 +1169,11 @@ void GraphicsContextGLANGLE::disable(GCGLenum cap) - { - if (!makeContextCurrent()) - return; -- -+ if (cap == PRIMITIVE_RESTART_FIXED_INDEX) { -+ if (m_isForWebGL2) -+ addError(GCGLErrorCode::InvalidOperation); -+ return; -+ } - GL_Disable(cap); - } - -@@ -1203,7 +1207,11 @@ void GraphicsContextGLANGLE::enable(GCGLenum cap) - { - if (!makeContextCurrent()) - return; -- -+ if (cap == PRIMITIVE_RESTART_FIXED_INDEX) { -+ if (!m_isForWebGL2) -+ addError(GCGLErrorCode::InvalidOperation); -+ return; -+ } - GL_Enable(cap); - } - diff --git a/SOURCES/denormal-disabler-build.patch b/SOURCES/denormal-disabler-build.patch new file mode 100644 index 0000000..8660563 --- /dev/null +++ b/SOURCES/denormal-disabler-build.patch @@ -0,0 +1,12 @@ +diff --git a/Source/WebCore/platform/audio/DenormalDisabler.cpp b/Source/WebCore/platform/audio/DenormalDisabler.cpp +index 35715e663ce7..44ba08a33d5d 100644 +--- a/Source/WebCore/platform/audio/DenormalDisabler.cpp ++++ b/Source/WebCore/platform/audio/DenormalDisabler.cpp +@@ -91,7 +91,7 @@ DenormalDisabler::~DenormalDisabler() + } + } + #else +-DenormalDisabler::DenormalDisabler() = default ++DenormalDisabler::DenormalDisabler() = default; + DenormalDisabler::~DenormalDisabler() = default; + #endif diff --git a/SOURCES/glib-2-68.patch b/SOURCES/glib-2-68.patch new file mode 100644 index 0000000..9e44d69 --- /dev/null +++ b/SOURCES/glib-2-68.patch @@ -0,0 +1,440 @@ +From 1fbf677e9c702b0c2fc14f9bb0311d9b10825cc6 Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Mon, 24 Mar 2025 16:10:25 -0500 +Subject: [PATCH] Revert "[GLib] Remove all GLIB_CHECK_VERSION conditionals" + +This reverts commit 85b637b69f1c3a6242420b198d1c173477ce0f22. +--- + Source/WTF/wtf/URL.h | 4 ++-- + Source/WTF/wtf/glib/GRefPtr.cpp | 2 ++ + Source/WTF/wtf/glib/GRefPtr.h | 3 +++ + Source/WTF/wtf/glib/SocketConnection.cpp | 13 +++++++++++++ + Source/WTF/wtf/glib/URLGLib.cpp | 2 ++ + Source/WebCore/platform/LowPowerModeNotifier.h | 2 ++ + .../platform/glib/LowPowerModeNotifierGLib.cpp | 8 ++++++++ + .../platform/network/soup/CertificateInfoSoup.cpp | 8 ++++++++ + Source/WebKit/NetworkProcess/glib/DNSCache.cpp | 12 ++++++++++++ + Source/WebKit/NetworkProcess/glib/DNSCache.h | 2 ++ + .../NetworkProcess/glib/WebKitCachedResolver.cpp | 6 ++++++ + .../glib/WebKitOverridingResolver.cpp | 4 ++++ + Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp | 6 ++++++ + Source/cmake/OptionsGTK.cmake | 13 ++++++++++++- + Source/cmake/OptionsWPE.cmake | 13 ++++++++++++- + 15 files changed, 94 insertions(+), 4 deletions(-) + +diff --git a/Source/WTF/wtf/URL.h b/Source/WTF/wtf/URL.h +index 8a7864508a8e..f065677c68ad 100644 +--- a/Source/WTF/wtf/URL.h ++++ b/Source/WTF/wtf/URL.h +@@ -27,7 +27,7 @@ + + #include + +-#if USE(GLIB) ++#if USE(GLIB) && HAVE(GURI) + #include + #endif + +@@ -237,7 +237,7 @@ public: + WTF_EXPORT_PRIVATE operator NSURL *() const; + #endif + +-#if USE(GLIB) ++#if USE(GLIB) && HAVE(GURI) + WTF_EXPORT_PRIVATE URL(GUri*); + WTF_EXPORT_PRIVATE GRefPtr createGUri() const; + #endif +diff --git a/Source/WTF/wtf/glib/GRefPtr.cpp b/Source/WTF/wtf/glib/GRefPtr.cpp +index 4c15aa9866c0..6faa98b7eab2 100644 +--- a/Source/WTF/wtf/glib/GRefPtr.cpp ++++ b/Source/WTF/wtf/glib/GRefPtr.cpp +@@ -207,6 +207,7 @@ template <> void derefGPtr(GDBusNodeInfo* ptr) + g_dbus_node_info_unref(ptr); + } + ++#if HAVE(GURI) + template <> GUri* refGPtr(GUri* ptr) + { + if (ptr) +@@ -219,6 +220,7 @@ template <> void derefGPtr(GUri* ptr) + if (ptr) + g_uri_unref(ptr); + } ++#endif + + template <> + GArray* refGPtr(GArray* ptr) +diff --git a/Source/WTF/wtf/glib/GRefPtr.h b/Source/WTF/wtf/glib/GRefPtr.h +index 87a9ef9760bf..d6c71c14a981 100644 +--- a/Source/WTF/wtf/glib/GRefPtr.h ++++ b/Source/WTF/wtf/glib/GRefPtr.h +@@ -264,8 +264,11 @@ template <> WTF_EXPORT_PRIVATE GArray* refGPtr(GArray*); + template <> WTF_EXPORT_PRIVATE void derefGPtr(GArray*); + template <> WTF_EXPORT_PRIVATE GResource* refGPtr(GResource*); + template <> WTF_EXPORT_PRIVATE void derefGPtr(GResource*); ++ ++#if HAVE(GURI) + template <> WTF_EXPORT_PRIVATE GUri* refGPtr(GUri*); + template <> WTF_EXPORT_PRIVATE void derefGPtr(GUri*); ++#endif + + template inline T* refGPtr(T* ptr) + { +diff --git a/Source/WTF/wtf/glib/SocketConnection.cpp b/Source/WTF/wtf/glib/SocketConnection.cpp +index d1185aeb2d47..80a622b83eba 100644 +--- a/Source/WTF/wtf/glib/SocketConnection.cpp ++++ b/Source/WTF/wtf/glib/SocketConnection.cpp +@@ -145,7 +145,20 @@ bool SocketConnection::readMessage() + if (!it->value.first.isNull()) { + GUniquePtr variantType(g_variant_type_new(it->value.first.data())); + size_t parametersSize = bodySize.value() - messageNameLength.value(); ++ // g_variant_new_from_data() requires the memory to be properly aligned for the type being loaded, ++ // but it's not possible to know the alignment because g_variant_type_info_query() is not public API. ++ // Since GLib 2.60 g_variant_new_from_data() already checks the alignment and reallocates the buffer ++ // in aligned memory only if needed. For older versions we can simply ensure the memory is 8 aligned. ++#if GLIB_CHECK_VERSION(2, 60, 0) + parameters = g_variant_new_from_data(variantType.get(), messageData, parametersSize, FALSE, nullptr, nullptr); ++#else ++ auto* alignedMemory = fastAlignedMalloc(8, parametersSize); ++ memcpy(alignedMemory, messageData, parametersSize); ++ GRefPtr bytes = g_bytes_new_with_free_func(alignedMemory, parametersSize, [](gpointer data) { ++ fastAlignedFree(data); ++ }, alignedMemory); ++ parameters = g_variant_new_from_bytes(variantType.get(), bytes.get(), FALSE); ++#endif + if (messageIsByteSwapped(flags)) + parameters = adoptGRef(g_variant_byteswap(parameters.get())); + } +diff --git a/Source/WTF/wtf/glib/URLGLib.cpp b/Source/WTF/wtf/glib/URLGLib.cpp +index 589dc1b52f8f..f67fe780f333 100644 +--- a/Source/WTF/wtf/glib/URLGLib.cpp ++++ b/Source/WTF/wtf/glib/URLGLib.cpp +@@ -35,6 +35,7 @@ + + namespace WTF { + ++#if HAVE(GURI) + URL::URL(GUri* uri) + { + if (!uri) { +@@ -56,6 +57,7 @@ GRefPtr URL::createGUri() const + static_cast(G_URI_FLAGS_HAS_PASSWORD | G_URI_FLAGS_ENCODED_PATH | G_URI_FLAGS_ENCODED_QUERY | G_URI_FLAGS_ENCODED_FRAGMENT | G_URI_FLAGS_SCHEME_NORMALIZE | G_URI_FLAGS_PARSE_RELAXED), + nullptr)); + } ++#endif + + bool URL::hostIsIPAddress(StringView host) + { +diff --git a/Source/WebCore/platform/LowPowerModeNotifier.h b/Source/WebCore/platform/LowPowerModeNotifier.h +index c8f2051d77f6..e2ea0dae3292 100644 +--- a/Source/WebCore/platform/LowPowerModeNotifier.h ++++ b/Source/WebCore/platform/LowPowerModeNotifier.h +@@ -61,8 +61,10 @@ private: + RetainPtr m_observer; + LowPowerModeChangeCallback m_callback; + #elif USE(GLIB) ++#if GLIB_CHECK_VERSION(2, 69, 1) + LowPowerModeChangeCallback m_callback; + GRefPtr m_powerProfileMonitor; ++#endif + bool m_lowPowerModeEnabled { false }; + #endif + }; +diff --git a/Source/WebCore/platform/glib/LowPowerModeNotifierGLib.cpp b/Source/WebCore/platform/glib/LowPowerModeNotifierGLib.cpp +index e083cc66934e..7c0f55d089e6 100644 +--- a/Source/WebCore/platform/glib/LowPowerModeNotifierGLib.cpp ++++ b/Source/WebCore/platform/glib/LowPowerModeNotifierGLib.cpp +@@ -28,10 +28,13 @@ namespace WebCore { + + + LowPowerModeNotifier::LowPowerModeNotifier(LowPowerModeChangeCallback&& callback) ++#if GLIB_CHECK_VERSION(2, 69, 1) + : m_callback(WTFMove(callback)) + , m_powerProfileMonitor(adoptGRef(g_power_profile_monitor_dup_default())) + , m_lowPowerModeEnabled(g_power_profile_monitor_get_power_saver_enabled(m_powerProfileMonitor.get())) ++#endif + { ++#if GLIB_CHECK_VERSION(2, 69, 1) + g_signal_connect_swapped(m_powerProfileMonitor.get(), "notify::power-saver-enabled", G_CALLBACK(+[] (LowPowerModeNotifier* self, GParamSpec*, GPowerProfileMonitor* monitor) { + bool powerSaverEnabled = g_power_profile_monitor_get_power_saver_enabled(monitor); + if (self->m_lowPowerModeEnabled != powerSaverEnabled) { +@@ -39,11 +42,16 @@ LowPowerModeNotifier::LowPowerModeNotifier(LowPowerModeChangeCallback&& callback + self->m_callback(self->m_lowPowerModeEnabled); + } + }), this); ++#else ++ UNUSED_PARAM(callback); ++#endif + } + + LowPowerModeNotifier::~LowPowerModeNotifier() + { ++#if GLIB_CHECK_VERSION(2, 69, 1) + g_signal_handlers_disconnect_by_data(m_powerProfileMonitor.get(), this); ++#endif + } + + bool LowPowerModeNotifier::isLowPowerModeEnabled() const +diff --git a/Source/WebCore/platform/network/soup/CertificateInfoSoup.cpp b/Source/WebCore/platform/network/soup/CertificateInfoSoup.cpp +index f32ecca7a300..e81a5433709d 100644 +--- a/Source/WebCore/platform/network/soup/CertificateInfoSoup.cpp ++++ b/Source/WebCore/platform/network/soup/CertificateInfoSoup.cpp +@@ -73,9 +73,11 @@ CertificateInfo CertificateInfo::isolatedCopy() const + certificatesDataList.append(certificateData.release()); + } + ++#if GLIB_CHECK_VERSION(2, 69, 0) + GUniqueOutPtr privateKey; + GUniqueOutPtr privateKeyPKCS11Uri; + g_object_get(m_certificate.get(), "private-key-pem", &privateKey.outPtr(), "private-key-pkcs11-uri", &privateKeyPKCS11Uri.outPtr(), nullptr); ++#endif + + GType certificateType = g_tls_backend_get_certificate_type(g_tls_backend_get_default()); + GRefPtr certificate; +@@ -86,8 +88,10 @@ CertificateInfo CertificateInfo::isolatedCopy() const + certificateType, nullptr, nullptr, + "certificate-pem", certificateData.get(), + "issuer", issuer, ++#if GLIB_CHECK_VERSION(2, 69, 0) + "private-key-pem", certificatesDataList.isEmpty() ? privateKey.get() : nullptr, + "private-key-pkcs11-uri", certificatesDataList.isEmpty() ? privateKeyPKCS11Uri.get() : nullptr, ++#endif + nullptr))); + RELEASE_ASSERT(certificate); + issuer = certificate.get(); +@@ -101,6 +105,7 @@ std::optional CertificateInfo::summary() const + if (!m_certificate) + return std::nullopt; + ++#if GLIB_CHECK_VERSION(2, 69, 0) + CertificateSummary summaryInfo; + + GRefPtr validNotBefore; +@@ -125,6 +130,9 @@ std::optional CertificateInfo::summary() const + } + + return summaryInfo; ++#else ++ return std::nullopt; ++#endif + } + + } // namespace WebCore +diff --git a/Source/WebKit/NetworkProcess/glib/DNSCache.cpp b/Source/WebKit/NetworkProcess/glib/DNSCache.cpp +index db92010baabf..b717b734e8e8 100644 +--- a/Source/WebKit/NetworkProcess/glib/DNSCache.cpp ++++ b/Source/WebKit/NetworkProcess/glib/DNSCache.cpp +@@ -50,9 +50,17 @@ DNSCache::DNSCacheMap& DNSCache::mapForType(Type type) + case Type::Default: + return m_dnsMap; + case Type::IPv4Only: ++#if GLIB_CHECK_VERSION(2, 59, 0) + return m_ipv4Map; ++#else ++ return m_dnsMap; ++#endif + case Type::IPv6Only: ++#if GLIB_CHECK_VERSION(2, 59, 0) + return m_ipv6Map; ++#else ++ return m_dnsMap; ++#endif + } + + RELEASE_ASSERT_NOT_REACHED(); +@@ -118,16 +126,20 @@ void DNSCache::removeExpiredResponsesFired() + { + Locker locker { m_lock }; + removeExpiredResponsesInMap(m_dnsMap); ++#if GLIB_CHECK_VERSION(2, 59, 0) + removeExpiredResponsesInMap(m_ipv4Map); + removeExpiredResponsesInMap(m_ipv6Map); ++#endif + } + + void DNSCache::clear() + { + Locker locker { m_lock }; + m_dnsMap.clear(); ++#if GLIB_CHECK_VERSION(2, 59, 0) + m_ipv4Map.clear(); + m_ipv6Map.clear(); ++#endif + } + + } // namespace WebKit +diff --git a/Source/WebKit/NetworkProcess/glib/DNSCache.h b/Source/WebKit/NetworkProcess/glib/DNSCache.h +index 6aa530f44321..49aded549588 100644 +--- a/Source/WebKit/NetworkProcess/glib/DNSCache.h ++++ b/Source/WebKit/NetworkProcess/glib/DNSCache.h +@@ -65,8 +65,10 @@ private: + + Lock m_lock; + DNSCacheMap m_dnsMap WTF_GUARDED_BY_LOCK(m_lock); ++#if GLIB_CHECK_VERSION(2, 59, 0) + DNSCacheMap m_ipv4Map; + DNSCacheMap m_ipv6Map; ++#endif + RunLoop::Timer m_expiredTimer; + }; + +diff --git a/Source/WebKit/NetworkProcess/glib/WebKitCachedResolver.cpp b/Source/WebKit/NetworkProcess/glib/WebKitCachedResolver.cpp +index 2752ff9cfc2c..7804e8b7a588 100644 +--- a/Source/WebKit/NetworkProcess/glib/WebKitCachedResolver.cpp ++++ b/Source/WebKit/NetworkProcess/glib/WebKitCachedResolver.cpp +@@ -67,7 +67,9 @@ static Vector> addressListGListToVector(GList* addressList + + struct LookupAsyncData { + CString hostname; ++#if GLIB_CHECK_VERSION(2, 59, 0) + DNSCache::Type dnsCacheType { DNSCache::Type::Default }; ++#endif + }; + WEBKIT_DEFINE_ASYNC_DATA_STRUCT(LookupAsyncData) + +@@ -117,6 +119,7 @@ static GList* webkitCachedResolverLookupByNameFinish(GResolver* resolver, GAsync + return static_cast(g_task_propagate_pointer(G_TASK(result), error)); + } + ++#if GLIB_CHECK_VERSION(2, 59, 0) + static inline DNSCache::Type dnsCacheType(GResolverNameLookupFlags flags) + { + // A cache is kept for each type of response to avoid the overcomplication of combining or filtering results. +@@ -177,6 +180,7 @@ static GList* webkitCachedResolverLookupByNameWithFlagsFinish(GResolver* resolve + + return static_cast(g_task_propagate_pointer(G_TASK(result), error)); + } ++#endif // GLIB_CHECK_VERSION(2, 59, 0) + + static char* webkitCachedResolverLookupByAddress(GResolver* resolver, GInetAddress* address, GCancellable* cancellable, GError** error) + { +@@ -219,9 +223,11 @@ static void webkit_cached_resolver_class_init(WebKitCachedResolverClass* klass) + resolverClass->lookup_by_name = webkitCachedResolverLookupByName; + resolverClass->lookup_by_name_async = webkitCachedResolverLookupByNameAsync; + resolverClass->lookup_by_name_finish = webkitCachedResolverLookupByNameFinish; ++#if GLIB_CHECK_VERSION(2, 59, 0) + resolverClass->lookup_by_name_with_flags = webkitCachedResolverLookupByNameWithFlags; + resolverClass->lookup_by_name_with_flags_async = webkitCachedResolverLookupByNameWithFlagsAsync; + resolverClass->lookup_by_name_with_flags_finish = webkitCachedResolverLookupByNameWithFlagsFinish; ++#endif + resolverClass->lookup_by_address = webkitCachedResolverLookupByAddress; + resolverClass->lookup_by_address_async = webkitCachedResolverLookupByAddressAsync; + resolverClass->lookup_by_address_finish = webkitCachedResolverLookupByAddressFinish; +diff --git a/Source/WebKit/NetworkProcess/glib/WebKitOverridingResolver.cpp b/Source/WebKit/NetworkProcess/glib/WebKitOverridingResolver.cpp +index 150d74ed0296..f461e3c695fe 100644 +--- a/Source/WebKit/NetworkProcess/glib/WebKitOverridingResolver.cpp ++++ b/Source/WebKit/NetworkProcess/glib/WebKitOverridingResolver.cpp +@@ -90,6 +90,7 @@ static GList* webkitOverridingResolverLookupByNameFinish(GResolver* resolver, GA + return static_cast(g_task_propagate_pointer(G_TASK(result), error)); + } + ++#if GLIB_CHECK_VERSION(2, 59, 0) + static GList* createLoobackAddressList(WebKitOverridingResolver* resolver, GResolverNameLookupFlags flags) + { + GList* list = nullptr; +@@ -129,6 +130,7 @@ static GList* webkitOverridingResolverLookupByNameWithFlagsFinish(GResolver* res + + return static_cast(g_task_propagate_pointer(G_TASK(result), error)); + } ++#endif // GLIB_CHECK_VERSION(2, 59, 0) + + static char* webkitOverridingResolverLookupByAddress(GResolver* resolver, GInetAddress* address, GCancellable* cancellable, GError** error) + { +@@ -166,9 +168,11 @@ static void webkit_overriding_resolver_class_init(WebKitOverridingResolverClass* + resolverClass->lookup_by_name = webkitOverridingResolverLookupByName; + resolverClass->lookup_by_name_async = webkitOverridingResolverLookupByNameAsync; + resolverClass->lookup_by_name_finish = webkitOverridingResolverLookupByNameFinish; ++#if GLIB_CHECK_VERSION(2, 59, 0) + resolverClass->lookup_by_name_with_flags = webkitOverridingResolverLookupByNameWithFlags; + resolverClass->lookup_by_name_with_flags_async = webkitOverridingResolverLookupByNameWithFlagsAsync; + resolverClass->lookup_by_name_with_flags_finish = webkitOverridingResolverLookupByNameWithFlagsFinish; ++#endif + resolverClass->lookup_by_address = webkitOverridingResolverLookupByAddress; + resolverClass->lookup_by_address_async = webkitOverridingResolverLookupByAddressAsync; + resolverClass->lookup_by_address_finish = webkitOverridingResolverLookupByAddressFinish; +diff --git a/Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp b/Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp +index a73466be12f1..9ab0cfb6f440 100644 +--- a/Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp ++++ b/Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp +@@ -121,11 +121,13 @@ void ArgumentCoder>::encode(Encoder& encoder, const GRe + + encoder << certificatesData; + ++#if GLIB_CHECK_VERSION(2, 69, 0) + GRefPtr privateKey; + GUniqueOutPtr privateKeyPKCS11Uri; + g_object_get(certificate.get(), "private-key", &privateKey.outPtr(), "private-key-pkcs11-uri", &privateKeyPKCS11Uri.outPtr(), nullptr); + encoder << privateKey; + encoder << CString(privateKeyPKCS11Uri.get()); ++#endif + } + + std::optional> ArgumentCoder>::decode(Decoder& decoder) +@@ -138,6 +140,7 @@ std::optional> ArgumentCoder>: + if (!certificatesData->size()) + return GRefPtr(); + ++#if GLIB_CHECK_VERSION(2, 69, 0) + std::optional> privateKey; + decoder >> privateKey; + if (UNLIKELY(!privateKey)) +@@ -147,6 +150,7 @@ std::optional> ArgumentCoder>: + decoder >> privateKeyPKCS11Uri; + if (UNLIKELY(!privateKeyPKCS11Uri)) + return std::nullopt; ++#endif + + GType certificateType = g_tls_backend_get_certificate_type(g_tls_backend_get_default()); + GRefPtr certificate; +@@ -156,8 +160,10 @@ std::optional> ArgumentCoder>: + certificateType, nullptr, nullptr, + "certificate", certificateData.get(), + "issuer", issuer, ++#if GLIB_CHECK_VERSION(2, 69, 0) + "private-key", i == certificatesData->size() - 1 ? privateKey->get() : nullptr, + "private-key-pkcs11-uri", i == certificatesData->size() - 1 ? privateKeyPKCS11Uri->data() : nullptr, ++#endif + nullptr))); + issuer = certificate.get(); + } +diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake +index 60b385861a7c..677ab4e49155 100644 +--- a/Source/cmake/OptionsGTK.cmake ++++ b/Source/cmake/OptionsGTK.cmake +@@ -7,7 +7,6 @@ SET_PROJECT_VERSION(2 48 0) + + set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string") + +-find_package(GLIB 2.70.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule) + find_package(Cairo 1.16.0 REQUIRED) + find_package(LibGcrypt 1.7.0 REQUIRED) + find_package(Libtasn1 REQUIRED) +@@ -205,6 +204,13 @@ else () + SET_AND_EXPOSE_TO_BUILD(ENABLE_2022_GLIB_API OFF) + endif () + ++if (ENABLE_2022_GLIB_API) ++ set(GLIB_MINIMUM_VERSION 2.70.0) ++else () ++ set(GLIB_MINIMUM_VERSION 2.56.4) ++endif () ++find_package(GLIB ${GLIB_MINIMUM_VERSION} REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule) ++ + EXPOSE_STRING_VARIABLE_TO_BUILD(WEBKITGTK_API_INFIX) + EXPOSE_STRING_VARIABLE_TO_BUILD(WEBKITGTK_API_VERSION) + +@@ -277,6 +283,11 @@ if (ENABLED_COMPILER_SANITIZERS) + set(ENABLE_DOCUMENTATION OFF) + endif () + ++# GUri is available in GLib since version 2.66, but we only want to use it if version is >= 2.67.1. ++if (PC_GLIB_VERSION VERSION_GREATER "2.67.1" OR PC_GLIB_VERSION STREQUAL "2.67.1") ++ SET_AND_EXPOSE_TO_BUILD(HAVE_GURI 1) ++endif () ++ + if (ENABLE_GAMEPAD) + find_package(Manette 0.2.4) + if (NOT Manette_FOUND) +-- +2.49.0 + diff --git a/SOURCES/icu-67.patch b/SOURCES/icu-67.patch new file mode 100644 index 0000000..1294a3c --- /dev/null +++ b/SOURCES/icu-67.patch @@ -0,0 +1,1572 @@ +From ebc0c4a088acbc523bda3b935b8c59a6568ae318 Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Thu, 27 Mar 2025 15:56:41 -0500 +Subject: [PATCH 1/4] Revert "[CMake] Update minimum ICU version to 70.1" + +This reverts commit 95d71be25d5b838b1171e6b9b2cd526190118fba. +--- + Source/cmake/OptionsGTK.cmake | 6 +++--- + Source/cmake/OptionsJSCOnly.cmake | 2 +- + Source/cmake/OptionsMac.cmake | 2 +- + Source/cmake/OptionsPlayStation.cmake | 2 +- + Source/cmake/OptionsWPE.cmake | 6 +++--- + Source/cmake/OptionsWin.cmake | 2 +- + 6 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake +index 677ab4e49155..57dd75e4d9a8 100644 +--- a/Source/cmake/OptionsGTK.cmake ++++ b/Source/cmake/OptionsGTK.cmake +@@ -10,11 +10,11 @@ set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string") + find_package(Cairo 1.16.0 REQUIRED) + find_package(LibGcrypt 1.7.0 REQUIRED) + find_package(Libtasn1 REQUIRED) +-find_package(HarfBuzz 2.7.4 REQUIRED COMPONENTS ICU) +-find_package(ICU 70.1 REQUIRED COMPONENTS data i18n uc) ++find_package(HarfBuzz 1.4.2 REQUIRED COMPONENTS ICU) ++find_package(ICU 61.2 REQUIRED COMPONENTS data i18n uc) + find_package(JPEG REQUIRED) + find_package(Epoxy 1.5.4 REQUIRED) +-find_package(LibXml2 2.9.13 REQUIRED) ++find_package(LibXml2 2.8.0 REQUIRED) + find_package(PNG REQUIRED) + find_package(SQLite3 REQUIRED) + find_package(Threads REQUIRED) +-- +2.49.0 + + +From e2a9042fb85253f297f136424460526ebf441d4d Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Fri, 28 Mar 2025 14:45:03 -0500 +Subject: [PATCH 2/4] Revert "[JSC] Remove unnecessary ICU version checks" + +This reverts commit af62f09a1fad0b72293a7f0d082704d92116cb9a. +--- + .../runtime/IntlDurationFormat.cpp | 2 +- + .../runtime/IntlNumberFormat.cpp | 12 ++-- + .../runtime/IntlNumberFormatInlines.h | 57 ++++++++++++------- + 3 files changed, 47 insertions(+), 24 deletions(-) + +diff --git a/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp b/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp +index 61264bfe23d9..a1c628082dd5 100644 +--- a/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp ++++ b/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp +@@ -457,7 +457,7 @@ static Vector collectElements(JSGlobalObject* globalObject, const IntlD + + // 3.k. If style is "2-digit", then + // i. Perform ! CreateDataPropertyOrThrow(nfOpts, "minimumIntegerDigits", 2F). +- skeletonBuilder.append(" integer-width/*"_s); ++ skeletonBuilder.append(" integer-width/"_s, WTF::ICU::majorVersion() >= 67 ? '*' : '+'); // Prior to ICU 67, use the symbol + instead of *. + if (style == IntlDurationFormat::UnitStyle::TwoDigit) + skeletonBuilder.append("00"_s); + else +diff --git a/Source/JavaScriptCore/runtime/IntlNumberFormat.cpp b/Source/JavaScriptCore/runtime/IntlNumberFormat.cpp +index 67708f1d8d33..0938d2d5b4a5 100644 +--- a/Source/JavaScriptCore/runtime/IntlNumberFormat.cpp ++++ b/Source/JavaScriptCore/runtime/IntlNumberFormat.cpp +@@ -517,10 +517,14 @@ void IntlNumberFormat::initializeNumberFormat(JSGlobalObject* globalObject, JSVa + skeletonBuilder.append(" sign-except-zero"_s); + break; + case SignDisplay::Negative: +- if (useAccounting) +- skeletonBuilder.append(" sign-accounting-negative"_s); +- else +- skeletonBuilder.append(" sign-negative"_s); ++ // Only ICU69~ supports negative sign display. Ignore this option if linked ICU does not support it. ++ // https://github.com/unicode-org/icu/commit/1aa0dad8e06ecc99bff442dd37f6daa2d39d9a5a ++ if (WTF::ICU::majorVersion() >= 69) { ++ if (useAccounting) ++ skeletonBuilder.append(" sign-accounting-negative"_s); ++ else ++ skeletonBuilder.append(" sign-negative"_s); ++ } + break; + } + +diff --git a/Source/JavaScriptCore/runtime/IntlNumberFormatInlines.h b/Source/JavaScriptCore/runtime/IntlNumberFormatInlines.h +index ddccce2fd112..980da4e3c74a 100644 +--- a/Source/JavaScriptCore/runtime/IntlNumberFormatInlines.h ++++ b/Source/JavaScriptCore/runtime/IntlNumberFormatInlines.h +@@ -199,12 +199,24 @@ void appendNumberFormatDigitOptionsToSkeleton(IntlType* intlInstance, StringBuil + case RoundingMode::Trunc: + skeletonBuilder.append(" rounding-mode-down"_s); + break; +- case RoundingMode::HalfCeil: +- skeletonBuilder.append(" rounding-mode-half-ceiling"_s); ++ case RoundingMode::HalfCeil: { ++ // Only ICU69~ supports half-ceiling. Ignore this option if linked ICU does not support it. ++ // https://github.com/unicode-org/icu/commit/e8dfea9bb6bb27596731173b352759e44ad06b21 ++ if (WTF::ICU::majorVersion() >= 69) ++ skeletonBuilder.append(" rounding-mode-half-ceiling"_s); ++ else ++ skeletonBuilder.append(" rounding-mode-half-up"_s); // Default option. + break; +- case RoundingMode::HalfFloor: +- skeletonBuilder.append(" rounding-mode-half-floor"_s); ++ } ++ case RoundingMode::HalfFloor: { ++ // Only ICU69~ supports half-flooring. Ignore this option if linked ICU does not support it. ++ // https://github.com/unicode-org/icu/commit/e8dfea9bb6bb27596731173b352759e44ad06b21 ++ if (WTF::ICU::majorVersion() >= 69) ++ skeletonBuilder.append(" rounding-mode-half-floor"_s); ++ else ++ skeletonBuilder.append(" rounding-mode-half-up"_s); // Default option. + break; ++ } + case RoundingMode::HalfExpand: + skeletonBuilder.append(" rounding-mode-half-up"_s); + break; +@@ -217,7 +229,7 @@ void appendNumberFormatDigitOptionsToSkeleton(IntlType* intlInstance, StringBuil + } + + // https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#integer-width +- skeletonBuilder.append(" integer-width/*"_s); ++ skeletonBuilder.append(" integer-width/"_s, WTF::ICU::majorVersion() >= 67 ? '*' : '+'); // Prior to ICU 67, use the symbol + instead of *. + for (unsigned i = 0; i < intlInstance->m_minimumIntegerDigits; ++i) + skeletonBuilder.append('0'); + +@@ -255,19 +267,23 @@ void appendNumberFormatDigitOptionsToSkeleton(IntlType* intlInstance, StringBuil + } + case IntlRoundingType::MorePrecision: + case IntlRoundingType::LessPrecision: +- // https://github.com/unicode-org/icu/commit/d7db6c1f8655bb53153695b09a50029fd04a8364 +- // https://github.com/unicode-org/icu/blob/main/docs/userguide/format_parse/numbers/skeletons.md#precision +- skeletonBuilder.append(" ."_s); +- for (unsigned i = 0; i < intlInstance->m_minimumFractionDigits; ++i) +- skeletonBuilder.append('0'); +- for (unsigned i = 0; i < intlInstance->m_maximumFractionDigits - intlInstance->m_minimumFractionDigits; ++i) +- skeletonBuilder.append('#'); +- skeletonBuilder.append('/'); +- for (unsigned i = 0; i < intlInstance->m_minimumSignificantDigits; ++i) +- skeletonBuilder.append('@'); +- for (unsigned i = 0; i < intlInstance->m_maximumSignificantDigits - intlInstance->m_minimumSignificantDigits; ++i) +- skeletonBuilder.append('#'); +- skeletonBuilder.append(intlInstance->m_roundingType == IntlRoundingType::MorePrecision ? 'r' : 's'); ++ // Before Intl.NumberFormat v3, it was CompactRounding mode, where we do not configure anything. ++ // So, if linked ICU is ~68, we do nothing. ++ if (WTF::ICU::majorVersion() >= 69) { ++ // https://github.com/unicode-org/icu/commit/d7db6c1f8655bb53153695b09a50029fd04a8364 ++ // https://github.com/unicode-org/icu/blob/main/docs/userguide/format_parse/numbers/skeletons.md#precision ++ skeletonBuilder.append(" ."_s); ++ for (unsigned i = 0; i < intlInstance->m_minimumFractionDigits; ++i) ++ skeletonBuilder.append('0'); ++ for (unsigned i = 0; i < intlInstance->m_maximumFractionDigits - intlInstance->m_minimumFractionDigits; ++i) ++ skeletonBuilder.append('#'); ++ skeletonBuilder.append('/'); ++ for (unsigned i = 0; i < intlInstance->m_minimumSignificantDigits; ++i) ++ skeletonBuilder.append('@'); ++ for (unsigned i = 0; i < intlInstance->m_maximumSignificantDigits - intlInstance->m_minimumSignificantDigits; ++i) ++ skeletonBuilder.append('#'); ++ skeletonBuilder.append(intlInstance->m_roundingType == IntlRoundingType::MorePrecision ? 'r' : 's'); ++ } + break; + } + } +@@ -278,7 +294,10 @@ void appendNumberFormatDigitOptionsToSkeleton(IntlType* intlInstance, StringBuil + case IntlTrailingZeroDisplay::Auto: + break; + case IntlTrailingZeroDisplay::StripIfInteger: +- skeletonBuilder.append("/w"_s); ++ // Only ICU69~ supports trailing zero display. Ignore this option if linked ICU does not support it. ++ // https://github.com/unicode-org/icu/commit/b79c299f90d4023ac237db3d0335d568bf21cd36 ++ if (WTF::ICU::majorVersion() >= 69) ++ skeletonBuilder.append("/w"_s); + break; + } + } +-- +2.49.0 + + +From 459dffe47b82147919f9ea8e8d4f374389e11ccd Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Fri, 28 Mar 2025 15:01:00 -0500 +Subject: [PATCH 3/4] Revert "[JSC] TimeZone Cache should be per-process level" + +This reverts commit c779aa30eced87609c7c808d672a8f23c5c4821d. +--- + Source/JavaScriptCore/runtime/JSDateMath.cpp | 59 +++++++------------- + 1 file changed, 20 insertions(+), 39 deletions(-) + +diff --git a/Source/JavaScriptCore/runtime/JSDateMath.cpp b/Source/JavaScriptCore/runtime/JSDateMath.cpp +index c6a194568dab..756cbccb1668 100644 +--- a/Source/JavaScriptCore/runtime/JSDateMath.cpp ++++ b/Source/JavaScriptCore/runtime/JSDateMath.cpp +@@ -453,12 +453,9 @@ String DateCache::timeZoneDisplayName(bool isDST) + return m_timeZoneStandardDisplayNameCache; + } + +-static Lock timeZoneCacheLock; +- + #if PLATFORM(COCOA) + static void timeZoneChangeNotification(CFNotificationCenterRef, void*, CFStringRef, const void*, CFDictionaryRef) + { +- Locker locker { timeZoneCacheLock }; + ASSERT(isMainThread()); + ++lastTimeZoneID; + } +@@ -475,40 +472,6 @@ DateCache::DateCache() + #endif + } + +-static std::tuple> retrieveTimeZoneInformation() +-{ +- Locker locker { timeZoneCacheLock }; +- static NeverDestroyed, uint64_t>> globalCache; +- +- bool isCacheStale = true; +- uint64_t currentID = 0; +-#if PLATFORM(COCOA) +- currentID = lastTimeZoneID.load(); +- isCacheStale = std::get<2>(globalCache.get()) != currentID; +-#endif +- if (isCacheStale) { +- Vector timeZoneID; +- getTimeZoneOverride(timeZoneID); +- String canonical; +- UErrorCode status = U_ZERO_ERROR; +- if (timeZoneID.isEmpty()) { +- status = callBufferProducingFunction(ucal_getHostTimeZone, timeZoneID); +- ASSERT_UNUSED(status, U_SUCCESS(status)); +- } +- if (U_SUCCESS(status)) { +- Vector canonicalBuffer; +- auto status = callBufferProducingFunction(ucal_getCanonicalTimeZoneID, timeZoneID.data(), timeZoneID.size(), canonicalBuffer, nullptr); +- if (U_SUCCESS(status)) +- canonical = String(canonicalBuffer); +- } +- if (canonical.isNull() || isUTCEquivalent(canonical)) +- canonical = "UTC"_s; +- +- globalCache.get() = std::tuple { canonical.isolatedCopy(), WTFMove(timeZoneID), currentID }; +- } +- return std::tuple { std::get<0>(globalCache.get()).isolatedCopy(), std::get<1>(globalCache.get()) }; +-} +- + DateCache::~DateCache() = default; + + Ref DateCache::cachedDateInstanceData(double millisecondsFromEpoch) +@@ -519,10 +482,28 @@ Ref DateCache::cachedDateInstanceData(double millisecondsFromE + void DateCache::timeZoneCacheSlow() + { + ASSERT(!m_timeZoneCache); +- auto [canonical, timeZoneID] = retrieveTimeZoneInformation(); ++ ++ Vector timeZoneID; ++ getTimeZoneOverride(timeZoneID); + auto* cache = new OpaqueICUTimeZone; +- cache->m_canonicalTimeZoneID = WTFMove(canonical); ++ ++ String canonical; + UErrorCode status = U_ZERO_ERROR; ++ if (timeZoneID.isEmpty()) { ++ status = callBufferProducingFunction(ucal_getHostTimeZone, timeZoneID); ++ ASSERT_UNUSED(status, U_SUCCESS(status)); ++ } ++ if (U_SUCCESS(status)) { ++ Vector canonicalBuffer; ++ auto status = callBufferProducingFunction(ucal_getCanonicalTimeZoneID, timeZoneID.data(), timeZoneID.size(), canonicalBuffer, nullptr); ++ if (U_SUCCESS(status)) ++ canonical = String(canonicalBuffer); ++ } ++ if (canonical.isNull() || isUTCEquivalent(canonical)) ++ canonical = "UTC"_s; ++ cache->m_canonicalTimeZoneID = WTFMove(canonical); ++ ++ status = U_ZERO_ERROR; + cache->m_calendar = std::unique_ptr>(ucal_open(timeZoneID.data(), timeZoneID.size(), "", UCAL_DEFAULT, &status)); + ASSERT_UNUSED(status, U_SUCCESS(status)); + ucal_setGregorianChange(cache->m_calendar.get(), minECMAScriptTime, &status); // Ignore "unsupported" error. +-- +2.49.0 + + +From af2f8c534482ad7e540ee5da473baff97f05d355 Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Fri, 28 Mar 2025 15:01:11 -0500 +Subject: [PATCH 4/4] Revert "[JSC] Rebaseline Intl implementation based on + lowest dependency ICU 70" + +This reverts commit 31a358087be7e5e70c7a03bdfcf89de35628a2a2. +--- + .../runtime/IntlDateTimeFormat.cpp | 27 ++++ + .../runtime/IntlDateTimeFormat.h | 6 + + .../runtime/IntlDateTimeFormatPrototype.cpp | 6 +- + .../runtime/IntlDurationFormat.cpp | 27 ++++ + .../runtime/IntlDurationFormat.h | 2 + + .../JavaScriptCore/runtime/IntlListFormat.cpp | 24 +++ + .../JavaScriptCore/runtime/IntlListFormat.h | 6 + + .../runtime/IntlNumberFormat.cpp | 150 ++++++++++++++++++ + .../JavaScriptCore/runtime/IntlNumberFormat.h | 35 ++++ + .../runtime/IntlNumberFormatPrototype.cpp | 35 +++- + Source/JavaScriptCore/runtime/IntlObject.cpp | 9 +- + .../runtime/IntlPluralRules.cpp | 41 +++++ + .../JavaScriptCore/runtime/IntlPluralRules.h | 12 +- + .../runtime/IntlPluralRulesPrototype.cpp | 8 +- + .../JavaScriptCore/runtime/IntlWorkaround.cpp | 12 +- + Source/JavaScriptCore/runtime/JSDateMath.cpp | 94 ++++++++++- + 16 files changed, 478 insertions(+), 16 deletions(-) + +diff --git a/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp b/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp +index e3e7671fcf45..2f2371649667 100644 +--- a/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp ++++ b/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp +@@ -42,12 +42,16 @@ + #include + #include + ++#if HAVE(ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS) + #include + #ifdef U_HIDE_DRAFT_API + #undef U_HIDE_DRAFT_API + #endif ++#endif // HAVE(ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS) + #include ++#if HAVE(ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS) + #define U_HIDE_DRAFT_API 1 ++#endif // HAVE(ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS) + + WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN + +@@ -1446,6 +1450,8 @@ UDateIntervalFormat* IntlDateTimeFormat::createDateIntervalFormatIfNecessary(JSG + return m_dateIntervalFormat.get(); + } + ++#if HAVE(ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS) ++ + static std::unique_ptr> formattedValueFromDateRange(UDateIntervalFormat& dateIntervalFormat, UDateFormat& dateFormat, double startDate, double endDate, UErrorCode& status) + { + auto result = std::unique_ptr>(udtitvfmt_openResult(&status)); +@@ -1524,6 +1530,8 @@ static bool dateFieldsPracticallyEqual(const UFormattedValue* formattedValue, UE + return !hasSpan; + } + ++#endif // HAVE(ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS) ++ + JSValue IntlDateTimeFormat::formatRange(JSGlobalObject* globalObject, double startDate, double endDate) + { + ASSERT(m_dateFormat); +@@ -1542,6 +1550,7 @@ JSValue IntlDateTimeFormat::formatRange(JSGlobalObject* globalObject, double sta + auto* dateIntervalFormat = createDateIntervalFormatIfNecessary(globalObject); + RETURN_IF_EXCEPTION(scope, { }); + ++#if HAVE(ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS) + UErrorCode status = U_ZERO_ERROR; + auto result = formattedValueFromDateRange(*dateIntervalFormat, *m_dateFormat, startDate, endDate, status); + if (U_FAILURE(status)) { +@@ -1579,6 +1588,17 @@ JSValue IntlDateTimeFormat::formatRange(JSGlobalObject* globalObject, double sta + replaceNarrowNoBreakSpaceOrThinSpaceWithNormalSpace(buffer); + + return jsString(vm, String(WTFMove(buffer))); ++#else ++ Vector buffer; ++ auto status = callBufferProducingFunction(udtitvfmt_format, dateIntervalFormat, startDate, endDate, buffer, nullptr); ++ if (U_FAILURE(status)) { ++ throwTypeError(globalObject, scope, "Failed to format date interval"_s); ++ return { }; ++ } ++ replaceNarrowNoBreakSpaceOrThinSpaceWithNormalSpace(buffer); ++ ++ return jsString(vm, String(WTFMove(buffer))); ++#endif + } + + JSValue IntlDateTimeFormat::formatRangeToParts(JSGlobalObject* globalObject, double startDate, double endDate) +@@ -1588,6 +1608,7 @@ JSValue IntlDateTimeFormat::formatRangeToParts(JSGlobalObject* globalObject, dou + VM& vm = globalObject->vm(); + auto scope = DECLARE_THROW_SCOPE(vm); + ++#if HAVE(ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS) + // http://tc39.es/proposal-intl-DateTimeFormat-formatRange/#sec-partitiondatetimerangepattern + startDate = timeClip(startDate); + endDate = timeClip(endDate); +@@ -1791,6 +1812,12 @@ JSValue IntlDateTimeFormat::formatRangeToParts(JSGlobalObject* globalObject, dou + } + + return parts; ++#else ++ UNUSED_PARAM(startDate); ++ UNUSED_PARAM(endDate); ++ throwTypeError(globalObject, scope, "Failed to format date interval"_s); ++ return { }; ++#endif + } + + +diff --git a/Source/JavaScriptCore/runtime/IntlDateTimeFormat.h b/Source/JavaScriptCore/runtime/IntlDateTimeFormat.h +index 121417aab9e1..14c476c72f69 100644 +--- a/Source/JavaScriptCore/runtime/IntlDateTimeFormat.h ++++ b/Source/JavaScriptCore/runtime/IntlDateTimeFormat.h +@@ -32,6 +32,12 @@ + + struct UDateIntervalFormat; + ++#if !defined(HAVE_ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS) ++#if U_ICU_VERSION_MAJOR_NUM >= 64 ++#define HAVE_ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS 1 ++#endif ++#endif ++ + namespace JSC { + + enum class RelevantExtensionKey : uint8_t; +diff --git a/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp b/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp +index b7ef4bab865f..694ab7afea0c 100644 +--- a/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp ++++ b/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp +@@ -56,7 +56,6 @@ const ClassInfo IntlDateTimeFormatPrototype::s_info = { "Intl.DateTimeFormat"_s, + @begin dateTimeFormatPrototypeTable + format intlDateTimeFormatPrototypeGetterFormat DontEnum|ReadOnly|CustomAccessor + formatRange intlDateTimeFormatPrototypeFuncFormatRange DontEnum|Function 2 +- formatRangeToParts intlDateTimeFormatPrototypeFuncFormatRangeToParts DontEnum|Function 2 + formatToParts intlDateTimeFormatPrototypeFuncFormatToParts DontEnum|Function 1 + resolvedOptions intlDateTimeFormatPrototypeFuncResolvedOptions DontEnum|Function 0 + @end +@@ -83,7 +82,12 @@ void IntlDateTimeFormatPrototype::finishCreation(VM& vm, JSGlobalObject* globalO + { + Base::finishCreation(vm); + ASSERT(inherits(info())); ++#if HAVE(ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS) ++ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("formatRangeToParts"_s, intlDateTimeFormatPrototypeFuncFormatRangeToParts, static_cast(PropertyAttribute::DontEnum), 2, ImplementationVisibility::Public); ++#else + UNUSED_PARAM(globalObject); ++ UNUSED_PARAM(&intlDateTimeFormatPrototypeFuncFormatRangeToParts); ++#endif + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); + } + +diff --git a/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp b/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp +index a1c628082dd5..78e9106ee0a4 100644 +--- a/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp ++++ b/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp +@@ -36,14 +36,21 @@ + // While UListFormatter APIs are draft in ICU 67, they are stable in ICU 68 with the same function signatures. + // So we can assume that these signatures of draft APIs are stable. + // If UListFormatter is available, UNumberFormatter is also available. ++#if HAVE(ICU_U_LIST_FORMATTER) + #ifdef U_HIDE_DRAFT_API + #undef U_HIDE_DRAFT_API + #endif ++#endif + #include + #include + #include ++#if HAVE(ICU_U_LIST_FORMATTER) + #define U_HIDE_DRAFT_API 1 ++#endif ++ ++#if HAVE(ICU_U_LIST_FORMATTER) + #include ++#endif + + WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN + +@@ -240,6 +247,7 @@ void IntlDurationFormat::initializeDurationFormat(JSGlobalObject* globalObject, + m_fractionalDigits = intlNumberOption(globalObject, options, vm.propertyNames->fractionalDigits, 0, 9, fractionalDigitsUndefinedValue); + RETURN_IF_EXCEPTION(scope, void()); + ++#if HAVE(ICU_U_LIST_FORMATTER) + { + auto toUListFormatterWidth = [](Style style) { + // 6. Let listStyle be durationFormat.[[Style]]. +@@ -266,8 +274,15 @@ void IntlDurationFormat::initializeDurationFormat(JSGlobalObject* globalObject, + return; + } + } ++#else ++ UNUSED_PARAM(IntlDurationFormatInternal::verbose); ++ throwTypeError(globalObject, scope, "Failed to initialize Intl.DurationFormat since this feature is not supported in the linked ICU version"_s); ++ return; ++#endif + } + ++#if HAVE(ICU_U_LIST_FORMATTER) ++ + static String retrieveSeparator(const CString& locale, const String& numberingSystem) + { + ASCIILiteral fallbackTimeSeparator = ":"_s; +@@ -635,12 +650,15 @@ static Vector collectElements(JSGlobalObject* globalObject, const IntlD + return elements; + } + ++#endif ++ + // https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype.format + JSValue IntlDurationFormat::format(JSGlobalObject* globalObject, ISO8601::Duration duration) const + { + VM& vm = globalObject->vm(); + auto scope = DECLARE_THROW_SCOPE(vm); + ++#if HAVE(ICU_U_LIST_FORMATTER) + auto elements = collectElements(globalObject, this, WTFMove(duration)); + RETURN_IF_EXCEPTION(scope, { }); + +@@ -676,6 +694,10 @@ JSValue IntlDurationFormat::format(JSGlobalObject* globalObject, ISO8601::Durati + return throwTypeError(globalObject, scope, "failed to format list of strings"_s); + + return jsString(vm, String(WTFMove(result))); ++#else ++ UNUSED_PARAM(duration); ++ return throwTypeError(globalObject, scope, "failed to format list of strings"_s); ++#endif + } + + // https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype.formatToParts +@@ -684,6 +706,7 @@ JSValue IntlDurationFormat::formatToParts(JSGlobalObject* globalObject, ISO8601: + VM& vm = globalObject->vm(); + auto scope = DECLARE_THROW_SCOPE(vm); + ++#if HAVE(ICU_U_LIST_FORMATTER) + auto elements = collectElements(globalObject, this, WTFMove(duration)); + RETURN_IF_EXCEPTION(scope, { }); + +@@ -836,6 +859,10 @@ JSValue IntlDurationFormat::formatToParts(JSGlobalObject* globalObject, ISO8601: + } + + return parts; ++#else ++ UNUSED_PARAM(duration); ++ return throwTypeError(globalObject, scope, "failed to format list of strings"_s); ++#endif + } + + // https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype.resolvedOptions +diff --git a/Source/JavaScriptCore/runtime/IntlDurationFormat.h b/Source/JavaScriptCore/runtime/IntlDurationFormat.h +index 69e64f9c8332..b3f781a54ad4 100644 +--- a/Source/JavaScriptCore/runtime/IntlDurationFormat.h ++++ b/Source/JavaScriptCore/runtime/IntlDurationFormat.h +@@ -101,7 +101,9 @@ private: + static ASCIILiteral unitStyleString(UnitStyle); + static ASCIILiteral displayString(Display); + ++#if HAVE(ICU_U_LIST_FORMATTER) + std::unique_ptr m_listFormat; ++#endif + String m_locale; + String m_numberingSystem; + CString m_dataLocaleWithExtensions; +diff --git a/Source/JavaScriptCore/runtime/IntlListFormat.cpp b/Source/JavaScriptCore/runtime/IntlListFormat.cpp +index 8fb342027af5..c25cc5f9e90f 100644 +--- a/Source/JavaScriptCore/runtime/IntlListFormat.cpp ++++ b/Source/JavaScriptCore/runtime/IntlListFormat.cpp +@@ -33,12 +33,19 @@ + + // While UListFormatter APIs are draft in ICU 67, they are stable in ICU 68 with the same function signatures. + // So we can assume that these signatures of draft APIs are stable. ++#if HAVE(ICU_U_LIST_FORMATTER) + #ifdef U_HIDE_DRAFT_API + #undef U_HIDE_DRAFT_API + #endif ++#endif + #include ++#if HAVE(ICU_U_LIST_FORMATTER) + #define U_HIDE_DRAFT_API 1 ++#endif ++ ++#if HAVE(ICU_U_LIST_FORMATTER) + #include ++#endif + + WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN + +@@ -107,6 +114,7 @@ void IntlListFormat::initializeListFormat(JSGlobalObject* globalObject, JSValue + m_style = intlOption