2023-09-18 14:52:05 +00:00
|
|
|
diff -up firefox-115.0.2/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-115.0.2/extensions/pref/autoconfig/src/nsReadConfig.cpp
|
|
|
|
--- firefox-115.0.2/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2023-07-10 21:08:53.000000000 +0200
|
|
|
|
+++ firefox-115.0.2/extensions/pref/autoconfig/src/nsReadConfig.cpp 2023-07-17 10:33:23.443355156 +0200
|
|
|
|
@@ -263,8 +263,20 @@ nsresult nsReadConfig::openAndEvaluateJS
|
2021-01-21 14:38:17 +00:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
|
|
|
- if (NS_FAILED(rv)) return rv;
|
|
|
|
+ if (NS_FAILED(rv)) {
|
|
|
|
+ // Look for cfg file in /etc/<application>/pref
|
|
|
|
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
|
|
|
+ getter_AddRefs(jsFile));
|
|
|
|
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
+
|
2021-10-08 19:57:23 +00:00
|
|
|
+ rv = jsFile->AppendNative(nsLiteralCString("pref"));
|
2021-01-21 14:38:17 +00:00
|
|
|
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
+ rv = jsFile->AppendNative(nsDependentCString(aFileName));
|
|
|
|
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
+ rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
|
|
|
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
+ }
|
|
|
|
} else {
|
|
|
|
nsAutoCString location("resource://gre/defaults/autoconfig/");
|
|
|
|
location += aFileName;
|
2023-09-18 14:52:05 +00:00
|
|
|
diff -up firefox-115.0.2/modules/libpref/Preferences.cpp.1170092 firefox-115.0.2/modules/libpref/Preferences.cpp
|
|
|
|
--- firefox-115.0.2/modules/libpref/Preferences.cpp.1170092 2023-07-10 21:09:00.000000000 +0200
|
|
|
|
+++ firefox-115.0.2/modules/libpref/Preferences.cpp 2023-07-17 10:33:23.444355156 +0200
|
|
|
|
@@ -4825,6 +4825,9 @@ nsresult Preferences::InitInitialObjects
|
2021-01-21 14:38:17 +00:00
|
|
|
//
|
|
|
|
// Thus, in the omni.jar case, we always load app-specific default
|
|
|
|
// preferences from omni.jar, whether or not `$app == $gre`.
|
2022-09-21 09:50:29 +00:00
|
|
|
+ //
|
2021-01-21 14:38:17 +00:00
|
|
|
+ // At very end load configuration from system config location:
|
|
|
|
+ // - /etc/firefox/pref/*.js
|
|
|
|
|
|
|
|
nsresult rv = NS_ERROR_FAILURE;
|
|
|
|
UniquePtr<nsZipFind> find;
|
2023-09-18 14:52:05 +00:00
|
|
|
diff -up firefox-115.0.2/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-115.0.2/toolkit/xre/nsXREDirProvider.cpp
|
|
|
|
--- firefox-115.0.2/toolkit/xre/nsXREDirProvider.cpp.1170092 2023-07-10 22:57:20.000000000 +0200
|
|
|
|
+++ firefox-115.0.2/toolkit/xre/nsXREDirProvider.cpp 2023-07-17 10:56:25.309692121 +0200
|
|
|
|
@@ -72,6 +72,7 @@
|
2021-01-21 14:38:17 +00:00
|
|
|
#endif
|
|
|
|
#ifdef XP_UNIX
|
|
|
|
# include <ctype.h>
|
|
|
|
+# include "nsIXULAppInfo.h"
|
|
|
|
#endif
|
|
|
|
#ifdef XP_IOS
|
|
|
|
# include "UIKitDirProvider.h"
|
2023-09-18 14:52:05 +00:00
|
|
|
@@ -478,6 +479,17 @@ nsXREDirProvider::GetFile(const char* aP
|
|
|
|
rv = file->AppendNative(nsLiteralCString(PREF_OVERRIDE_DIRNAME));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
rv = EnsureDirectoryExists(file);
|
|
|
|
+ } else if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
|
2021-10-08 19:57:23 +00:00
|
|
|
+ nsCString sysConfigDir = nsLiteralCString("/etc/");
|
2021-01-21 14:38:17 +00:00
|
|
|
+ nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
|
|
|
+ if (!appInfo)
|
|
|
|
+ return NS_ERROR_NOT_AVAILABLE;
|
|
|
|
+ nsCString appName;
|
|
|
|
+ appInfo->GetName(appName);
|
|
|
|
+ ToLowerCase(appName);
|
|
|
|
+ sysConfigDir.Append(appName);
|
2023-09-18 14:52:05 +00:00
|
|
|
+ NS_NewNativeLocalFile(sysConfigDir, false, getter_AddRefs(file));
|
|
|
|
+ rv = EnsureDirectoryExists(file);
|
|
|
|
} else {
|
|
|
|
// We don't know anything about this property. Fail without warning, because
|
|
|
|
// otherwise we'll get too much warning spam due to
|
|
|
|
@@ -694,6 +706,16 @@ nsXREDirProvider::GetFiles(const char* a
|
2021-10-08 19:57:23 +00:00
|
|
|
}
|
|
|
|
#endif
|
2022-09-21 09:50:29 +00:00
|
|
|
|
2021-01-21 14:38:17 +00:00
|
|
|
+ // Add /etc/<application>/pref/ directory if it exists
|
|
|
|
+ nsCOMPtr<nsIFile> systemPrefDir;
|
|
|
|
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
|
|
|
+ getter_AddRefs(systemPrefDir));
|
|
|
|
+ if (NS_SUCCEEDED(rv)) {
|
2021-10-08 19:57:23 +00:00
|
|
|
+ rv = systemPrefDir->AppendNative(nsLiteralCString("pref"));
|
2022-09-21 09:50:29 +00:00
|
|
|
+ if (NS_SUCCEEDED(rv))
|
2021-01-21 14:38:17 +00:00
|
|
|
+ directories.AppendObject(systemPrefDir);
|
|
|
|
+ }
|
2022-09-21 09:50:29 +00:00
|
|
|
+
|
2021-01-21 14:38:17 +00:00
|
|
|
rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
|
|
|
|
} else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
|
2022-09-21 09:50:29 +00:00
|
|
|
// NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
|
2023-09-18 14:52:05 +00:00
|
|
|
diff -up firefox-115.0.2/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-115.0.2/xpcom/io/nsAppDirectoryServiceDefs.h
|
|
|
|
--- firefox-115.0.2/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2023-07-10 21:09:13.000000000 +0200
|
|
|
|
+++ firefox-115.0.2/xpcom/io/nsAppDirectoryServiceDefs.h 2023-07-17 10:33:23.444355156 +0200
|
|
|
|
@@ -58,6 +58,7 @@
|
2021-01-21 14:38:17 +00:00
|
|
|
#define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
|
|
|
|
#define NS_APP_PREFS_OVERRIDE_DIR \
|
|
|
|
"PrefDOverride" // Directory for per-profile defaults
|
|
|
|
+#define NS_APP_PREFS_SYSTEM_CONFIG_DIR "PrefSysConf" // Directory with system-wide configuration
|
|
|
|
|
|
|
|
#define NS_APP_USER_PROFILE_50_DIR "ProfD"
|
|
|
|
#define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD"
|