[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-messenger-build/master] Rebase patch for #9173
commit cb04c40fd39d9654eb2e2df7f05d169a354bb28c
Author: Sukhbir Singh <sukhbir@xxxxxxxxxxxxxx>
Date: Fri Jul 8 15:42:45 2016 -0400
Rebase patch for #9173
---
...e-the-default-Firefox-profile-director.mozpatch | 118 ++++++++++-----------
1 file changed, 57 insertions(+), 61 deletions(-)
diff --git a/projects/instantbird/Bug-9173-Change-the-default-Firefox-profile-director.mozpatch b/projects/instantbird/Bug-9173-Change-the-default-Firefox-profile-director.mozpatch
index a0e76ea..4447c70 100644
--- a/projects/instantbird/Bug-9173-Change-the-default-Firefox-profile-director.mozpatch
+++ b/projects/instantbird/Bug-9173-Change-the-default-Firefox-profile-director.mozpatch
@@ -1,19 +1,14 @@
-From 64c1b7b7756ba9f68bb84a33d77ae8bd31a209c5 Mon Sep 17 00:00:00 2001
+From 48068e88b66ba37c725850331d099f10f9d34c90 Mon Sep 17 00:00:00 2001
From: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
Date: Fri, 18 Oct 2013 15:20:06 -0400
-Subject: [PATCH] Bug #9173: Change the default Firefox profile directory to be
+Subject: Bug #9173: Change the default Firefox profile directory to be
TBB-relative.
-This should eliminate our need to rely on a wrapper script that sets $HOME and
-launches Firefox with -profile.
----
- toolkit/xre/nsXREDirProvider.cpp | 161 +++++++--------------------------
- toolkit/xre/nsXREDirProvider.h | 10 +-
- xpcom/io/moz.build | 4 +
- xpcom/io/nsAppFileLocationProvider.cpp | 96 ++++++++------------
- 4 files changed, 79 insertions(+), 192 deletions(-)
+This should eliminate our need to rely on a wrapper script that
+sets $HOME and launches Firefox with -profile.
diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
+index a828d33..831a373 100644
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -32,6 +32,7 @@
@@ -24,7 +19,7 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
#include "mozilla/Services.h"
#include "mozilla/Omnijar.h"
#include "mozilla/Preferences.h"
-@@ -200,9 +201,6 @@ nsXREDirProvider::GetUserProfilesRootDir
+@@ -200,9 +201,6 @@ nsXREDirProvider::GetUserProfilesRootDir(nsIFile** aResult,
aProfileName, aAppName, aVendorName);
if (NS_SUCCEEDED(rv)) {
@@ -34,7 +29,7 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
// We must create the profile directory here if it does not exist.
nsresult tmp = EnsureDirectoryExists(file);
if (NS_FAILED(tmp)) {
-@@ -225,9 +223,6 @@ nsXREDirProvider::GetUserProfilesLocalDi
+@@ -225,9 +223,6 @@ nsXREDirProvider::GetUserProfilesLocalDir(nsIFile** aResult,
aProfileName, aAppName, aVendorName);
if (NS_SUCCEEDED(rv)) {
@@ -73,7 +68,7 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
- nsCOMPtr<nsILocalFileMac> dirFileMac = do_QueryInterface(localDir);
- NS_ENSURE_TRUE(dirFileMac, NS_ERROR_UNEXPECTED);
-+ int levelsToRemove = 0;
++ int levelsToRemove = 0; // In FF21+, appDir points to browser subdirectory.
+#if defined(XP_MACOSX)
+ levelsToRemove += 1;
+#endif
@@ -85,23 +80,12 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
+ bool didRemove = !removedName.Equals(".");
- rv = dirFileMac->InitWithFSRef(&fsRef);
+- NS_ENSURE_SUCCESS(rv, rv);
+ // Remove a directory component.
+ nsCOMPtr<nsIFile> parentDir;
+ rv = localDir->GetParent(getter_AddRefs(parentDir));
+ NS_ENSURE_SUCCESS(rv, rv);
+ localDir = parentDir;
-+
-+ if (didRemove)
-+ --levelsToRemove;
-+ }
-+
-+ if (!localDir)
-+ return NS_ERROR_FAILURE;
-+
-+ rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING("TorMessenger"
-+ XPCOM_FILE_PATH_SEPARATOR "Data"
-+ XPCOM_FILE_PATH_SEPARATOR "Browser"));
- NS_ENSURE_SUCCESS(rv, rv);
- localDir = do_QueryInterface(dirFileMac, &rv);
-#elif defined(XP_IOS)
@@ -110,10 +94,7 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
- rv = NS_NewNativeLocalFile(userDir, true, getter_AddRefs(localDir));
- } else {
- rv = NS_ERROR_FAILURE;
-+ if (aLocal) {
-+ rv = localDir->AppendNative(NS_LITERAL_CSTRING("Caches"));
-+ NS_ENSURE_SUCCESS(rv, rv);
- }
+- }
- NS_ENSURE_SUCCESS(rv, rv);
-#elif defined(XP_WIN)
- nsString path;
@@ -128,9 +109,11 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
- if (!aLocal)
- rv = GetRegWindowsAppDataFolder(aLocal, path);
- }
-- }
++ if (didRemove)
++ --levelsToRemove;
+ }
- NS_ENSURE_SUCCESS(rv, rv);
--
+
- rv = NS_NewLocalFile(path, true, getter_AddRefs(localDir));
-#elif defined(MOZ_WIDGET_GONK)
- rv = NS_NewNativeLocalFile(NS_LITERAL_CSTRING("/data/b2g"), true,
@@ -138,13 +121,18 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
-#elif defined(XP_UNIX)
- const char* homeDir = getenv("HOME");
- if (!homeDir || !*homeDir)
-- return NS_ERROR_FAILURE;
--
++ if (!localDir)
+ return NS_ERROR_FAILURE;
+
-#ifdef ANDROID /* We want (ProfD == ProfLD) on Android. */
- aLocal = false;
-#endif
--
-- if (aLocal) {
++ rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING("TorBrowser"
++ XPCOM_FILE_PATH_SEPARATOR "Data"
++ XPCOM_FILE_PATH_SEPARATOR "Browser"));
++ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (aLocal) {
- // If $XDG_CACHE_HOME is defined use it, otherwise use $HOME/.cache.
- const char* cacheHome = getenv("XDG_CACHE_HOME");
- if (cacheHome && *cacheHome) {
@@ -159,14 +147,16 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
- } else {
- rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true,
- getter_AddRefs(localDir));
-- }
++ rv = localDir->AppendNative(NS_LITERAL_CSTRING("Caches"));
++ NS_ENSURE_SUCCESS(rv, rv);
+ }
-#else
-#error "Don't know how to get product dir on your platform"
-#endif
NS_IF_ADDREF(*aFile = localDir);
return rv;
-@@ -1541,48 +1491,25 @@ nsXREDirProvider::AppendProfilePath(nsIF
+@@ -1541,48 +1491,25 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile,
}
nsAutoCString profile;
@@ -218,7 +208,7 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
#elif defined(ANDROID)
// The directory used for storing profiles
-@@ -1594,12 +1521,6 @@ nsXREDirProvider::AppendProfilePath(nsIF
+@@ -1594,12 +1521,6 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile,
rv = aFile->AppendNative(nsDependentCString("mozilla"));
NS_ENSURE_SUCCESS(rv, rv);
#elif defined(XP_UNIX)
@@ -231,7 +221,7 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
if (!profile.IsEmpty()) {
// Skip any leading path characters
const char* profileStart = profile.get();
-@@ -1608,31 +1529,17 @@ nsXREDirProvider::AppendProfilePath(nsIF
+@@ -1608,31 +1529,17 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile,
// On the off chance that someone wanted their folder to be hidden don't
// let it become ".."
@@ -268,6 +258,7 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
#else
#error "Don't know how to get profile path on your platform"
diff --git a/toolkit/xre/nsXREDirProvider.h b/toolkit/xre/nsXREDirProvider.h
+index eb27ed2..1985f66 100644
--- a/toolkit/xre/nsXREDirProvider.h
+++ b/toolkit/xre/nsXREDirProvider.h
@@ -56,16 +56,16 @@ public:
@@ -302,18 +293,20 @@ diff --git a/toolkit/xre/nsXREDirProvider.h b/toolkit/xre/nsXREDirProvider.h
static nsresult GetSystemExtensionsDirectory(nsIFile** aFile);
#endif
diff --git a/xpcom/io/moz.build b/xpcom/io/moz.build
+index 45732e4..bc62f71 100644
--- a/xpcom/io/moz.build
+++ b/xpcom/io/moz.build
-@@ -134,4 +134,8 @@ FINAL_LIBRARY = 'xul'
+@@ -134,4 +134,7 @@ FINAL_LIBRARY = 'xul'
if CONFIG['OS_ARCH'] == 'Linux' and 'lib64' in CONFIG['libdir']:
DEFINES['HAVE_USR_LIB64_DIR'] = True
+-LOCAL_INCLUDES += ['!..']
+LOCAL_INCLUDES += [
-+ '../build'
++ '!..',
++ '../build',
+]
-+
- LOCAL_INCLUDES += ['!..']
diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocationProvider.cpp
+index 1211c39..039a89e 100644
--- a/xpcom/io/nsAppFileLocationProvider.cpp
+++ b/xpcom/io/nsAppFileLocationProvider.cpp
@@ -15,6 +15,7 @@
@@ -324,19 +317,19 @@ diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocation
#if defined(MOZ_WIDGET_COCOA)
#include <Carbon/Carbon.h>
-@@ -281,9 +282,8 @@ nsAppFileLocationProvider::CloneMozBinDi
+@@ -281,9 +282,8 @@ nsAppFileLocationProvider::CloneMozBinDirectory(nsIFile** aLocalFile)
//----------------------------------------------------------------------------------------
// GetProductDirectory - Gets the directory which contains the application data folder
//
-// UNIX : ~/.mozilla/
-// WIN : <Application Data folder on user's machine>\Mozilla
-// Mac : :Documents:Mozilla:
-+// UNIX and WIN : <App Folder>/TorMessenger/Data/Browser
-+// Mac : <App Folder>/../TorMessenger/Data/Browser
++// UNIX and WIN : <App Folder>/TorBrowser/Data/Browser
++// Mac : <App Folder>/../../TorBrowser/Data/Browser
//----------------------------------------------------------------------------------------
NS_METHOD
nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
-@@ -297,48 +297,45 @@ nsAppFileLocationProvider::GetProductDir
+@@ -297,48 +297,45 @@ nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
bool exists;
nsCOMPtr<nsIFile> localDir;
@@ -350,7 +343,7 @@ diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocation
+ rv = CloneMozBinDirectory(getter_AddRefs(localDir));
+ NS_ENSURE_SUCCESS(rv, rv);
+
-+ int levelsToRemove = 0;
++ int levelsToRemove = 0; // In FF21+, bin dir points to browser subdirectory.
+#if defined(XP_MACOSX)
+ levelsToRemove += 1;
+#endif
@@ -380,16 +373,7 @@ diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocation
- rv = localDirMac->InitWithFSRef(&fsRef);
- if (NS_FAILED(rv)) {
- return rv;
-+
-+ rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING("TorMessenger"
-+ XPCOM_FILE_PATH_SEPARATOR "Data"
-+ XPCOM_FILE_PATH_SEPARATOR "Browser"));
-+ NS_ENSURE_SUCCESS(rv, rv);
-+
-+ if (aLocal) {
-+ rv = localDir->AppendNative(NS_LITERAL_CSTRING("Caches"));
-+ NS_ENSURE_SUCCESS(rv, rv);
- }
+- }
-#elif defined(XP_WIN)
- nsCOMPtr<nsIProperties> directoryService =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
@@ -414,11 +398,20 @@ diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocation
- rv = localDir->AppendRelativeNativePath(DEFAULT_PRODUCT_DIR);
- if (NS_FAILED(rv)) {
- return rv;
-- }
++ rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING("TorBrowser"
++ XPCOM_FILE_PATH_SEPARATOR "Data"
++ XPCOM_FILE_PATH_SEPARATOR "Browser"));
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (aLocal) {
++ rv = localDir->AppendNative(NS_LITERAL_CSTRING("Caches"));
++ NS_ENSURE_SUCCESS(rv, rv);
+ }
++
rv = localDir->Exists(&exists);
if (NS_SUCCEEDED(rv) && !exists) {
-@@ -357,10 +354,6 @@ nsAppFileLocationProvider::GetProductDir
+@@ -357,10 +354,6 @@ nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
//----------------------------------------------------------------------------------------
// GetDefaultUserProfileRoot - Gets the directory which contains each user profile dir
@@ -429,7 +422,7 @@ diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocation
//----------------------------------------------------------------------------------------
NS_METHOD
nsAppFileLocationProvider::GetDefaultUserProfileRoot(nsIFile** aLocalFile,
-@@ -378,23 +371,6 @@ nsAppFileLocationProvider::GetDefaultUse
+@@ -378,23 +371,6 @@ nsAppFileLocationProvider::GetDefaultUserProfileRoot(nsIFile** aLocalFile,
return rv;
}
@@ -453,3 +446,6 @@ diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocation
localDir.forget(aLocalFile);
return rv;
+--
+cgit v0.10.2
+
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits