commit 13ed0ba6d6948fe6362f150321b223a56a38129b
parent 6423ed49a952e782dc5eed688ac47da5f36e0df9
Author: Cristian Tuns <ctuns@mozilla.com>
Date: Wed, 29 Oct 2025 20:40:40 -0400
Revert "Bug 1996201 [Linux] Ref and check DBus connection r=emilio" for causing xpcshell failures in test_ext_native_messaging_portal.js
This reverts commit f598dd7ca2af87da8919a7e970c38476317da203.
Diffstat:
3 files changed, 0 insertions(+), 83 deletions(-)
diff --git a/widget/gtk/GRefPtr.h b/widget/gtk/GRefPtr.h
@@ -54,7 +54,6 @@ GOBJECT_TRAITS(GdkWindow)
GOBJECT_TRAITS(GtkIconInfo)
GOBJECT_TRAITS(GIcon)
GOBJECT_TRAITS(::GSettings)
-GOBJECT_TRAITS(GDBusConnection)
#undef GOBJECT_TRAITS
diff --git a/widget/gtk/nsAppShell.cpp b/widget/gtk/nsAppShell.cpp
@@ -19,7 +19,6 @@
#include "mozilla/ProfilerLabels.h"
#include "mozilla/ProfilerThreadSleep.h"
#include "mozilla/GUniquePtr.h"
-#include "mozilla/GRefPtr.h"
#include "mozilla/StaticPrefs_widget.h"
#include "mozilla/WidgetUtils.h"
#include "nsIPowerManagerService.h"
@@ -278,32 +277,6 @@ void nsAppShell::DBusConnectClientResponse(GObject* aObject,
}
}
-void nsAppShell::DBusConnectionCheck() {
- if (sAppShell && sAppShell->mDBusConnectionSession &&
- sAppShell->mDBusConnectionSystem) {
- MOZ_DIAGNOSTIC_ASSERT(
- ((GObject*)sAppShell->mDBusConnectionSession.get())->ref_count > 1,
- "Released mDBusConnectionSession connection?!");
- MOZ_DIAGNOSTIC_ASSERT(
- ((GObject*)sAppShell->mDBusConnectionSystem.get())->ref_count > 1,
- "Released mDBusConnectionSystem connection?!");
- }
-}
-
-void nsAppShell::SetConnectionSession(GDBusConnection* aDBusConnectionSession) {
- if (sAppShell) {
- sAppShell->mDBusConnectionSession = aDBusConnectionSession;
- DBusConnectionCheck();
- }
-}
-
-void nsAppShell::SetConnectionSystem(GDBusConnection* aDBusConnectionSystem) {
- if (sAppShell) {
- sAppShell->mDBusConnectionSystem = aDBusConnectionSystem;
- DBusConnectionCheck();
- }
-}
-
// Based on
// https://github.com/lcp/NetworkManager/blob/240f47c892b4e935a3e92fc09eb15163d1fa28d8/src/nm-sleep-monitor-systemd.c
// Use login1 to signal sleep and wake notifications.
@@ -327,42 +300,6 @@ void nsAppShell::StartDBusListening() {
"org.freedesktop.timedate1", "/org/freedesktop/timedate1",
"org.freedesktop.DBus.Properties", mTimedate1ProxyCancellable,
reinterpret_cast<GAsyncReadyCallback>(DBusConnectClientResponse), this);
-
- mDBusGetCancellableSession = dont_AddRef(g_cancellable_new());
- g_bus_get(
- G_BUS_TYPE_SESSION, mDBusGetCancellableSession,
- [](GObject* aSourceObject, GAsyncResult* aRes, gpointer aUserData) {
- GUniquePtr<GError> error;
- GDBusConnection* conn = g_bus_get_finish(aRes, getter_Transfers(error));
- if (!conn) {
- if (!IsCancelledGError(error.get())) {
- NS_WARNING(nsPrintfCString("Failure at g_bus_get_finish: %s",
- error ? error->message : "Unknown Error")
- .get());
- }
- return;
- }
- nsAppShell::SetConnectionSession(conn);
- },
- this);
-
- mDBusGetCancellableSystem = dont_AddRef(g_cancellable_new());
- g_bus_get(
- G_BUS_TYPE_SESSION, mDBusGetCancellableSystem,
- [](GObject* aSourceObject, GAsyncResult* aRes, gpointer aUserData) {
- GUniquePtr<GError> error;
- GDBusConnection* conn = g_bus_get_finish(aRes, getter_Transfers(error));
- if (!conn) {
- if (!IsCancelledGError(error.get())) {
- NS_WARNING(nsPrintfCString("Failure at g_bus_get_finish: %s",
- error ? error->message : "Unknown Error")
- .get());
- }
- return;
- }
- nsAppShell::SetConnectionSystem(conn);
- },
- this);
}
void nsAppShell::StopDBusListening() {
@@ -385,18 +322,6 @@ void nsAppShell::StopDBusListening() {
mTimedate1ProxyCancellable = nullptr;
}
mTimedate1Proxy = nullptr;
-
- DBusConnectionCheck();
- if (mDBusGetCancellableSession) {
- g_cancellable_cancel(mDBusGetCancellableSession);
- mDBusGetCancellableSession = nullptr;
- }
- if (mDBusGetCancellableSystem) {
- g_cancellable_cancel(mDBusGetCancellableSystem);
- mDBusGetCancellableSystem = nullptr;
- }
- mDBusConnectionSession = nullptr;
- mDBusConnectionSystem = nullptr;
}
#endif
diff --git a/widget/gtk/nsAppShell.h b/widget/gtk/nsAppShell.h
@@ -43,9 +43,6 @@ class nsAppShell : public nsBaseAppShell {
gpointer aUserData);
static void DBusConnectClientResponse(GObject* aObject, GAsyncResult* aResult,
gpointer aUserData);
- static void DBusConnectionCheck();
- static void SetConnectionSession(GDBusConnection* aDBusConnectionSession);
- static void SetConnectionSystem(GDBusConnection* aDBusConnectionSystem);
#endif
static void InstallTermSignalHandler();
@@ -67,10 +64,6 @@ class nsAppShell : public nsBaseAppShell {
RefPtr<GCancellable> mLogin1ProxyCancellable;
RefPtr<GDBusProxy> mTimedate1Proxy;
RefPtr<GCancellable> mTimedate1ProxyCancellable;
- RefPtr<GDBusConnection> mDBusConnectionSession;
- RefPtr<GDBusConnection> mDBusConnectionSystem;
- RefPtr<GCancellable> mDBusGetCancellableSession;
- RefPtr<GCancellable> mDBusGetCancellableSystem;
#endif
};