714dda
diff -up firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
714dda
--- firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092	2019-01-22 10:48:38.187383614 +0100
714dda
+++ firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp	2019-01-22 11:26:11.027108692 +0100
714dda
@@ -225,8 +225,20 @@ nsresult nsReadConfig::openAndEvaluateJS
714dda
     if (NS_FAILED(rv)) return rv;
714dda
 
714dda
     rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
714dda
-    if (NS_FAILED(rv)) return rv;
714dda
+    if (NS_FAILED(rv)) {
714dda
+      // Look for cfg file in /etc/<application>/pref
714dda
+      rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
714dda
+                                  getter_AddRefs(jsFile));
714dda
+      NS_ENSURE_SUCCESS(rv, rv);
714dda
+
714dda
+      rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref"));
714dda
+      NS_ENSURE_SUCCESS(rv, rv);
714dda
+      rv = jsFile->AppendNative(nsDependentCString(aFileName));
714dda
+      NS_ENSURE_SUCCESS(rv, rv);
714dda
 
714dda
+      rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
714dda
+      NS_ENSURE_SUCCESS(rv, rv);
714dda
+    }
714dda
   } else {
714dda
     nsAutoCString location("resource://gre/defaults/autoconfig/");
714dda
     location += aFileName;
714dda
diff -up firefox-60.5.0/modules/libpref/Preferences.cpp.1170092 firefox-60.5.0/modules/libpref/Preferences.cpp
714dda
--- firefox-60.5.0/modules/libpref/Preferences.cpp.1170092	2019-01-21 17:38:16.000000000 +0100
714dda
+++ firefox-60.5.0/modules/libpref/Preferences.cpp	2019-01-22 10:48:38.187383614 +0100
714dda
@@ -3459,6 +3459,8 @@ static nsresult pref_ReadPrefFromJar(nsZ
714dda
   //
714dda
   // Thus, in the omni.jar case, we always load app-specific default
714dda
   // preferences from omni.jar, whether or not `$app == $gre`.
714dda
+  // At very end load configuration from system config location:
714dda
+  // - /etc/firefox/pref/*.js
714dda
 
714dda
   nsresult rv;
714dda
   nsZipFind* findPtr;
714dda
diff -up firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp
714dda
--- firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092	2019-01-21 17:38:51.000000000 +0100
714dda
+++ firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp	2019-01-22 11:37:01.868896974 +0100
714dda
@@ -58,6 +58,7 @@
714dda
 #endif
714dda
 #ifdef XP_UNIX
714dda
 #include <ctype.h>
714dda
+#include "nsIXULAppInfo.h"
714dda
 #endif
714dda
 #ifdef XP_IOS
714dda
 #include "UIKitDirProvider.h"
714dda
@@ -491,6 +492,21 @@ nsXREDirProvider::GetFile(const char* aP
714dda
       }
714dda
     }
714dda
   }
714dda
+
714dda
+#if defined(XP_UNIX)
714dda
+  if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
714dda
+    nsCString sysConfigDir = NS_LITERAL_CSTRING("/etc/");
714dda
+    nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
714dda
+    if (!appInfo)
714dda
+      return NS_ERROR_NOT_AVAILABLE;
714dda
+    nsCString appName;
714dda
+    appInfo->GetName(appName);
714dda
+    ToLowerCase(appName);
714dda
+    sysConfigDir.Append(appName);
714dda
+    return NS_NewNativeLocalFile(sysConfigDir, false, aFile);
714dda
+  }
714dda
+#endif
714dda
+
714dda
   if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
714dda
 
714dda
   if (ensureFilePermissions) {
714dda
@@ -796,6 +812,16 @@ nsresult nsXREDirProvider::GetFilesInter
714dda
     LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
714dda
     LoadDirsIntoArray(mAppBundleDirectories, kAppendPrefDir, directories);
714dda
 
714dda
+    // Add /etc/<application>/pref/ directory if it exists
714dda
+    nsCOMPtr<nsIFile> systemPrefDir;
714dda
+    rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
714dda
+                                getter_AddRefs(systemPrefDir));
714dda
+    if (NS_SUCCEEDED(rv)) {
714dda
+      rv = systemPrefDir->AppendNative(NS_LITERAL_CSTRING("pref"));
714dda
+      if (NS_SUCCEEDED(rv))
714dda
+        directories.AppendObject(systemPrefDir);
714dda
+    }
714dda
+
714dda
     rv = NS_NewArrayEnumerator(aResult, directories);
714dda
   } else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
714dda
     // NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
714dda
diff -up firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h
714dda
--- firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092	2019-01-22 10:48:38.188383609 +0100
714dda
+++ firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h	2019-01-22 11:08:12.068459480 +0100
714dda
@@ -62,6 +62,7 @@
714dda
 #define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
714dda
 #define NS_APP_PREFS_OVERRIDE_DIR \
714dda
   "PrefDOverride"  // Directory for per-profile defaults
714dda
+#define NS_APP_PREFS_SYSTEM_CONFIG_DIR          "PrefSysConf"   // Directory with system-wide configuration
714dda
 
714dda
 #define NS_APP_USER_PROFILE_50_DIR "ProfD"
714dda
 #define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD"