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