Mozilla Thunderbird mail/newsgroup client
CentOS Sources
2019-02-04 cf9011aff009d664f6d013c685f60b9ec6e80b18
SOURCES/mozilla-1170092.patch
@@ -1,33 +1,32 @@
diff -up firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
--- firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092   2018-01-11 21:17:03.000000000 +0100
+++ firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp   2018-01-23 13:59:45.446495820 +0100
@@ -239,9 +239,20 @@ nsresult nsReadConfig::openAndEvaluateJS
             return rv;
diff -up firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
--- firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092   2019-01-22 10:48:38.187383614 +0100
+++ firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp   2019-01-22 11:26:11.027108692 +0100
@@ -225,8 +225,20 @@ nsresult nsReadConfig::openAndEvaluateJS
     if (NS_FAILED(rv)) return rv;
 
         rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
-        if (NS_FAILED(rv))
-            return rv;
+        if (NS_FAILED(rv)) {
+          // Look for cfg file in /etc/<application>/pref
+          rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
+                                      getter_AddRefs(jsFile));
+          NS_ENSURE_SUCCESS(rv, rv);
     rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
-    if (NS_FAILED(rv)) return rv;
+    if (NS_FAILED(rv)) {
+      // Look for cfg file in /etc/<application>/pref
+      rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
+                                  getter_AddRefs(jsFile));
+      NS_ENSURE_SUCCESS(rv, rv);
+
+          rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref"));
+          NS_ENSURE_SUCCESS(rv, rv);
+          rv = jsFile->AppendNative(nsDependentCString(aFileName));
+          NS_ENSURE_SUCCESS(rv, rv);
+      rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref"));
+      NS_ENSURE_SUCCESS(rv, rv);
+      rv = jsFile->AppendNative(nsDependentCString(aFileName));
+      NS_ENSURE_SUCCESS(rv, rv);
 
+          rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
+          NS_ENSURE_SUCCESS(rv, rv);
+        }
     } else {
         nsAutoCString location("resource://gre/defaults/autoconfig/");
         location += aFileName;
diff -up firefox-58.0/modules/libpref/Preferences.cpp.1170092 firefox-58.0/modules/libpref/Preferences.cpp
--- firefox-58.0/modules/libpref/Preferences.cpp.1170092   2018-01-23 13:59:45.447495817 +0100
+++ firefox-58.0/modules/libpref/Preferences.cpp   2018-01-23 14:02:51.456987774 +0100
@@ -4402,6 +4402,8 @@ pref_InitInitialObjects()
+      rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
+      NS_ENSURE_SUCCESS(rv, rv);
+    }
   } else {
     nsAutoCString location("resource://gre/defaults/autoconfig/");
     location += aFileName;
diff -up firefox-60.5.0/modules/libpref/Preferences.cpp.1170092 firefox-60.5.0/modules/libpref/Preferences.cpp
--- firefox-60.5.0/modules/libpref/Preferences.cpp.1170092   2019-01-21 17:38:16.000000000 +0100
+++ firefox-60.5.0/modules/libpref/Preferences.cpp   2019-01-22 10:48:38.187383614 +0100
@@ -3459,6 +3459,8 @@ static nsresult pref_ReadPrefFromJar(nsZ
   //
   // Thus, in the omni.jar case, we always load app-specific default
   // preferences from omni.jar, whether or not `$app == $gre`.
@@ -36,10 +35,10 @@
 
   nsresult rv;
   nsZipFind* findPtr;
diff -up firefox-58.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-58.0/toolkit/xre/nsXREDirProvider.cpp
--- firefox-58.0/toolkit/xre/nsXREDirProvider.cpp.1170092   2018-01-11 21:17:06.000000000 +0100
+++ firefox-58.0/toolkit/xre/nsXREDirProvider.cpp   2018-01-23 13:59:45.447495817 +0100
@@ -59,6 +59,7 @@
diff -up firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp
--- firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092   2019-01-21 17:38:51.000000000 +0100
+++ firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp   2019-01-22 11:37:01.868896974 +0100
@@ -58,6 +58,7 @@
 #endif
 #ifdef XP_UNIX
 #include <ctype.h>
@@ -47,10 +46,11 @@
 #endif
 #ifdef XP_IOS
 #include "UIKitDirProvider.h"
@@ -554,6 +555,20 @@ nsXREDirProvider::GetFile(const char* aP
@@ -491,6 +492,21 @@ nsXREDirProvider::GetFile(const char* aP
       }
     }
   }
+
+#if defined(XP_UNIX)
+  if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
+    nsCString sysConfigDir = NS_LITERAL_CSTRING("/etc/");
@@ -65,32 +65,34 @@
+  }
+#endif
+
   if (NS_FAILED(rv) || !file)
     return NS_ERROR_FAILURE;
   if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
 
@@ -887,6 +902,14 @@ nsXREDirProvider::GetFilesInternal(const
   if (ensureFilePermissions) {
@@ -796,6 +812,16 @@ nsresult nsXREDirProvider::GetFilesInter
     LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
     LoadDirsIntoArray(mAppBundleDirectories,
                       kAppendPrefDir, directories);
     LoadDirsIntoArray(mAppBundleDirectories, kAppendPrefDir, directories);
+    // Add /etc/<application>/pref/ directory if it exists
+    nsCOMPtr<nsIFile> systemPrefDir;
+    rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR, getter_AddRefs(systemPrefDir));
+    rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
+                                getter_AddRefs(systemPrefDir));
+    if (NS_SUCCEEDED(rv)) {
+      rv = systemPrefDir->AppendNative(NS_LITERAL_CSTRING("pref"));
+      if (NS_SUCCEEDED(rv))
+        directories.AppendObject(systemPrefDir);
+    }
+
     rv = NS_NewArrayEnumerator(aResult, directories);
   }
diff -up firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h
--- firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092   2018-01-23 13:59:45.447495817 +0100
+++ firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h   2018-01-23 14:02:02.871120476 +0100
@@ -59,6 +59,7 @@
 #define NS_APP_PREFS_50_FILE                    "PrefF"
 #define NS_APP_PREFS_DEFAULTS_DIR_LIST          "PrefDL"
 #define NS_APP_PREFS_OVERRIDE_DIR               "PrefDOverride" // Directory for per-profile defaults
   } else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
     // NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
diff -up firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h
--- firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092   2019-01-22 10:48:38.188383609 +0100
+++ firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h   2019-01-22 11:08:12.068459480 +0100
@@ -62,6 +62,7 @@
 #define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
 #define NS_APP_PREFS_OVERRIDE_DIR \
   "PrefDOverride"  // Directory for per-profile defaults
+#define NS_APP_PREFS_SYSTEM_CONFIG_DIR          "PrefSysConf"   // Directory with system-wide configuration
 
 #define NS_APP_USER_PROFILE_50_DIR              "ProfD"
 #define NS_APP_USER_PROFILE_LOCAL_50_DIR        "ProfLD"
 #define NS_APP_USER_PROFILE_50_DIR "ProfD"
 #define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD"