|
|
9eec91 |
diff -up firefox-91.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-91.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
|
|
|
9eec91 |
--- firefox-91.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2021-07-27 23:29:57.000000000 +0200
|
|
|
9eec91 |
+++ firefox-91.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2021-07-29 16:20:44.164513998 +0200
|
|
|
9eec91 |
@@ -249,8 +249,20 @@ nsresult nsReadConfig::openAndEvaluateJS
|
|
|
9eec91 |
if (NS_FAILED(rv)) return rv;
|
|
|
9eec91 |
|
|
|
9eec91 |
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
|
|
9eec91 |
- if (NS_FAILED(rv)) return rv;
|
|
|
9eec91 |
+ if (NS_FAILED(rv)) {
|
|
|
9eec91 |
+ // Look for cfg file in /etc/<application>/pref
|
|
|
9eec91 |
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
|
|
9eec91 |
+ getter_AddRefs(jsFile));
|
|
|
9eec91 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
9eec91 |
+
|
|
|
9eec91 |
+ rv = jsFile->AppendNative(nsLiteralCString("pref"));
|
|
|
9eec91 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
9eec91 |
+ rv = jsFile->AppendNative(nsDependentCString(aFileName));
|
|
|
9eec91 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
9eec91 |
|
|
|
9eec91 |
+ rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
|
|
9eec91 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
9eec91 |
+ }
|
|
|
9eec91 |
} else {
|
|
|
9eec91 |
nsAutoCString location("resource://gre/defaults/autoconfig/");
|
|
|
9eec91 |
location += aFileName;
|
|
|
9eec91 |
diff -up firefox-91.0/modules/libpref/Preferences.cpp.1170092 firefox-91.0/modules/libpref/Preferences.cpp
|
|
|
9eec91 |
--- firefox-91.0/modules/libpref/Preferences.cpp.1170092 2021-07-27 23:30:34.000000000 +0200
|
|
|
9eec91 |
+++ firefox-91.0/modules/libpref/Preferences.cpp 2021-07-29 16:20:44.166514005 +0200
|
|
|
9eec91 |
@@ -4553,6 +4553,8 @@ nsresult Preferences::InitInitialObjects
|
|
|
9eec91 |
//
|
|
|
9eec91 |
// Thus, in the omni.jar case, we always load app-specific default
|
|
|
9eec91 |
// preferences from omni.jar, whether or not `$app == $gre`.
|
|
|
9eec91 |
+ // At very end load configuration from system config location:
|
|
|
9eec91 |
+ // - /etc/firefox/pref/*.js
|
|
|
9eec91 |
|
|
|
9eec91 |
nsresult rv = NS_ERROR_FAILURE;
|
|
|
9eec91 |
UniquePtr<nsZipFind> find;
|
|
|
9eec91 |
diff -up firefox-91.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-91.0/toolkit/xre/nsXREDirProvider.cpp
|
|
|
9eec91 |
--- firefox-91.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2021-07-27 23:30:56.000000000 +0200
|
|
|
9eec91 |
+++ firefox-91.0/toolkit/xre/nsXREDirProvider.cpp 2021-07-29 16:26:20.071628932 +0200
|
|
|
9eec91 |
@@ -71,6 +71,7 @@
|
|
|
9eec91 |
#endif
|
|
|
9eec91 |
#ifdef XP_UNIX
|
|
|
9eec91 |
# include <ctype.h>
|
|
|
9eec91 |
+# include "nsIXULAppInfo.h"
|
|
|
9eec91 |
#endif
|
|
|
9eec91 |
#ifdef XP_IOS
|
|
|
9eec91 |
# include "UIKitDirProvider.h"
|
|
|
9eec91 |
@@ -550,6 +551,21 @@ nsXREDirProvider::GetFile(const char* aP
|
|
|
9eec91 |
}
|
|
|
9eec91 |
}
|
|
|
9eec91 |
}
|
|
|
9eec91 |
+
|
|
|
9eec91 |
+#if defined(XP_UNIX)
|
|
|
9eec91 |
+ if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
|
|
|
9eec91 |
+ nsCString sysConfigDir = nsLiteralCString("/etc/");
|
|
|
9eec91 |
+ nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
|
|
9eec91 |
+ if (!appInfo)
|
|
|
9eec91 |
+ return NS_ERROR_NOT_AVAILABLE;
|
|
|
9eec91 |
+ nsCString appName;
|
|
|
9eec91 |
+ appInfo->GetName(appName);
|
|
|
9eec91 |
+ ToLowerCase(appName);
|
|
|
9eec91 |
+ sysConfigDir.Append(appName);
|
|
|
9eec91 |
+ return NS_NewNativeLocalFile(sysConfigDir, false, aFile);
|
|
|
9eec91 |
+ }
|
|
|
9eec91 |
+#endif
|
|
|
9eec91 |
+
|
|
|
9eec91 |
if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
|
|
|
9eec91 |
|
|
|
9eec91 |
if (ensureFilePermissions) {
|
|
|
9eec91 |
@@ -827,6 +843,16 @@ nsresult nsXREDirProvider::GetFilesInter
|
|
|
9eec91 |
LoadDirIntoArray(mXULAppDir, kAppendBackgroundTasksPrefDir, directories);
|
|
|
9eec91 |
}
|
|
|
9eec91 |
#endif
|
|
|
9eec91 |
+ // Add /etc/<application>/pref/ directory if it exists
|
|
|
9eec91 |
+ nsCOMPtr<nsIFile> systemPrefDir;
|
|
|
9eec91 |
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
|
|
9eec91 |
+ getter_AddRefs(systemPrefDir));
|
|
|
9eec91 |
+ if (NS_SUCCEEDED(rv)) {
|
|
|
9eec91 |
+ rv = systemPrefDir->AppendNative(nsLiteralCString("pref"));
|
|
|
9eec91 |
+ if (NS_SUCCEEDED(rv)) {
|
|
|
9eec91 |
+ directories.AppendObject(systemPrefDir);
|
|
|
9eec91 |
+ }
|
|
|
9eec91 |
+ }
|
|
|
9eec91 |
|
|
|
9eec91 |
rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
|
|
|
9eec91 |
} else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
|
|
|
9eec91 |
diff -up firefox-91.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-91.0/xpcom/io/nsAppDirectoryServiceDefs.h
|
|
|
9eec91 |
--- firefox-91.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2021-07-27 23:31:38.000000000 +0200
|
|
|
9eec91 |
+++ firefox-91.0/xpcom/io/nsAppDirectoryServiceDefs.h 2021-07-29 16:20:44.168514012 +0200
|
|
|
9eec91 |
@@ -59,6 +59,7 @@
|
|
|
9eec91 |
#define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
|
|
|
9eec91 |
#define NS_APP_PREFS_OVERRIDE_DIR \
|
|
|
9eec91 |
"PrefDOverride" // Directory for per-profile defaults
|
|
|
9eec91 |
+#define NS_APP_PREFS_SYSTEM_CONFIG_DIR "PrefSysConf" // Directory with system-wide configuration
|
|
|
9eec91 |
|
|
|
9eec91 |
#define NS_APP_USER_PROFILE_50_DIR "ProfD"
|
|
|
9eec91 |
#define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD"
|