mozilla-nongnome-proxies.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Wed, 29 Sep 2010 14:11:58 +0200
changeset 161 a6dc70babb5f
parent 8 19a8c8d53349
child 367 3fabd9f66322
permissions -rw-r--r--
honour LANGUAGE environment variable (bmo#583793)

From: Wolfgang Rosenauer
Subject: Do not use gconf for proxy settings if not running within Gnome

Index: toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
===================================================================
RCS file: /cvsroot/mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp,v
retrieving revision 1.1
diff -u -p -6 -r1.1 nsUnixSystemProxySettings.cpp
--- toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp	29 Jan 2008 15:58:41 -0000	1.1
+++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp	17 Apr 2008 19:02:19 -0000
@@ -69,13 +69,19 @@ private:
 
 NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
 
 nsresult
 nsUnixSystemProxySettings::Init()
 {
-  mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
+  // If this is a GNOME session, load gconf and try to use its preferences.
+  // If gconf is not available (which would be stupid) we'll proceed as if
+  // this was not a GNOME session, using *_PROXY environment variables.
+  const char* sessionType = PR_GetEnv("DESKTOP_SESSION");
+  if (sessionType && !strcmp(sessionType, "gnome")) {
+    mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
+  }
   return NS_OK;
 }
 
 PRBool
 nsUnixSystemProxySettings::IsProxyMode(const char* aMode)
 {