|
|
517bf9 |
diff -up firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
|
|
|
517bf9 |
--- firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2021-03-18 14:48:36.000000000 +0100
|
|
|
517bf9 |
+++ firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2021-03-22 19:20:02.429310184 +0100
|
|
|
8a9c29 |
@@ -249,8 +249,20 @@ nsresult nsReadConfig::openAndEvaluateJS
|
|
|
969f7f |
if (NS_FAILED(rv)) return rv;
|
|
|
969f7f |
|
|
|
969f7f |
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
|
|
969f7f |
- if (NS_FAILED(rv)) return rv;
|
|
|
969f7f |
+ if (NS_FAILED(rv)) {
|
|
|
969f7f |
+ // Look for cfg file in /etc/<application>/pref
|
|
|
969f7f |
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
|
|
969f7f |
+ getter_AddRefs(jsFile));
|
|
|
969f7f |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
969f7f |
+
|
|
|
8a9c29 |
+ rv = jsFile->AppendNative(nsLiteralCString("pref"));
|
|
|
969f7f |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
969f7f |
+ rv = jsFile->AppendNative(nsDependentCString(aFileName));
|
|
|
969f7f |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
969f7f |
|
|
|
969f7f |
+ rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
|
|
969f7f |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
969f7f |
+ }
|
|
|
969f7f |
} else {
|
|
|
969f7f |
nsAutoCString location("resource://gre/defaults/autoconfig/");
|
|
|
969f7f |
location += aFileName;
|
|
|
517bf9 |
diff -up firefox-87.0/modules/libpref/Preferences.cpp.1170092 firefox-87.0/modules/libpref/Preferences.cpp
|
|
|
517bf9 |
--- firefox-87.0/modules/libpref/Preferences.cpp.1170092 2021-03-18 14:48:54.000000000 +0100
|
|
|
517bf9 |
+++ firefox-87.0/modules/libpref/Preferences.cpp 2021-03-22 19:20:02.429310184 +0100
|
|
|
517bf9 |
@@ -4499,6 +4499,9 @@ nsresult Preferences::InitInitialObjects
|
|
|
969f7f |
//
|
|
|
969f7f |
// Thus, in the omni.jar case, we always load app-specific default
|
|
|
969f7f |
// preferences from omni.jar, whether or not `$app == $gre`.
|
|
|
517bf9 |
+ //
|
|
|
969f7f |
+ // At very end load configuration from system config location:
|
|
|
969f7f |
+ // - /etc/firefox/pref/*.js
|
|
|
969f7f |
|
|
|
025a5f |
nsresult rv = NS_ERROR_FAILURE;
|
|
|
f1b26c |
UniquePtr<nsZipFind> find;
|
|
|
517bf9 |
diff -up firefox-87.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-87.0/toolkit/xre/nsXREDirProvider.cpp
|
|
|
517bf9 |
--- firefox-87.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2021-03-18 14:52:00.000000000 +0100
|
|
|
517bf9 |
+++ firefox-87.0/toolkit/xre/nsXREDirProvider.cpp 2021-03-22 19:37:56.574480347 +0100
|
|
|
517bf9 |
@@ -65,6 +65,7 @@
|
|
|
fb5326 |
#endif
|
|
|
fb5326 |
#ifdef XP_UNIX
|
|
|
fb5326 |
# include <ctype.h>
|
|
|
fb5326 |
+# include "nsIXULAppInfo.h"
|
|
|
fb5326 |
#endif
|
|
|
fb5326 |
#ifdef XP_IOS
|
|
|
fb5326 |
# include "UIKitDirProvider.h"
|
|
|
517bf9 |
@@ -552,6 +553,21 @@ nsXREDirProvider::GetFile(const char* aP
|
|
|
969f7f |
}
|
|
|
969f7f |
}
|
|
|
969f7f |
}
|
|
|
969f7f |
+
|
|
|
969f7f |
+#if defined(XP_UNIX)
|
|
|
969f7f |
+ if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
|
|
|
8a9c29 |
+ nsCString sysConfigDir = nsLiteralCString("/etc/");
|
|
|
969f7f |
+ nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
|
|
969f7f |
+ if (!appInfo)
|
|
|
969f7f |
+ return NS_ERROR_NOT_AVAILABLE;
|
|
|
969f7f |
+ nsCString appName;
|
|
|
969f7f |
+ appInfo->GetName(appName);
|
|
|
969f7f |
+ ToLowerCase(appName);
|
|
|
969f7f |
+ sysConfigDir.Append(appName);
|
|
|
969f7f |
+ return NS_NewNativeLocalFile(sysConfigDir, false, aFile);
|
|
|
969f7f |
+ }
|
|
|
969f7f |
+#endif
|
|
|
969f7f |
+
|
|
|
969f7f |
if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
|
|
|
969f7f |
|
|
|
969f7f |
if (ensureFilePermissions) {
|
|
|
517bf9 |
@@ -874,6 +890,16 @@ nsresult nsXREDirProvider::GetFilesInter
|
|
|
8a9c29 |
}
|
|
|
8a9c29 |
#endif
|
|
|
517bf9 |
|
|
|
969f7f |
+ // Add /etc/<application>/pref/ directory if it exists
|
|
|
969f7f |
+ nsCOMPtr<nsIFile> systemPrefDir;
|
|
|
969f7f |
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
|
|
969f7f |
+ getter_AddRefs(systemPrefDir));
|
|
|
969f7f |
+ if (NS_SUCCEEDED(rv)) {
|
|
|
8a9c29 |
+ rv = systemPrefDir->AppendNative(nsLiteralCString("pref"));
|
|
|
517bf9 |
+ if (NS_SUCCEEDED(rv))
|
|
|
969f7f |
+ directories.AppendObject(systemPrefDir);
|
|
|
f1b26c |
+ }
|
|
|
517bf9 |
+
|
|
|
025a5f |
rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
|
|
|
969f7f |
} else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
|
|
|
517bf9 |
// NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
|
|
|
517bf9 |
diff -up firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h
|
|
|
517bf9 |
--- firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2021-03-18 14:51:58.000000000 +0100
|
|
|
517bf9 |
+++ firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h 2021-03-22 19:20:02.430310213 +0100
|
|
|
8a9c29 |
@@ -59,6 +59,7 @@
|
|
|
969f7f |
#define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
|
|
|
969f7f |
#define NS_APP_PREFS_OVERRIDE_DIR \
|
|
|
969f7f |
"PrefDOverride" // Directory for per-profile defaults
|
|
|
969f7f |
+#define NS_APP_PREFS_SYSTEM_CONFIG_DIR "PrefSysConf" // Directory with system-wide configuration
|
|
|
969f7f |
|
|
|
969f7f |
#define NS_APP_USER_PROFILE_50_DIR "ProfD"
|
|
|
969f7f |
#define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD"
|