Bug 1724242 [Linux] Use DBus remote when Firefox is built with --enable-dbus, r=glandium
☠☠ backed out by 36dfe8c27d72 ☠ ☠
authorstransky <stransky@redhat.com>
Sat, 25 Sep 2021 10:04:10 +0000
changeset 593155 117f94e1e765b809972408a2b4943c67e32b0455
parent 593154 0b37ac813de3fe158212974624ba4efc5a0fb1d9
child 593156 36dfe8c27d727bdccfd51435d5dcb3f9c9711dbd
push id38823
push userabutkovits@mozilla.com
push dateSat, 25 Sep 2021 21:37:43 +0000
treeherdermozilla-central@a3f0791a87fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1724242
milestone94.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1724242 [Linux] Use DBus remote when Firefox is built with --enable-dbus, r=glandium Differential Revision: https://phabricator.services.mozilla.com/D124692
toolkit/components/remote/moz.build
toolkit/components/remote/nsRemoteService.cpp
--- a/toolkit/components/remote/moz.build
+++ b/toolkit/components/remote/moz.build
@@ -10,30 +10,33 @@ with Files("**"):
 SOURCES += [
     "nsRemoteService.cpp",
 ]
 
 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
     SOURCES += [
         "nsGTKRemoteServer.cpp",
         "nsUnixRemoteServer.cpp",
-        "nsXRemoteClient.cpp",
-        "nsXRemoteServer.cpp",
         "RemoteUtils.cpp",
     ]
     if CONFIG["MOZ_ENABLE_DBUS"]:
         SOURCES += [
             "nsDBusRemoteClient.cpp",
             "nsDBusRemoteServer.cpp",
         ]
         CXXFLAGS += CONFIG["MOZ_DBUS_GLIB_CFLAGS"]
         EXPORTS += [
             "nsUnixRemoteServer.h",
             "RemoteUtils.h",
         ]
+    else:
+        SOURCES += [
+            "nsXRemoteClient.cpp",
+            "nsXRemoteServer.cpp",
+        ]
     CXXFLAGS += CONFIG["TK_CFLAGS"]
 
 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
     SOURCES += [
         "nsWinRemoteClient.cpp",
         "nsWinRemoteServer.cpp",
         "WinRemoteMessage.cpp",
     ]
--- a/toolkit/components/remote/nsRemoteService.cpp
+++ b/toolkit/components/remote/nsRemoteService.cpp
@@ -8,20 +8,21 @@
 #ifdef XP_UNIX
 #  include <sys/types.h>
 #  include <pwd.h>
 #endif
 
 #ifdef MOZ_WIDGET_GTK
 #  include "mozilla/WidgetUtilsGtk.h"
 #  include "nsGTKRemoteServer.h"
-#  include "nsXRemoteClient.h"
 #  ifdef MOZ_ENABLE_DBUS
 #    include "nsDBusRemoteServer.h"
 #    include "nsDBusRemoteClient.h"
+#  else
+#    include "nsXRemoteClient.h"
 #  endif
 #elif defined(XP_WIN)
 #  include "nsWinRemoteServer.h"
 #  include "nsWinRemoteClient.h"
 #elif defined(XP_DARWIN)
 #  include "nsMacRemoteServer.h"
 #  include "nsMacRemoteClient.h"
 #endif
@@ -35,20 +36,16 @@
 #include "mozilla/CmdLineAndEnvUtils.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/UniquePtr.h"
 
 // Time to wait for the remoting service to start
 #define START_TIMEOUT_SEC 5
 #define START_SLEEP_MSEC 100
 
-// When MOZ_DBUS_REMOTE is set both X11 and Wayland backends
-// use only DBus remote.
-#define DBUS_REMOTE_ENV "MOZ_DBUS_REMOTE"
-
 using namespace mozilla;
 
 extern int gArgc;
 extern char** gArgv;
 
 using namespace mozilla;
 
 NS_IMPL_ISUPPORTS(nsRemoteService, nsIObserver)
@@ -97,29 +94,22 @@ void nsRemoteService::UnlockStartup() {
 }
 
 RemoteResult nsRemoteService::StartClient(const char* aDesktopStartupID) {
   if (mProfile.IsEmpty()) {
     return REMOTE_NOT_FOUND;
   }
 
   UniquePtr<nsRemoteClient> client;
-
 #ifdef MOZ_WIDGET_GTK
-  bool useX11Remote = mozilla::widget::GdkIsX11Display();
-
 #  if defined(MOZ_ENABLE_DBUS)
-  const char* dbusRemoteEnv = getenv(DBUS_REMOTE_ENV);
-  if (!useX11Remote || (dbusRemoteEnv && *dbusRemoteEnv == '1')) {
-    client = MakeUnique<nsDBusRemoteClient>();
-  }
+  client = MakeUnique<nsDBusRemoteClient>();
+#  else
+  client = MakeUnique<nsXRemoteClient>();
 #  endif
-  if (!client && useX11Remote) {
-    client = MakeUnique<nsXRemoteClient>();
-  }
 #elif defined(XP_WIN)
   client = MakeUnique<nsWinRemoteClient>();
 #elif defined(XP_DARWIN)
   client = MakeUnique<nsMacRemoteClient>();
 #else
   return REMOTE_NOT_FOUND;
 #endif
 
@@ -149,26 +139,21 @@ void nsRemoteService::StartupServer() {
     return;
   }
 
   if (mProfile.IsEmpty()) {
     return;
   }
 
 #ifdef MOZ_WIDGET_GTK
-  bool useX11Remote = mozilla::widget::GdkIsX11Display();
-
 #  if defined(MOZ_ENABLE_DBUS)
-  if (!useX11Remote || getenv(DBUS_REMOTE_ENV)) {
-    mRemoteServer = MakeUnique<nsDBusRemoteServer>();
-  }
+  mRemoteServer = MakeUnique<nsDBusRemoteServer>();
+#  else
+  mRemoteServer = MakeUnique<nsGTKRemoteServer>();
 #  endif
-  if (!mRemoteServer && useX11Remote) {
-    mRemoteServer = MakeUnique<nsGTKRemoteServer>();
-  }
 #elif defined(XP_WIN)
   mRemoteServer = MakeUnique<nsWinRemoteServer>();
 #elif defined(XP_DARWIN)
   mRemoteServer = MakeUnique<nsMacRemoteServer>();
 #else
   return;
 #endif