Mozilla Thunderbird mail/newsgroup client
CentOS Sources
2019-02-04 c45ba07eb6caccd7bde1da7ccecfdf337e1e2cd3
commit | author | age
cf9011 1 diff -up firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
CS 2 --- firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092    2019-01-22 10:48:38.187383614 +0100
3 +++ firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp    2019-01-22 11:26:11.027108692 +0100
4 @@ -225,8 +225,20 @@ nsresult nsReadConfig::openAndEvaluateJS
5      if (NS_FAILED(rv)) return rv;
e2c46b 6  
cf9011 7      rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
CS 8 -    if (NS_FAILED(rv)) return rv;
9 +    if (NS_FAILED(rv)) {
10 +      // Look for cfg file in /etc/<application>/pref
11 +      rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
12 +                                  getter_AddRefs(jsFile));
13 +      NS_ENSURE_SUCCESS(rv, rv);
e2c46b 14 +
cf9011 15 +      rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref"));
CS 16 +      NS_ENSURE_SUCCESS(rv, rv);
17 +      rv = jsFile->AppendNative(nsDependentCString(aFileName));
18 +      NS_ENSURE_SUCCESS(rv, rv);
e2c46b 19  
cf9011 20 +      rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
CS 21 +      NS_ENSURE_SUCCESS(rv, rv);
22 +    }
23    } else {
24      nsAutoCString location("resource://gre/defaults/autoconfig/");
25      location += aFileName;
26 diff -up firefox-60.5.0/modules/libpref/Preferences.cpp.1170092 firefox-60.5.0/modules/libpref/Preferences.cpp
27 --- firefox-60.5.0/modules/libpref/Preferences.cpp.1170092    2019-01-21 17:38:16.000000000 +0100
28 +++ firefox-60.5.0/modules/libpref/Preferences.cpp    2019-01-22 10:48:38.187383614 +0100
29 @@ -3459,6 +3459,8 @@ static nsresult pref_ReadPrefFromJar(nsZ
e2c46b 30    //
CS 31    // Thus, in the omni.jar case, we always load app-specific default
32    // preferences from omni.jar, whether or not `$app == $gre`.
33 +  // At very end load configuration from system config location:
34 +  // - /etc/firefox/pref/*.js
35  
36    nsresult rv;
37    nsZipFind* findPtr;
cf9011 38 diff -up firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp
CS 39 --- firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092    2019-01-21 17:38:51.000000000 +0100
40 +++ firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp    2019-01-22 11:37:01.868896974 +0100
41 @@ -58,6 +58,7 @@
e2c46b 42  #endif
CS 43  #ifdef XP_UNIX
44  #include <ctype.h>
45 +#include "nsIXULAppInfo.h"
46  #endif
47  #ifdef XP_IOS
48  #include "UIKitDirProvider.h"
cf9011 49 @@ -491,6 +492,21 @@ nsXREDirProvider::GetFile(const char* aP
e2c46b 50        }
CS 51      }
52    }
cf9011 53 +
e2c46b 54 +#if defined(XP_UNIX)
CS 55 +  if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
56 +    nsCString sysConfigDir = NS_LITERAL_CSTRING("/etc/");
57 +    nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
58 +    if (!appInfo)
59 +      return NS_ERROR_NOT_AVAILABLE;
60 +    nsCString appName;
61 +    appInfo->GetName(appName);
62 +    ToLowerCase(appName);
63 +    sysConfigDir.Append(appName);
64 +    return NS_NewNativeLocalFile(sysConfigDir, false, aFile);
65 +  }
66 +#endif
67 +
cf9011 68    if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
e2c46b 69  
cf9011 70    if (ensureFilePermissions) {
CS 71 @@ -796,6 +812,16 @@ nsresult nsXREDirProvider::GetFilesInter
e2c46b 72      LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
cf9011 73      LoadDirsIntoArray(mAppBundleDirectories, kAppendPrefDir, directories);
CS 74  
e2c46b 75 +    // Add /etc/<application>/pref/ directory if it exists
CS 76 +    nsCOMPtr<nsIFile> systemPrefDir;
cf9011 77 +    rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
CS 78 +                                getter_AddRefs(systemPrefDir));
e2c46b 79 +    if (NS_SUCCEEDED(rv)) {
CS 80 +      rv = systemPrefDir->AppendNative(NS_LITERAL_CSTRING("pref"));
81 +      if (NS_SUCCEEDED(rv))
82 +        directories.AppendObject(systemPrefDir);
83 +    }
cf9011 84 +
e2c46b 85      rv = NS_NewArrayEnumerator(aResult, directories);
cf9011 86    } else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
CS 87      // NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
88 diff -up firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h
89 --- firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092    2019-01-22 10:48:38.188383609 +0100
90 +++ firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h    2019-01-22 11:08:12.068459480 +0100
91 @@ -62,6 +62,7 @@
92  #define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
93  #define NS_APP_PREFS_OVERRIDE_DIR \
94    "PrefDOverride"  // Directory for per-profile defaults
e2c46b 95 +#define NS_APP_PREFS_SYSTEM_CONFIG_DIR          "PrefSysConf"   // Directory with system-wide configuration
CS 96  
cf9011 97  #define NS_APP_USER_PROFILE_50_DIR "ProfD"
CS 98  #define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD"