|
|
c5da2d |
diff -up firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
|
|
|
c5da2d |
--- firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2021-03-18 14:48:36.000000000 +0100
|
|
|
c5da2d |
+++ firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2021-03-22 19:20:02.429310184 +0100
|
|
|
17290f |
@@ -249,8 +249,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 |
+
|
|
|
17290f |
+ rv = jsFile->AppendNative(nsLiteralCString("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;
|
|
|
c5da2d |
diff -up firefox-87.0/modules/libpref/Preferences.cpp.1170092 firefox-87.0/modules/libpref/Preferences.cpp
|
|
|
c5da2d |
--- firefox-87.0/modules/libpref/Preferences.cpp.1170092 2021-03-18 14:48:54.000000000 +0100
|
|
|
c5da2d |
+++ firefox-87.0/modules/libpref/Preferences.cpp 2021-03-22 19:20:02.429310184 +0100
|
|
|
c5da2d |
@@ -4499,6 +4499,9 @@ nsresult Preferences::InitInitialObjects
|
|
|
4c0036 |
//
|
|
|
4c0036 |
// Thus, in the omni.jar case, we always load app-specific default
|
|
|
4c0036 |
// preferences from omni.jar, whether or not `$app == $gre`.
|
|
|
c5da2d |
+ //
|
|
|
4c0036 |
+ // At very end load configuration from system config location:
|
|
|
4c0036 |
+ // - /etc/firefox/pref/*.js
|
|
|
4c0036 |
|
|
|
02297a |
nsresult rv = NS_ERROR_FAILURE;
|
|
|
61b5ae |
UniquePtr<nsZipFind> find;
|
|
|
c5da2d |
diff -up firefox-87.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-87.0/toolkit/xre/nsXREDirProvider.cpp
|
|
|
c5da2d |
--- firefox-87.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2021-03-18 14:52:00.000000000 +0100
|
|
|
c5da2d |
+++ firefox-87.0/toolkit/xre/nsXREDirProvider.cpp 2021-03-22 19:37:56.574480347 +0100
|
|
|
c5da2d |
@@ -65,6 +65,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"
|
|
|
c5da2d |
@@ -552,6 +553,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)) {
|
|
|
17290f |
+ nsCString sysConfigDir = nsLiteralCString("/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) {
|
|
|
c5da2d |
@@ -874,6 +890,16 @@ nsresult nsXREDirProvider::GetFilesInter
|
|
|
17290f |
}
|
|
|
17290f |
#endif
|
|
|
c5da2d |
|
|
|
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)) {
|
|
|
17290f |
+ rv = systemPrefDir->AppendNative(nsLiteralCString("pref"));
|
|
|
c5da2d |
+ if (NS_SUCCEEDED(rv))
|
|
|
4c0036 |
+ directories.AppendObject(systemPrefDir);
|
|
|
02297a |
+ }
|
|
|
c5da2d |
+
|
|
|
02297a |
rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
|
|
|
4c0036 |
} else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
|
|
|
c5da2d |
// NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
|
|
|
c5da2d |
diff -up firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h
|
|
|
c5da2d |
--- firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2021-03-18 14:51:58.000000000 +0100
|
|
|
c5da2d |
+++ firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h 2021-03-22 19:20:02.430310213 +0100
|
|
|
17290f |
@@ -59,6 +59,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"
|