|
|
02297a |
diff -up firefox-68.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-68.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
|
|
|
02297a |
--- firefox-68.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2020-02-07 01:27:03.000000000 +0100
|
|
|
02297a |
+++ firefox-68.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2020-02-24 11:30:32.058044651 +0100
|
|
|
02297a |
@@ -246,8 +246,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;
|
|
|
02297a |
diff -up firefox-68.5.0/modules/libpref/Preferences.cpp.1170092 firefox-68.5.0/modules/libpref/Preferences.cpp
|
|
|
02297a |
--- firefox-68.5.0/modules/libpref/Preferences.cpp.1170092 2020-02-24 11:30:32.059044645 +0100
|
|
|
02297a |
+++ firefox-68.5.0/modules/libpref/Preferences.cpp 2020-02-24 11:35:14.613443673 +0100
|
|
|
02297a |
@@ -4436,6 +4436,8 @@ static nsresult pref_ReadDefaultPrefs(co
|
|
|
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 |
|
|
|
02297a |
nsresult rv = NS_ERROR_FAILURE;
|
|
|
4c0036 |
nsZipFind* findPtr;
|
|
|
02297a |
diff -up firefox-68.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-68.5.0/toolkit/xre/nsXREDirProvider.cpp
|
|
|
02297a |
--- firefox-68.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2020-02-07 01:28:06.000000000 +0100
|
|
|
02297a |
+++ firefox-68.5.0/toolkit/xre/nsXREDirProvider.cpp 2020-02-24 11:34:27.284704700 +0100
|
|
|
02297a |
@@ -61,6 +61,7 @@
|
|
|
4c0036 |
#endif
|
|
|
4c0036 |
#ifdef XP_UNIX
|
|
|
02297a |
# include <ctype.h>
|
|
|
02297a |
+# include "nsIXULAppInfo.h"
|
|
|
4c0036 |
#endif
|
|
|
4c0036 |
#ifdef XP_IOS
|
|
|
02297a |
# include "UIKitDirProvider.h"
|
|
|
02297a |
@@ -524,6 +525,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) {
|
|
|
02297a |
@@ -880,6 +896,17 @@ 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"));
|
|
|
02297a |
+ if (NS_SUCCEEDED(rv)) {
|
|
|
4c0036 |
+ directories.AppendObject(systemPrefDir);
|
|
|
02297a |
+ }
|
|
|
4c0036 |
+ }
|
|
|
4c0036 |
+
|
|
|
02297a |
rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
|
|
|
4c0036 |
} else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
|
|
|
4c0036 |
// NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
|
|
|
02297a |
diff -up firefox-68.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-68.5.0/xpcom/io/nsAppDirectoryServiceDefs.h
|
|
|
02297a |
--- firefox-68.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2020-02-07 01:27:52.000000000 +0100
|
|
|
02297a |
+++ firefox-68.5.0/xpcom/io/nsAppDirectoryServiceDefs.h 2020-02-24 11:30:32.059044645 +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"
|