From b896e22d66240855a4b04c1aef2a460c37b88365 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Fri, 27 Oct 2023 12:10:26 +0200 Subject: [PATCH] Added fix for mzbz#1861615 --- D192061.1698487416.diff | 107 ++++++++++++++++++++++++++++++++++++++++ firefox.spec | 7 ++- 2 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 D192061.1698487416.diff diff --git a/D192061.1698487416.diff b/D192061.1698487416.diff new file mode 100644 index 0000000..b7a06b4 --- /dev/null +++ b/D192061.1698487416.diff @@ -0,0 +1,107 @@ +diff --git a/widget/gtk/nsUserIdleServiceGTK.cpp b/widget/gtk/nsUserIdleServiceGTK.cpp +--- a/widget/gtk/nsUserIdleServiceGTK.cpp ++++ b/widget/gtk/nsUserIdleServiceGTK.cpp +@@ -149,48 +149,56 @@ + + #ifdef MOZ_ENABLE_DBUS + class UserIdleServiceMutter : public UserIdleServiceImpl { + public: + bool PollIdleTime(uint32_t* aIdleTime) override { +- MOZ_LOG(sIdleLog, LogLevel::Info, +- ("UserIdleServiceMutter::PollIdleTime()\n")); +- +- MOZ_ASSERT(mProxy); +- GUniquePtr error; ++ MOZ_LOG(sIdleLog, LogLevel::Info, ("PollIdleTime() request\n")); + +- RefPtr result = dont_AddRef(g_dbus_proxy_call_sync( +- mProxy, "GetIdletime", nullptr, G_DBUS_CALL_FLAGS_NONE, -1, +- mCancellable, getter_Transfers(error))); +- if (!result) { +- MOZ_LOG(sIdleLog, LogLevel::Info, +- ("UserIdleServiceMutter::PollIdleTime() failed, message: %s\n", +- error->message)); ++ // We're not ready yet ++ if (!mProxy) { + return false; + } +- if (!g_variant_is_of_type(result, G_VARIANT_TYPE_TUPLE) || +- g_variant_n_children(result) != 1) { +- MOZ_LOG( +- sIdleLog, LogLevel::Info, +- ("UserIdleServiceMutter::PollIdleTime() Unexpected params type: %s\n", +- g_variant_get_type_string(result))); +- return false; +- } +- RefPtr iTime = dont_AddRef(g_variant_get_child_value(result, 0)); +- if (!g_variant_is_of_type(iTime, G_VARIANT_TYPE_UINT64)) { +- MOZ_LOG( +- sIdleLog, LogLevel::Info, +- ("UserIdleServiceMutter::PollIdleTime() Unexpected params type: %s\n", +- g_variant_get_type_string(result))); +- return false; +- } +- uint64_t idleTime = g_variant_get_uint64(iTime); +- if (idleTime > std::numeric_limits::max()) { +- idleTime = std::numeric_limits::max(); +- } +- *aIdleTime = idleTime; ++ ++ DBusProxyCall(mProxy, "GetIdletime", nullptr, G_DBUS_CALL_FLAGS_NONE, -1, ++ mCancellable) ++ ->Then( ++ GetCurrentSerialEventTarget(), __func__, ++ // It's safe to capture this as we use mCancellable to stop ++ // listening. ++ [this](RefPtr&& aResult) { ++ if (!g_variant_is_of_type(aResult, G_VARIANT_TYPE_TUPLE) || ++ g_variant_n_children(aResult) != 1) { ++ MOZ_LOG(sIdleLog, LogLevel::Info, ++ ("PollIdleTime() Unexpected params type: %s\n", ++ g_variant_get_type_string(aResult))); ++ mLastIdleTime = 0; ++ return; ++ } ++ RefPtr iTime = ++ dont_AddRef(g_variant_get_child_value(aResult, 0)); ++ if (!g_variant_is_of_type(iTime, G_VARIANT_TYPE_UINT64)) { ++ MOZ_LOG(sIdleLog, LogLevel::Info, ++ ("PollIdleTime() Unexpected params type: %s\n", ++ g_variant_get_type_string(aResult))); ++ mLastIdleTime = 0; ++ return; ++ } ++ uint64_t idleTime = g_variant_get_uint64(iTime); ++ if (idleTime > std::numeric_limits::max()) { ++ idleTime = std::numeric_limits::max(); ++ } ++ mLastIdleTime = idleTime; ++ MOZ_LOG(sIdleLog, LogLevel::Info, ++ ("Async handler got %d\n", mLastIdleTime)); ++ }, ++ [](GUniquePtr&& aError) { ++ g_warning("Failed to call GetIdletime(): %s\n", aError->message); ++ }); ++ ++ *aIdleTime = mLastIdleTime; + MOZ_LOG(sIdleLog, LogLevel::Info, +- ("UserIdleServiceMutter::PollIdleTime() %d\n", *aIdleTime)); ++ ("PollIdleTime() returns %d\n", *aIdleTime)); + return true; + } + + bool ProbeImplementation( + RefPtr aUserIdleServiceGTK) override { +@@ -229,10 +237,11 @@ + } + + private: + RefPtr mProxy; + RefPtr mCancellable; ++ uint32_t mLastIdleTime = 0; + }; + #endif + + void nsUserIdleServiceGTK::ProbeService() { + MOZ_LOG(sIdleLog, LogLevel::Info, + diff --git a/firefox.spec b/firefox.spec index c23dca5..e6a1a70 100644 --- a/firefox.spec +++ b/firefox.spec @@ -169,7 +169,7 @@ ExcludeArch: i686 Summary: Mozilla Firefox Web browser Name: firefox Version: 119.0 -Release: 1%{?pre_tag}%{?dist} +Release: 2%{?pre_tag}%{?dist} URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz @@ -245,6 +245,7 @@ Patch231: fedora-customization.patch Patch402: mozilla-1196777.patch Patch407: mozilla-1667096.patch Patch408: D167159.diff +Patch409: D192061.1698487416.diff # PGO/LTO patches Patch600: pgo.patch @@ -533,6 +534,7 @@ This package contains results of tests executed during build. %patch402 -p1 -b .1196777 %patch407 -p1 -b .1667096 %patch408 -p1 -b .D167159 +%patch409 -p1 -b .D192061 # PGO patches %if %{build_with_pgo} @@ -1123,6 +1125,9 @@ fi #--------------------------------------------------------------------- %changelog +* Fri Oct 27 2023 Martin Stransky - 119.0-2 +- Added fix for mzbz#1861615 + * Tue Oct 24 2023 Martin Stransky - 119.0-1 - Updated to 119.0