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