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

gk at torproject.org gk at torproject.org
Mon May 9 17:57:25 UTC 2016


commit d4f5d1c3704007cadaf6a37f3b8330f4e1930828
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Mon May 2 17:54:39 2016 -0400

    fixup! Bug 13252 - Do not store data in the app bundle
    
    Ignore the XRE_PROFILE_PATH environment variable during the
    restart that occurs immediately after updating from a version
    of Tor Browser that uses an embedded profile (fixes bug 18928).
---
 toolkit/xre/nsAppRunner.cpp | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index 20be296..67bb2d3 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2756,6 +2756,29 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc,
   }
 
   nsCOMPtr<nsIFile> lf = GetFileFromEnv("XRE_PROFILE_PATH");
+#ifdef TOR_BROWSER_DATA_OUTSIDE_APP_DIR
+  // If we are transitioning away from an embedded profile, ignore the
+  // XRE_PROFILE_PATH value if it matches the old default profile location.
+  // This ensures that a new default profile will be created immediately
+  // after applying an update and that our migration code will then be
+  // executed.
+  if (lf) {
+    nsCOMPtr<nsIFile> oldTorProfileDir;
+    nsresult rv = GetAppRootDir(aAppDir, getter_AddRefs(oldTorProfileDir));
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = oldTorProfileDir->AppendRelativeNativePath(
+                     NS_LITERAL_CSTRING("TorBrowser" XPCOM_FILE_PATH_SEPARATOR
+                     "Data" XPCOM_FILE_PATH_SEPARATOR
+                     "Browser" XPCOM_FILE_PATH_SEPARATOR "profile.default"));
+    NS_ENSURE_SUCCESS(rv, rv);
+    bool isOldProfile = false;
+    rv = lf->Equals(oldTorProfileDir, &isOldProfile);
+    NS_ENSURE_SUCCESS(rv, rv);
+    if (isOldProfile)
+      lf = nullptr; // Ignore this XRE_PROFILE_PATH value.
+  }
+#endif
+
   if (lf) {
     nsCOMPtr<nsIFile> localDir =
       GetFileFromEnv("XRE_PROFILE_LOCAL_PATH");



More information about the tor-commits mailing list