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