[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-115.10.0esr-13.5-1] fixup! Bug 9173: Change the default Firefox profile directory to be relative.

richard (@richard) git at gitlab.torproject.org
Wed Apr 17 18:10:53 UTC 2024



richard pushed to branch tor-browser-115.10.0esr-13.5-1 at The Tor Project / Applications / Tor Browser


Commits:
795d4d37 by Pier Angelo Vendrame at 2024-04-17T17:59:38+00:00
fixup! Bug 9173: Change the default Firefox profile directory to be relative.

Bug 42519: Disable portable mode also if is-packaged-app is present.

That is the file Firefox uses for .deb packages.

- - - - -


2 changed files:

- toolkit/xre/nsXREDirProvider.cpp
- xpcom/io/nsAppFileLocationProvider.cpp


Changes:

=====================================
toolkit/xre/nsXREDirProvider.cpp
=====================================
@@ -1285,19 +1285,30 @@ nsresult nsXREDirProvider::GetPortableDataDir(nsIFile** aFile,
   }
 #  endif
 
-  nsCOMPtr<nsIFile> systemInstallFile;
-  rv = exeDir->Clone(getter_AddRefs(systemInstallFile));
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = systemInstallFile->AppendNative("system-install"_ns);
-  NS_ENSURE_SUCCESS(rv, rv);
+#  if defined(MOZ_WIDGET_GTK)
+  // On Linux, Firefox supports the is-packaged-app for the .deb distribution.
+  // We cannot use mozilla::widget::IsPackagedAppFileExists because it relies on
+  // this service to be initialized, but this function is called during the
+  // initialization. Therefore, we need to re-implement this check.
+  nsLiteralCString systemInstallNames[] = {"system-install"_ns,
+                                           "is-packaged-app"_ns};
+#  else
+  nsLiteralCString systemInstallNames[] = {"system-install"_ns};
+#  endif
+  for (const nsLiteralCString& fileName : systemInstallNames) {
+    nsCOMPtr<nsIFile> systemInstallFile;
+    rv = exeDir->Clone(getter_AddRefs(systemInstallFile));
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = systemInstallFile->AppendNative(fileName);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-  bool exists = false;
-  rv = systemInstallFile->Exists(&exists);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (exists) {
-    aIsPortable = false;
-    gDataDirPortable.emplace(nullptr);
-    return NS_OK;
+    bool exists = false;
+    rv = systemInstallFile->Exists(&exists);
+    NS_ENSURE_SUCCESS(rv, rv);
+    if (exists) {
+      gDataDirPortable.emplace(nullptr);
+      return NS_OK;
+    }
   }
 
   nsCOMPtr<nsIFile> localDir = exeDir;


=====================================
xpcom/io/nsAppFileLocationProvider.cpp
=====================================
@@ -195,18 +195,27 @@ static nsresult SetupPortableMode(nsIFile** aDirectory, bool aLocal,
   }
 #  endif
 
-  nsCOMPtr<nsIFile> systemInstallFile;
-  rv = exeDir->Clone(getter_AddRefs(systemInstallFile));
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = systemInstallFile->AppendNative("system-install"_ns);
-  NS_ENSURE_SUCCESS(rv, rv);
+#  if defined(MOZ_WIDGET_GTK)
+  // On Linux, Firefox supports the is-packaged-app for the .deb distribution.
+  nsLiteralCString systemInstallNames[] = {"system-install"_ns,
+                                           "is-packaged-app"_ns};
+#  else
+  nsLiteralCString systemInstallNames[] = {"system-install"_ns};
+#  endif
+  for (const nsLiteralCString& fileName : systemInstallNames) {
+    nsCOMPtr<nsIFile> systemInstallFile;
+    rv = exeDir->Clone(getter_AddRefs(systemInstallFile));
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = systemInstallFile->AppendNative(fileName);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-  bool exists = false;
-  rv = systemInstallFile->Exists(&exists);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (exists) {
-    aIsPortable = false;
-    return NS_OK;
+    bool exists = false;
+    rv = systemInstallFile->Exists(&exists);
+    NS_ENSURE_SUCCESS(rv, rv);
+    if (exists) {
+      aIsPortable = false;
+      return NS_OK;
+    }
   }
 
   nsCOMPtr<nsIFile> localDir = exeDir;
@@ -226,6 +235,7 @@ static nsresult SetupPortableMode(nsIFile** aDirectory, bool aLocal,
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
+  bool exists = false;
   rv = localDir->Exists(&exists);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!exists) {



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/795d4d379c05bcad71d3d4103362b6fd4de65a85

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/795d4d379c05bcad71d3d4103362b6fd4de65a85
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240417/47419438/attachment-0001.htm>


More information about the tbb-commits mailing list