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