guix_mirror_bot pushed a commit to branch gnuzilla-updates
in repository guix.

commit 46ccac8581ea4aa44bf138490cf6d36c0b4bf452
Author: Maxim Cournoyer <ma...@guixotic.coop>
AuthorDate: Sun Sep 14 14:27:54 2025 +0900

    gnu: torbrowser: Decouple from IceCat patches.
    
    In preparation for updating IceCat.
    
    * gnu/packages/patches/torbrowser-use-system-wide-dir.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register it.
    * gnu/packages/tor-browsers.scm (make-torbrowser): Adjust accordingly.
    
    Change-Id: I56ae81480a96d815d6b3fe5fc3befb1f1c74483f
---
 gnu/local.mk                                       |  1 +
 .../patches/torbrowser-use-system-wide-dir.patch   | 36 ++++++++++++++++++++++
 gnu/packages/tor-browsers.scm                      |  2 +-
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index c5767dcb9e..971e3bd08b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2368,6 +2368,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/tlf-support-hamlib-4.2+.patch           \
   %D%/packages/patches/tofi-32bit-compat.patch                 \
   %D%/packages/patches/torbrowser-compare-paths.patch           \
+  %D%/packages/patches/torbrowser-use-system-wide-dir.patch     \
   %D%/packages/patches/torbrowsers-add-store-to-rdd-allowlist.patch     \
   %D%/packages/patches/tpetra-remove-duplicate-using.patch     \
   %D%/packages/patches/transcode-ffmpeg.patch  \
diff --git a/gnu/packages/patches/torbrowser-use-system-wide-dir.patch 
b/gnu/packages/patches/torbrowser-use-system-wide-dir.patch
new file mode 100644
index 0000000000..223467a9c1
--- /dev/null
+++ b/gnu/packages/patches/torbrowser-use-system-wide-dir.patch
@@ -0,0 +1,36 @@
+Replace "/usr/lib/mozilla" (the system-wide directory for extensions and
+native manifests) with "$ICECAT_SYSTEM_DIR".
+
+--- a/toolkit/xre/nsXREDirProvider.cpp
++++ b/toolkit/xre/nsXREDirProvider.cpp
+@@ -296,24 +296,12 @@ nsresult 
nsXREDirProvider::GetBackgroundTasksProfilesRootDir(
+ static nsresult GetSystemParentDirectory(nsIFile** aFile) {
+   nsresult rv;
+   nsCOMPtr<nsIFile> localDir;
+-#  if defined(XP_MACOSX)
+-  rv = GetOSXFolderType(kOnSystemDisk, kApplicationSupportFolderType,
+-                        getter_AddRefs(localDir));
+-  if (NS_SUCCEEDED(rv)) {
+-    rv = localDir->AppendNative("Mozilla"_ns);
+-  }
+-#  else
+-  constexpr auto dirname =
+-#    ifdef HAVE_USR_LIB64_DIR
+-      "/usr/lib64/mozilla"_ns
+-#    elif defined(__OpenBSD__) || defined(__FreeBSD__)
+-      "/usr/local/lib/mozilla"_ns
+-#    else
+-      "/usr/lib/mozilla"_ns
+-#    endif
+-      ;
+-  rv = NS_NewNativeLocalFile(dirname, false, getter_AddRefs(localDir));
+-#  endif
++
++  const char* systemParentDir = getenv("ICECAT_SYSTEM_DIR");
++  if (!systemParentDir || !*systemParentDir) return NS_ERROR_FAILURE;
++
++  rv = NS_NewNativeLocalFile(nsDependentCString(systemParentDir), false,
++                             getter_AddRefs(localDir));
+ 
+   if (NS_SUCCEEDED(rv)) {
+     localDir.forget(aFile);
diff --git a/gnu/packages/tor-browsers.scm b/gnu/packages/tor-browsers.scm
index 12763a99ca..8459048e07 100644
--- a/gnu/packages/tor-browsers.scm
+++ b/gnu/packages/tor-browsers.scm
@@ -376,7 +376,7 @@ Browser.")
                    (search-patch
                     "torbrowsers-add-store-to-rdd-allowlist.patch"))
                  #$(local-file
-                    (search-patch "icecat-use-system-wide-dir.patch"))))))
+                    (search-patch "torbrowser-use-system-wide-dir.patch"))))))
           (add-after 'apply-guix-specific-patches 'remove-bundled-libraries
             (lambda _
               ;; Remove bundled libraries that we don't use, since they may

Reply via email to