diff options
author | Martin Stransky <stransky@anakreon.cz> | 2016-03-21 14:40:15 +0100 |
---|---|---|
committer | Martin Stransky <stransky@anakreon.cz> | 2016-03-21 14:40:15 +0100 |
commit | 4bed479594585999191504498433e2af7d058f41 (patch) | |
tree | 46d41004823184a3d1c6acef37d1e0cfd538993d /mozilla-1170092.patch | |
parent | Fixed rhbz#1293874 - use a Debian patch for disabled extension signing (diff) | |
download | librewolf-fedora-ff-4bed479594585999191504498433e2af7d058f41.tar.gz librewolf-fedora-ff-4bed479594585999191504498433e2af7d058f41.tar.bz2 librewolf-fedora-ff-4bed479594585999191504498433e2af7d058f41.zip |
WIP - more debian/upstream patches
Diffstat (limited to 'mozilla-1170092.patch')
-rw-r--r-- | mozilla-1170092.patch | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/mozilla-1170092.patch b/mozilla-1170092.patch new file mode 100644 index 0000000..ed4d3ce --- /dev/null +++ b/mozilla-1170092.patch @@ -0,0 +1,161 @@ +# HG changeset patch +# User Jan Horak <jhorak@redhat.com> +# Parent f986e55c4e0b41c6b50bd74d287614b564d7895f +# Bug 1170092 - Read default prefs also from /etc/firefox/defaults/pref + +diff --git a/extensions/pref/autoconfig/src/nsReadConfig.cpp b/extensions/pref/autoconfig/src/nsReadConfig.cpp +--- a/extensions/pref/autoconfig/src/nsReadConfig.cpp ++++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp +@@ -240,18 +240,30 @@ nsresult nsReadConfig::openAndEvaluateJS + if (NS_FAILED(rv)) + return rv; + + rv = jsFile->AppendNative(nsDependentCString(aFileName)); + 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); ++ ++ rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref")); ++ 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; + + nsCOMPtr<nsIURI> uri; + rv = NS_NewURI(getter_AddRefs(uri), location); + NS_ENSURE_SUCCESS(rv, rv); +diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp +--- a/modules/libpref/Preferences.cpp ++++ b/modules/libpref/Preferences.cpp +@@ -1228,16 +1228,18 @@ static nsresult pref_InitInitialObjects( + // - jar:$app/omni.jar!/defaults/preferences/*.js + // - $app/defaults/preferences/*.js + // and in non omni.jar case: + // - $app/defaults/preferences/*.js + // When $app == $gre, we additionally load, in omni.jar case: + // - jar:$gre/omni.jar!/defaults/preferences/*.js + // Thus, in omni.jar case, we always load app-specific default preferences + // from omni.jar, whether or not $app == $gre. ++ // At very end load configuration from system config location: ++ // - /etc/firefox/pref/*.js + + nsZipFind *findPtr; + nsAutoPtr<nsZipFind> find; + nsTArray<nsCString> prefEntries; + const char *entryName; + uint16_t entryNameLen; + + nsRefPtr<nsZipArchive> jarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE); +diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp +--- a/toolkit/xre/nsXREDirProvider.cpp ++++ b/toolkit/xre/nsXREDirProvider.cpp +@@ -47,16 +47,17 @@ + #ifdef XP_MACOSX + #include "nsILocalFileMac.h" + // for chflags() + #include <sys/stat.h> + #include <unistd.h> + #endif + #ifdef XP_UNIX + #include <ctype.h> ++#include "nsIXULAppInfo.h" + #endif + + #if defined(XP_MACOSX) + #define APP_REGISTRY_NAME "Application Registry" + #elif defined(XP_WIN) + #define APP_REGISTRY_NAME "registry.dat" + #else + #define APP_REGISTRY_NAME "appreg" +@@ -438,16 +439,30 @@ nsXREDirProvider::GetFile(const char* aP + rv = tmp; + } + tmp = EnsureDirectoryExists(file); + if (NS_FAILED(tmp)) { + rv = tmp; + } + } + } ++#if defined(XP_UNIX) ++ if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) { ++ nsCString sysConfigDir = NS_LITERAL_CSTRING("/etc/"); ++ 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); ++ return NS_NewNativeLocalFile(sysConfigDir, false, aFile); ++ } ++#endif ++ + if (NS_FAILED(rv) || !file) + return NS_ERROR_FAILURE; + + if (ensureFilePermissions) { + bool fileToEnsureExists; + bool isWritable; + if (NS_SUCCEEDED(file->Exists(&fileToEnsureExists)) && fileToEnsureExists + && NS_SUCCEEDED(file->IsWritable(&isWritable)) && !isWritable) { +@@ -713,16 +728,24 @@ nsXREDirProvider::GetFilesInternal(const + rv = NS_NewArrayEnumerator(aResult, directories); + } + else if (!strcmp(aProperty, NS_APP_PREFS_DEFAULTS_DIR_LIST)) { + nsCOMArray<nsIFile> directories; + + LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories); + LoadDirsIntoArray(mAppBundleDirectories, + kAppendPrefDir, directories); ++ // 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)) { ++ rv = systemPrefDir->AppendNative(NS_LITERAL_CSTRING("pref")); ++ if (NS_SUCCEEDED(rv)) ++ directories.AppendObject(systemPrefDir); ++ } + + rv = NS_NewArrayEnumerator(aResult, directories); + } + else if (!strcmp(aProperty, NS_EXT_PREFS_DEFAULTS_DIR_LIST)) { + nsCOMArray<nsIFile> directories; + + LoadDirsIntoArray(mExtensionDirectories, + kAppendPrefDir, directories); +diff --git a/xpcom/io/nsAppDirectoryServiceDefs.h b/xpcom/io/nsAppDirectoryServiceDefs.h +--- a/xpcom/io/nsAppDirectoryServiceDefs.h ++++ b/xpcom/io/nsAppDirectoryServiceDefs.h +@@ -61,16 +61,17 @@ + + #define NS_SHARED "SHARED" + + #define NS_APP_PREFS_50_DIR "PrefD" // Directory which contains user prefs + #define NS_APP_PREFS_50_FILE "PrefF" + #define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL" + #define NS_EXT_PREFS_DEFAULTS_DIR_LIST "ExtPrefDL" + #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" + + #define NS_APP_USER_CHROME_DIR "UChrm" + #define NS_APP_USER_SEARCH_DIR "UsrSrchPlugns" + + #define NS_APP_LOCALSTORE_50_FILE "LclSt" |