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