Resolves: RHEL-181167 Resolves: RHEL-181184 Resolves: RHEL-181198 Resolves: RHEL-181208 Resolves: RHEL-181218 Resolves: RHEL-181229 Resolves: RHEL-181239 Resolves: RHEL-181254 Resolves: RHEL-181264 Resolves: RHEL-181278 Resolves: RHEL-181284 Resolves: RHEL-181296 Resolves: RHEL-181308 Resolves: RHEL-181323 Resolves: RHEL-181335 Resolves: RHEL-181338
243 lines
9.9 KiB
Diff
243 lines
9.9 KiB
Diff
From dbcb36a6555e7c7e58527ac4f797abe4b1782362 Mon Sep 17 00:00:00 2001
|
|
From: Michael Catanzaro <mcatanzaro@redhat.com>
|
|
Date: Fri, 8 Aug 2025 10:55:54 -0500
|
|
Subject: [PATCH] Revert "[GLib] Remove all GLIB_CHECK_VERSION conditionals"
|
|
|
|
This partially reverts commit 85b637b69f1c3a6242420b198d1c173477ce0f22.
|
|
---
|
|
Source/WTF/wtf/URL.h | 4 ++--
|
|
Source/WTF/wtf/glib/GRefPtr.h | 2 ++
|
|
Source/WTF/wtf/glib/URLGLib.cpp | 2 ++
|
|
Source/WebCore/platform/LowPowerModeNotifier.h | 2 ++
|
|
Source/WebCore/platform/glib/LowPowerModeNotifierGLib.cpp | 8 ++++++++
|
|
.../WebCore/platform/network/soup/CertificateInfoSoup.cpp | 8 ++++++++
|
|
Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp | 6 ++++++
|
|
Source/cmake/OptionsGTK.cmake | 8 ++++++--
|
|
8 files changed, 36 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/Source/WTF/wtf/URL.h b/Source/WTF/wtf/URL.h
|
|
index 677314b5c781..f739e6df4892 100644
|
|
--- a/Source/WTF/wtf/URL.h
|
|
+++ b/Source/WTF/wtf/URL.h
|
|
@@ -27,7 +27,7 @@
|
|
|
|
#include <wtf/text/WTFString.h>
|
|
|
|
-#if USE(GLIB)
|
|
+#if USE(GLIB) && HAVE(GURI)
|
|
#include <wtf/glib/GRefPtr.h>
|
|
#endif
|
|
|
|
@@ -240,7 +240,7 @@ public:
|
|
WTF_EXPORT_PRIVATE static NSURL *emptyNSURL();
|
|
#endif
|
|
|
|
-#if USE(GLIB)
|
|
+#if USE(GLIB) && HAVE(GURI)
|
|
WTF_EXPORT_PRIVATE URL(GUri*);
|
|
WTF_EXPORT_PRIVATE GRefPtr<GUri> createGUri() const;
|
|
#endif
|
|
diff --git a/Source/WTF/wtf/glib/GRefPtr.h b/Source/WTF/wtf/glib/GRefPtr.h
|
|
index 46d25f00cc69..d3a764808a6f 100644
|
|
--- a/Source/WTF/wtf/glib/GRefPtr.h
|
|
+++ b/Source/WTF/wtf/glib/GRefPtr.h
|
|
@@ -329,7 +329,9 @@ WTF_DEFINE_GREF_TRAITS_INLINE(GMainLoop, g_main_loop_ref, g_main_loop_unref)
|
|
WTF_DEFINE_GREF_TRAITS_INLINE(GMappedFile, g_mapped_file_ref, g_mapped_file_unref)
|
|
WTF_DEFINE_GREF_TRAITS_INLINE(GPtrArray, g_ptr_array_ref, g_ptr_array_unref)
|
|
WTF_DEFINE_GREF_TRAITS_INLINE(GSource, g_source_ref, g_source_unref)
|
|
+#if HAVE(GURI)
|
|
WTF_DEFINE_GREF_TRAITS_INLINE(GUri, g_uri_ref, g_uri_unref)
|
|
+#endif
|
|
WTF_DEFINE_GREF_TRAITS_INLINE(GVariantBuilder, g_variant_builder_ref, g_variant_builder_unref)
|
|
WTF_DEFINE_GREF_TRAITS_INLINE(GVariant, g_variant_ref_sink, g_variant_unref, g_variant_is_floating)
|
|
|
|
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<GUri> URL::createGUri() const
|
|
static_cast<GUriFlags>(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<WebLowPowerModeObserver> m_observer;
|
|
LowPowerModeChangeCallback m_callback;
|
|
#elif USE(GLIB)
|
|
+#if GLIB_CHECK_VERSION(2, 69, 1)
|
|
LowPowerModeChangeCallback m_callback;
|
|
GRefPtr<GPowerProfileMonitor> 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 c9bf6a774f49..546a974075c6 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(WTF::move(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 fb5773d56767..bc10fda05f78 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<char> privateKey;
|
|
GUniqueOutPtr<char> 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<GTlsCertificate> 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<CertificateSummary> CertificateInfo::summary() const
|
|
if (!m_certificate)
|
|
return std::nullopt;
|
|
|
|
+#if GLIB_CHECK_VERSION(2, 69, 0)
|
|
CertificateSummary summaryInfo;
|
|
|
|
GRefPtr<GDateTime> validNotBefore;
|
|
@@ -125,6 +130,9 @@ std::optional<CertificateSummary> CertificateInfo::summary() const
|
|
}
|
|
|
|
return summaryInfo;
|
|
+#else
|
|
+ return std::nullopt;
|
|
+#endif
|
|
}
|
|
|
|
} // namespace WebCore
|
|
diff --git a/Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp b/Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp
|
|
index 6112a107f99a..b569c48de5ba 100644
|
|
--- a/Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp
|
|
+++ b/Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp
|
|
@@ -121,11 +121,13 @@ void ArgumentCoder<GRefPtr<GTlsCertificate>>::encode(Encoder& encoder, const GRe
|
|
|
|
encoder << certificatesData;
|
|
|
|
+#if GLIB_CHECK_VERSION(2, 69, 0)
|
|
GRefPtr<GByteArray> privateKey;
|
|
GUniqueOutPtr<char> 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<GRefPtr<GTlsCertificate>> ArgumentCoder<GRefPtr<GTlsCertificate>>::decode(Decoder& decoder)
|
|
@@ -138,6 +140,7 @@ std::optional<GRefPtr<GTlsCertificate>> ArgumentCoder<GRefPtr<GTlsCertificate>>:
|
|
if (!certificatesData->size())
|
|
return GRefPtr<GTlsCertificate>();
|
|
|
|
+#if GLIB_CHECK_VERSION(2, 69, 0)
|
|
std::optional<GRefPtr<GByteArray>> privateKey;
|
|
decoder >> privateKey;
|
|
if (!privateKey) [[unlikely]]
|
|
@@ -147,6 +150,7 @@ std::optional<GRefPtr<GTlsCertificate>> ArgumentCoder<GRefPtr<GTlsCertificate>>:
|
|
decoder >> privateKeyPKCS11Uri;
|
|
if (!privateKeyPKCS11Uri) [[unlikely]]
|
|
return std::nullopt;
|
|
+#endif
|
|
|
|
GType certificateType = g_tls_backend_get_certificate_type(g_tls_backend_get_default());
|
|
GRefPtr<GTlsCertificate> certificate;
|
|
@@ -157,8 +161,10 @@ std::optional<GRefPtr<GTlsCertificate>> ArgumentCoder<GRefPtr<GTlsCertificate>>:
|
|
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();
|
|
i++;
|
|
diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake
|
|
index 94fc72774189..6eaecf20d65d 100644
|
|
--- a/Source/cmake/OptionsGTK.cmake
|
|
+++ b/Source/cmake/OptionsGTK.cmake
|
|
@@ -10,8 +10,7 @@ set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string")
|
|
set(ENABLE_UNSAFE_BUFFER_USAGE_WARNING ON)
|
|
list(APPEND WEBKIT_UNSAFE_BUFFER_WARNING_FLAGS -Wno-unsafe-buffer-usage-in-format-attr-call)
|
|
|
|
-# Update Source/WTF/wtf/Platform.h to match required GLib versions.
|
|
-find_package(GLib 2.70.0 REQUIRED COMPONENTS GioUnix Thread Module)
|
|
+find_package(GLib 2.56.4 REQUIRED COMPONENTS GioUnix Thread Module)
|
|
find_package(Cairo 1.16.0 REQUIRED)
|
|
find_package(LibGcrypt 1.7.0 REQUIRED)
|
|
find_package(Soup3 3.0.0 REQUIRED)
|
|
@@ -261,6 +260,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.54.0
|
|
|