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