|
|
763d03 |
diff -up firefox-115.0.2/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-115.0.2/extensions/pref/autoconfig/src/nsReadConfig.cpp
|
|
|
763d03 |
--- firefox-115.0.2/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2023-07-10 21:08:53.000000000 +0200
|
|
|
763d03 |
+++ firefox-115.0.2/extensions/pref/autoconfig/src/nsReadConfig.cpp 2023-07-17 10:33:23.443355156 +0200
|
|
|
763d03 |
@@ -263,8 +263,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 |
+
|
|
|
2559ee |
+ rv = jsFile->AppendNative(nsLiteralCString("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;
|
|
|
763d03 |
diff -up firefox-115.0.2/modules/libpref/Preferences.cpp.1170092 firefox-115.0.2/modules/libpref/Preferences.cpp
|
|
|
763d03 |
--- firefox-115.0.2/modules/libpref/Preferences.cpp.1170092 2023-07-10 21:09:00.000000000 +0200
|
|
|
763d03 |
+++ firefox-115.0.2/modules/libpref/Preferences.cpp 2023-07-17 10:33:23.444355156 +0200
|
|
|
763d03 |
@@ -4825,6 +4825,9 @@ 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`.
|
|
|
26f3ef |
+ //
|
|
|
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;
|
|
|
763d03 |
diff -up firefox-115.0.2/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-115.0.2/toolkit/xre/nsXREDirProvider.cpp
|
|
|
763d03 |
--- firefox-115.0.2/toolkit/xre/nsXREDirProvider.cpp.1170092 2023-07-10 22:57:20.000000000 +0200
|
|
|
763d03 |
+++ firefox-115.0.2/toolkit/xre/nsXREDirProvider.cpp 2023-07-17 10:56:25.309692121 +0200
|
|
|
763d03 |
@@ -72,6 +72,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"
|
|
|
763d03 |
@@ -478,6 +479,17 @@ nsXREDirProvider::GetFile(const char* aP
|
|
|
763d03 |
rv = file->AppendNative(nsLiteralCString(PREF_OVERRIDE_DIRNAME));
|
|
|
763d03 |
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
763d03 |
rv = EnsureDirectoryExists(file);
|
|
|
763d03 |
+ } else if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
|
|
|
2559ee |
+ nsCString sysConfigDir = nsLiteralCString("/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);
|
|
|
763d03 |
+ NS_NewNativeLocalFile(sysConfigDir, false, getter_AddRefs(file));
|
|
|
763d03 |
+ rv = EnsureDirectoryExists(file);
|
|
|
763d03 |
} else {
|
|
|
763d03 |
// We don't know anything about this property. Fail without warning, because
|
|
|
763d03 |
// otherwise we'll get too much warning spam due to
|
|
|
763d03 |
@@ -694,6 +706,16 @@ nsXREDirProvider::GetFiles(const char* a
|
|
|
2559ee |
}
|
|
|
2559ee |
#endif
|
|
|
26f3ef |
|
|
|
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)) {
|
|
|
2559ee |
+ rv = systemPrefDir->AppendNative(nsLiteralCString("pref"));
|
|
|
26f3ef |
+ if (NS_SUCCEEDED(rv))
|
|
|
a8a561 |
+ directories.AppendObject(systemPrefDir);
|
|
|
83ba88 |
+ }
|
|
|
26f3ef |
+
|
|
|
ea29f4 |
rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
|
|
|
0fe52e |
} else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
|
|
|
26f3ef |
// NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
|
|
|
763d03 |
diff -up firefox-115.0.2/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-115.0.2/xpcom/io/nsAppDirectoryServiceDefs.h
|
|
|
763d03 |
--- firefox-115.0.2/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2023-07-10 21:09:13.000000000 +0200
|
|
|
763d03 |
+++ firefox-115.0.2/xpcom/io/nsAppDirectoryServiceDefs.h 2023-07-17 10:33:23.444355156 +0200
|
|
|
763d03 |
@@ -58,6 +58,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"
|