1 From: Wolfgang Rosenauer |
1 # HG changeset patch |
2 Subject: Do not use gconf for proxy settings if not running within Gnome |
2 # User Wolfgang Rosenauer |
3 |
3 # Date 1558442915 -7200 |
|
4 # Tue May 21 14:48:35 2019 +0200 |
|
5 # Node ID 6bcf2dfebc1ea2aa34e5cc61152709fc8e409dc5 |
|
6 # Parent 4c434d19d03d5461e54fa22dfb82eaed4cd6631b |
|
7 Do not use gconf for proxy settings if not running within Gnome |
4 Index: toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
8 Index: toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
5 =================================================================== |
9 =================================================================== |
6 RCS file: /cvsroot/mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp,v |
10 RCS file: /cvsroot/mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp,v |
7 retrieving revision 1.1 |
11 retrieving revision 1.1 |
8 |
12 |
9 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
13 diff -r 4c434d19d03d -r 6bcf2dfebc1e toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
10 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
14 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp Wed Jun 12 17:43:18 2019 +0000 |
11 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
15 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp Tue May 21 14:48:35 2019 +0200 |
12 @@ -57,24 +57,27 @@ NS_IMETHODIMP |
16 @@ -55,11 +55,14 @@ |
13 nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) { |
|
14 // dbus prevents us from being threadsafe, but this routine should not block |
|
15 // anyhow |
|
16 *aMainThreadOnly = true; |
|
17 return NS_OK; |
|
18 } |
17 } |
19 |
18 |
20 void nsUnixSystemProxySettings::Init() { |
19 void nsUnixSystemProxySettings::Init() { |
21 - mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
20 - mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
22 - if (mGSettings) { |
21 - if (mGSettings) { |
23 - mGSettings->GetCollectionForSchema( |
22 - mGSettings->GetCollectionForSchema( |
24 - NS_LITERAL_CSTRING("org.gnome.system.proxy"), |
23 - NS_LITERAL_CSTRING("org.gnome.system.proxy"), |
25 - getter_AddRefs(mProxySettings)); |
24 - getter_AddRefs(mProxySettings)); |
26 - } |
|
27 - if (!mProxySettings) { |
|
28 - mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
|
29 + // only use GSettings if that is a GNOME session |
|
30 + const char* sessionType = PR_GetEnv("DESKTOP_SESSION"); |
25 + const char* sessionType = PR_GetEnv("DESKTOP_SESSION"); |
31 + if (sessionType && !strcmp(sessionType, "gnome")) { |
26 + if (sessionType && !strcmp(sessionType, "gnome")) { |
32 + mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
27 + mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
33 + if (mGSettings) { |
28 + if (mGSettings) { |
34 + mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy"), |
29 + mGSettings->GetCollectionForSchema( |
35 + getter_AddRefs(mProxySettings)); |
30 + NS_LITERAL_CSTRING("org.gnome.system.proxy"), |
36 + } |
31 + getter_AddRefs(mProxySettings)); |
37 + if (!mProxySettings) { |
|
38 + mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
|
39 + } |
32 + } |
40 } |
33 } |
41 } |
34 } |
42 |
35 |
43 bool nsUnixSystemProxySettings::IsProxyMode(const char* aMode) { |
|
44 nsAutoCString mode; |
|
45 return NS_SUCCEEDED(mGConf->GetString( |
|
46 NS_LITERAL_CSTRING("/system/proxy/mode"), mode)) && |
|
47 mode.EqualsASCII(aMode); |
|