|
|
7468b5 |
diff -up firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
|
|
|
7468b5 |
--- firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2019-01-22 10:48:38.187383614 +0100
|
|
|
7468b5 |
+++ firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2019-01-22 11:26:11.027108692 +0100
|
|
|
7468b5 |
@@ -225,8 +225,20 @@ nsresult nsReadConfig::openAndEvaluateJS
|
|
|
7468b5 |
if (NS_FAILED(rv)) return rv;
|
|
|
4cf60e |
|
|
|
7468b5 |
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
|
|
7468b5 |
- if (NS_FAILED(rv)) return rv;
|
|
|
7468b5 |
+ if (NS_FAILED(rv)) {
|
|
|
7468b5 |
+ // Look for cfg file in /etc/<application>/pref
|
|
|
7468b5 |
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
|
|
7468b5 |
+ getter_AddRefs(jsFile));
|
|
|
7468b5 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
4cf60e |
+
|
|
|
7468b5 |
+ rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref"));
|
|
|
7468b5 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
7468b5 |
+ rv = jsFile->AppendNative(nsDependentCString(aFileName));
|
|
|
7468b5 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
d417c4 |
|
|
|
7468b5 |
+ rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
|
|
7468b5 |
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
7468b5 |
+ }
|
|
|
7468b5 |
} else {
|
|
|
7468b5 |
nsAutoCString location("resource://gre/defaults/autoconfig/");
|
|
|
7468b5 |
location += aFileName;
|
|
|
7468b5 |
diff -up firefox-60.5.0/modules/libpref/Preferences.cpp.1170092 firefox-60.5.0/modules/libpref/Preferences.cpp
|
|
|
7468b5 |
--- firefox-60.5.0/modules/libpref/Preferences.cpp.1170092 2019-01-21 17:38:16.000000000 +0100
|
|
|
7468b5 |
+++ firefox-60.5.0/modules/libpref/Preferences.cpp 2019-01-22 10:48:38.187383614 +0100
|
|
|
7468b5 |
@@ -3459,6 +3459,8 @@ static nsresult pref_ReadPrefFromJar(nsZ
|
|
|
d417c4 |
//
|
|
|
d417c4 |
// Thus, in the omni.jar case, we always load app-specific default
|
|
|
d417c4 |
// preferences from omni.jar, whether or not `$app == $gre`.
|
|
|
4cf60e |
+ // At very end load configuration from system config location:
|
|
|
4cf60e |
+ // - /etc/firefox/pref/*.js
|
|
|
4cf60e |
|
|
|
d417c4 |
nsresult rv;
|
|
|
d417c4 |
nsZipFind* findPtr;
|
|
|
7468b5 |
diff -up firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp
|
|
|
7468b5 |
--- firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2019-01-21 17:38:51.000000000 +0100
|
|
|
7468b5 |
+++ firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp 2019-01-22 11:37:01.868896974 +0100
|
|
|
7468b5 |
@@ -58,6 +58,7 @@
|
|
|
4cf60e |
#endif
|
|
|
4cf60e |
#ifdef XP_UNIX
|
|
|
4cf60e |
#include <ctype.h>
|
|
|
4cf60e |
+#include "nsIXULAppInfo.h"
|
|
|
4cf60e |
#endif
|
|
|
4cf60e |
#ifdef XP_IOS
|
|
|
4cf60e |
#include "UIKitDirProvider.h"
|
|
|
7468b5 |
@@ -491,6 +492,21 @@ nsXREDirProvider::GetFile(const char* aP
|
|
|
4cf60e |
}
|
|
|
4cf60e |
}
|
|
|
4cf60e |
}
|
|
|
7468b5 |
+
|
|
|
4cf60e |
+#if defined(XP_UNIX)
|
|
|
4cf60e |
+ if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
|
|
|
4cf60e |
+ nsCString sysConfigDir = NS_LITERAL_CSTRING("/etc/");
|
|
|
4cf60e |
+ nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
|
|
4cf60e |
+ if (!appInfo)
|
|
|
4cf60e |
+ return NS_ERROR_NOT_AVAILABLE;
|
|
|
4cf60e |
+ nsCString appName;
|
|
|
4cf60e |
+ appInfo->GetName(appName);
|
|
|
4cf60e |
+ ToLowerCase(appName);
|
|
|
4cf60e |
+ sysConfigDir.Append(appName);
|
|
|
4cf60e |
+ return NS_NewNativeLocalFile(sysConfigDir, false, aFile);
|
|
|
4cf60e |
+ }
|
|
|
4cf60e |
+#endif
|
|
|
4cf60e |
+
|
|
|
7468b5 |
if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
|
|
|
4cf60e |
|
|
|
7468b5 |
if (ensureFilePermissions) {
|
|
|
7468b5 |
@@ -796,6 +812,16 @@ nsresult nsXREDirProvider::GetFilesInter
|
|
|
4cf60e |
LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
|
|
|
7468b5 |
LoadDirsIntoArray(mAppBundleDirectories, kAppendPrefDir, directories);
|
|
|
7468b5 |
|
|
|
4cf60e |
+ // Add /etc/<application>/pref/ directory if it exists
|
|
|
4cf60e |
+ nsCOMPtr<nsIFile> systemPrefDir;
|
|
|
7468b5 |
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
|
|
7468b5 |
+ getter_AddRefs(systemPrefDir));
|
|
|
4cf60e |
+ if (NS_SUCCEEDED(rv)) {
|
|
|
4cf60e |
+ rv = systemPrefDir->AppendNative(NS_LITERAL_CSTRING("pref"));
|
|
|
4cf60e |
+ if (NS_SUCCEEDED(rv))
|
|
|
4cf60e |
+ directories.AppendObject(systemPrefDir);
|
|
|
4cf60e |
+ }
|
|
|
7468b5 |
+
|
|
|
4cf60e |
rv = NS_NewArrayEnumerator(aResult, directories);
|
|
|
7468b5 |
} else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
|
|
|
7468b5 |
// NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
|
|
|
7468b5 |
diff -up firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h
|
|
|
7468b5 |
--- firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2019-01-22 10:48:38.188383609 +0100
|
|
|
7468b5 |
+++ firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h 2019-01-22 11:08:12.068459480 +0100
|
|
|
7468b5 |
@@ -62,6 +62,7 @@
|
|
|
7468b5 |
#define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
|
|
|
7468b5 |
#define NS_APP_PREFS_OVERRIDE_DIR \
|
|
|
7468b5 |
"PrefDOverride" // Directory for per-profile defaults
|
|
|
4cf60e |
+#define NS_APP_PREFS_SYSTEM_CONFIG_DIR "PrefSysConf" // Directory with system-wide configuration
|
|
|
4cf60e |
|
|
|
7468b5 |
#define NS_APP_USER_PROFILE_50_DIR "ProfD"
|
|
|
7468b5 |
#define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD"
|