[tbb-commits] [tor-browser/tor-browser-45.3.0esr-6.5-1] fixup! Bug 13252 - Do not store data in the app bundle

gk at torproject.org gk at torproject.org
Tue Aug 23 18:52:27 UTC 2016


commit b8726ee81e6eca2e302e2ea85c0d09ad22be1ec5
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Tue Jul 26 11:49:20 2016 -0400

    fixup! Bug 13252 - Do not store data in the app bundle
    
    For Orfox, store browser data in the app home directory.
    Fixes bug 19706.
---
 toolkit/xre/nsXREDirProvider.cpp | 2 ++
 xpcom/io/TorFileUtils.cpp        | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
index e3c1449..f50fed1 100644
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -1280,6 +1280,7 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal)
   nsresult rv = GetTorBrowserUserDataDir(getter_AddRefs(localDir));
   NS_ENSURE_SUCCESS(rv, rv);
 
+#if !defined(ANDROID)
 #ifdef TOR_BROWSER_DATA_OUTSIDE_APP_DIR
   rv = localDir->AppendNative(NS_LITERAL_CSTRING("Browser"));
 #else
@@ -1287,6 +1288,7 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal)
                                      XPCOM_FILE_PATH_SEPARATOR "Browser"));
 #endif
   NS_ENSURE_SUCCESS(rv, rv);
+#endif
 
   if (aLocal) {
     rv = localDir->AppendNative(NS_LITERAL_CSTRING("Caches"));
diff --git a/xpcom/io/TorFileUtils.cpp b/xpcom/io/TorFileUtils.cpp
index 2b0b100..c45961a 100644
--- a/xpcom/io/TorFileUtils.cpp
+++ b/xpcom/io/TorFileUtils.cpp
@@ -81,6 +81,13 @@ TorBrowser_GetUserDataDir(nsIFile *aExeFile, nsIFile** aFile)
   }
 #endif
 
+#elif defined(ANDROID)
+  // Orfox stores data in the app home directory.
+  const char* homeDir = getenv("HOME");
+  if (!homeDir || !*homeDir)
+    return NS_ERROR_FAILURE;
+  nsresult rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true,
+                                      getter_AddRefs(tbDataDir));
 #else
   // User data is embedded within the application directory (i.e.,
   // TOR_BROWSER_DATA_OUTSIDE_APP_DIR is not defined).



More information about the tbb-commits mailing list