Bug 1544739 - Part 8: Update GNOME shell service - Don't create gnome shell service in headlesss mode. r=frg a=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Wed, 24 Apr 2019 18:54:00 +0200
changeset 32187 92feee89deec2b67c46a4b83dfef9819e6c94cdd
parent 32186 88e664e02706550303c46775597ab97bcada55f0
child 32188 a441444f65f14b5a24b71ea2465469e8c2f5e06e
push id187
push userfrgrahl@gmx.net
push dateWed, 24 Apr 2019 16:55:18 +0000
treeherdercomm-esr60@33e9c7be6768 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg, frg
bugs1544739, 1368211
Bug 1544739 - Part 8: Update GNOME shell service - Don't create gnome shell service in headlesss mode. r=frg a=frg Ports Bug 1368211 [GConf warning during headless marionette test].
suite/components/shell/nsGNOMEShellService.cpp
--- a/suite/components/shell/nsGNOMEShellService.cpp
+++ b/suite/components/shell/nsGNOMEShellService.cpp
@@ -25,16 +25,17 @@
 #include "nsIImageLoadingContent.h"
 #include "imgIRequest.h"
 #include "imgIContainer.h"
 #include "mozilla/Sprintf.h"
 #if defined(MOZ_WIDGET_GTK)
 #include "nsIImageToPixbuf.h"
 #endif
 #include "nsXULAppAPI.h"
+#include "gfxPlatform.h"
 
 #include <glib.h>
 #include <glib-object.h>
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <limits.h>
 #include <stdlib.h>
@@ -97,16 +98,20 @@ GetBrandName(nsACString& aBrandName)
   return rv;
 }
 
 nsresult
 nsGNOMEShellService::Init()
 {
   nsresult rv;
 
+  if (gfxPlatform::IsHeadless()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   // Check G_BROKEN_FILENAMES.  If it's set, then filenames in glib use
   // the locale encoding.  If it's not set, they use UTF-8.
   mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nullptr;
 
  if (GetAppPathFromLauncher()) return NS_OK;
 
   nsCOMPtr<nsIFile> appPath;
   rv = NS_GetSpecialDirectory(XRE_EXECUTABLE_FILE, getter_AddRefs(appPath));