Bug 1859865 [Linux] Don't throw error message if DBus operation is canceled r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D192319
This commit is contained in:
stransky 2023-11-06 10:39:10 +00:00
Родитель 7575f7a549
Коммит c576f61eb2
4 изменённых файлов: 30 добавлений и 14 удалений

Просмотреть файл

@ -167,9 +167,13 @@ void UPowerClient::BeginListening() {
UpdateTrackedDevices();
},
[](GUniquePtr<GError>&& aError) {
g_warning(
"Failed to create DBus proxy for org.freedesktop.UPower: %s\n",
aError->message);
if (!g_error_matches(aError.get(), G_IO_ERROR,
G_IO_ERROR_CANCELLED)) {
g_warning(
"Failed to create DBus proxy for org.freedesktop.UPower: "
"%s\n",
aError->message);
}
});
}
@ -275,9 +279,12 @@ void UPowerClient::UpdateTrackedDevices() {
G_CALLBACK(DeviceChanged), this);
},
[this](GUniquePtr<GError>&& aError) {
g_warning(
"Failed to enumerate devices of org.freedesktop.UPower: %s\n",
aError->message);
if (!g_error_matches(aError.get(), G_IO_ERROR,
G_IO_ERROR_CANCELLED)) {
g_warning(
"Failed to enumerate devices of org.freedesktop.UPower: %s\n",
aError->message);
}
g_signal_connect(mUPowerProxy, "g-signal",
G_CALLBACK(DeviceChanged), this);
});

Просмотреть файл

@ -24,6 +24,7 @@
#include "nsNetUtil.h"
#include "nsServiceManagerUtils.h"
#include "WidgetUtilsGtk.h"
#include "AsyncDBus.h"
#include "prio.h"
#define LOGMPRIS(msg, ...) \
@ -318,9 +319,11 @@ void g_bus_get_callback(GObject* aSourceObject, GAsyncResult* aRes,
GDBusConnection* conn = g_bus_get_finish(aRes, getter_Transfers(error));
if (!conn) {
NS_WARNING(nsPrintfCString("Failure at g_bus_get_finish: %s",
error ? error->message : "Unknown Error")
.get());
if (!IsCancelledGError(error.get())) {
NS_WARNING(nsPrintfCString("Failure at g_bus_get_finish: %s",
error ? error->message : "Unknown Error")
.get());
}
return;
}

Просмотреть файл

@ -25,6 +25,7 @@
#ifdef MOZ_ENABLE_DBUS
# include <gio/gio.h>
# include "nsIObserverService.h"
# include "AsyncDBus.h"
#endif
#include "WakeLockListener.h"
#include "gfxPlatform.h"
@ -38,6 +39,7 @@
#endif
using namespace mozilla;
using namespace mozilla::widget;
using mozilla::widget::HeadlessScreenHelper;
using mozilla::widget::ScreenHelperGTK;
using mozilla::widget::ScreenManager;
@ -220,7 +222,7 @@ void nsAppShell::DBusConnectClientResponse(GObject* aObject,
RefPtr<GDBusProxy> proxyClient =
dont_AddRef(g_dbus_proxy_new_finish(aResult, getter_Transfers(error)));
if (!proxyClient) {
if (!g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
if (!IsCancelledGError(error.get())) {
NS_WARNING(
nsPrintfCString("Failed to connect to client: %s\n", error->message)
.get());

Просмотреть файл

@ -196,9 +196,11 @@ class UserIdleServiceMutter : public UserIdleServiceImpl {
},
[this](GUniquePtr<GError>&& aError) {
mPollInProgress = false;
g_warning("Failed to call GetIdletime(): %s\n",
aError->message);
mUserIdleServiceGTK->RejectAndTryNextServiceCallback();
if (!IsCancelledGError(aError.get())) {
g_warning("Failed to call GetIdletime(): %s\n",
aError->message);
mUserIdleServiceGTK->RejectAndTryNextServiceCallback();
}
});
}
@ -227,7 +229,9 @@ class UserIdleServiceMutter : public UserIdleServiceImpl {
mUserIdleServiceGTK->AcceptServiceCallback();
},
[this](GUniquePtr<GError>&& aError) {
mUserIdleServiceGTK->RejectAndTryNextServiceCallback();
if (!IsCancelledGError(aError.get())) {
mUserIdleServiceGTK->RejectAndTryNextServiceCallback();
}
});
return true;
}