|
|
3262b1 |
diff -up firefox-78.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-78.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
|
|
|
3262b1 |
--- firefox-78.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2020-06-17 04:18:58.000000000 +0200
|
|
|
3262b1 |
+++ firefox-78.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2020-06-25 13:45:28.816999491 +0200
|
|
|
3262b1 |
@@ -244,8 +244,20 @@ nsresult nsReadConfig::openAndEvaluateJS
|
|
|
3262b1 |
if (NS_FAILED(rv)) return rv;
|
|
|
3262b1 |
|
|
|
3262b1 |
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
|
|
3262b1 |
- if (NS_FAILED(rv)) return rv;
|
|
|
3262b1 |
+ if (NS_FAILED(rv)) {
|
|
|
3262b1 |
+ // Look for cfg file in /etc/<application>/pref
|
|
|
3262b1 |
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
|
|
3262b1 |
+ getter_AddRefs(jsFile));
|
|
|
3262b1 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
3262b1 |
+
|
|
|
3262b1 |
+ rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref"));
|
|
|
3262b1 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
3262b1 |
+ rv = jsFile->AppendNative(nsDependentCString(aFileName));
|
|
|
3262b1 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
3262b1 |
|
|
|
3262b1 |
+ rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
|
|
3262b1 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
3262b1 |
+ }
|
|
|
3262b1 |
} else {
|
|
|
3262b1 |
nsAutoCString location("resource://gre/defaults/autoconfig/");
|
|
|
3262b1 |
location += aFileName;
|
|
|
3262b1 |
diff -up firefox-78.0/modules/libpref/Preferences.cpp.1170092 firefox-78.0/modules/libpref/Preferences.cpp
|
|
|
3262b1 |
--- firefox-78.0/modules/libpref/Preferences.cpp.1170092 2020-06-25 13:45:28.818999498 +0200
|
|
|
3262b1 |
+++ firefox-78.0/modules/libpref/Preferences.cpp 2020-06-25 13:48:45.996708102 +0200
|
|
|
3262b1 |
@@ -4499,6 +4499,8 @@ nsresult Preferences::InitInitialObjects
|
|
|
3262b1 |
//
|
|
|
3262b1 |
// Thus, in the omni.jar case, we always load app-specific default
|
|
|
3262b1 |
// preferences from omni.jar, whether or not `$app == $gre`.
|
|
|
3262b1 |
+ // At very end load configuration from system config location:
|
|
|
3262b1 |
+ // - /etc/firefox/pref/*.js
|
|
|
3262b1 |
|
|
|
3262b1 |
nsresult rv = NS_ERROR_FAILURE;
|
|
|
3262b1 |
UniquePtr<nsZipFind> find;
|
|
|
3262b1 |
diff -up firefox-78.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-78.0/toolkit/xre/nsXREDirProvider.cpp
|
|
|
3262b1 |
--- firefox-78.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2020-06-17 04:20:11.000000000 +0200
|
|
|
3262b1 |
+++ firefox-78.0/toolkit/xre/nsXREDirProvider.cpp 2020-06-25 13:48:28.613645633 +0200
|
|
|
3262b1 |
@@ -60,6 +60,7 @@
|
|
|
3262b1 |
#endif
|
|
|
3262b1 |
#ifdef XP_UNIX
|
|
|
3262b1 |
# include <ctype.h>
|
|
|
3262b1 |
+# include "nsIXULAppInfo.h"
|
|
|
3262b1 |
#endif
|
|
|
3262b1 |
#ifdef XP_IOS
|
|
|
3262b1 |
# include "UIKitDirProvider.h"
|
|
|
3262b1 |
@@ -533,6 +534,21 @@ nsXREDirProvider::GetFile(const char* aP
|
|
|
3262b1 |
}
|
|
|
3262b1 |
}
|
|
|
3262b1 |
}
|
|
|
3262b1 |
+
|
|
|
3262b1 |
+#if defined(XP_UNIX)
|
|
|
3262b1 |
+ if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
|
|
|
3262b1 |
+ nsCString sysConfigDir = NS_LITERAL_CSTRING("/etc/");
|
|
|
3262b1 |
+ nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
|
|
3262b1 |
+ if (!appInfo)
|
|
|
3262b1 |
+ return NS_ERROR_NOT_AVAILABLE;
|
|
|
3262b1 |
+ nsCString appName;
|
|
|
3262b1 |
+ appInfo->GetName(appName);
|
|
|
3262b1 |
+ ToLowerCase(appName);
|
|
|
3262b1 |
+ sysConfigDir.Append(appName);
|
|
|
3262b1 |
+ return NS_NewNativeLocalFile(sysConfigDir, false, aFile);
|
|
|
3262b1 |
+ }
|
|
|
3262b1 |
+#endif
|
|
|
3262b1 |
+
|
|
|
3262b1 |
if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
|
|
|
3262b1 |
|
|
|
3262b1 |
if (ensureFilePermissions) {
|
|
|
3262b1 |
@@ -845,6 +861,17 @@ nsresult nsXREDirProvider::GetFilesInter
|
|
|
3262b1 |
|
|
|
3262b1 |
LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
|
|
|
3262b1 |
|
|
|
3262b1 |
+ // Add /etc/<application>/pref/ directory if it exists
|
|
|
3262b1 |
+ nsCOMPtr<nsIFile> systemPrefDir;
|
|
|
3262b1 |
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
|
|
3262b1 |
+ getter_AddRefs(systemPrefDir));
|
|
|
3262b1 |
+ if (NS_SUCCEEDED(rv)) {
|
|
|
3262b1 |
+ rv = systemPrefDir->AppendNative(NS_LITERAL_CSTRING("pref"));
|
|
|
3262b1 |
+ if (NS_SUCCEEDED(rv)) {
|
|
|
3262b1 |
+ directories.AppendObject(systemPrefDir);
|
|
|
3262b1 |
+ }
|
|
|
3262b1 |
+ }
|
|
|
3262b1 |
+
|
|
|
3262b1 |
rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
|
|
|
3262b1 |
} else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
|
|
|
3262b1 |
// NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
|
|
|
3262b1 |
diff -up firefox-78.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-78.0/xpcom/io/nsAppDirectoryServiceDefs.h
|
|
|
3262b1 |
--- firefox-78.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2020-06-17 04:20:17.000000000 +0200
|
|
|
3262b1 |
+++ firefox-78.0/xpcom/io/nsAppDirectoryServiceDefs.h 2020-06-25 13:45:28.819999502 +0200
|
|
|
3262b1 |
@@ -60,6 +60,7 @@
|
|
|
3262b1 |
#define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
|
|
|
3262b1 |
#define NS_APP_PREFS_OVERRIDE_DIR \
|
|
|
3262b1 |
"PrefDOverride" // Directory for per-profile defaults
|
|
|
3262b1 |
+#define NS_APP_PREFS_SYSTEM_CONFIG_DIR "PrefSysConf" // Directory with system-wide configuration
|
|
|
3262b1 |
|
|
|
3262b1 |
#define NS_APP_USER_PROFILE_50_DIR "ProfD"
|
|
|
3262b1 |
#define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD"
|