Pier Angelo Vendrame pushed to branch tor-browser-148.0a1-16.0-2 at The Tor Project / Applications / Tor Browser Commits: 75088aeb by Pier Angelo Vendrame at 2026-03-05T18:16:38+01:00 fixup! TB 40933: Add tor-launcher functionality TBB 40892: Move torrc-defaults and geoip files. - - - - - 9f0b2da8 by Pier Angelo Vendrame at 2026-03-05T18:16:38+01:00 fixup! TB 43564: Modify ./mach bootstrap for Tor Browser TBB 40892: Move torrc-defaults and geoip files. Adapt bootstrap to the new paths. - - - - - 45691865 by Pier Angelo Vendrame at 2026-03-05T18:16:38+01:00 fixup! TB 40933: Add tor-launcher functionality TBB 40892: Move torrc-defaults and geoip files. Add some compatibility code for users who set a pref for the torrc-defaults. In this case, we will take the new torappsdatadir as the parent of that path. - - - - - 3 changed files: - python/mozbuild/mozbuild/backend/base.py - toolkit/components/tor-launcher/TorLauncherUtil.sys.mjs - toolkit/components/tor-launcher/TorProcess.sys.mjs Changes: ===================================== python/mozbuild/mozbuild/backend/base.py ===================================== @@ -305,9 +305,9 @@ class BuildBackend(LoggingMixin): "docs": tbdir / "TorBrowser/Docs", "exts": tbdir / "distribution/extensions", "tor_bin": tbdir / "TorBrowser/Tor", - "tor_config": tbdir / "TorBrowser/Data/Tor", "fonts": tbdir / "fonts", } + paths["tor_config"] = paths["tor_bin"] fonts_location = config.substs.get("TOR_BROWSER_FONTS") if fonts_location: ===================================== toolkit/components/tor-launcher/TorLauncherUtil.sys.mjs ===================================== @@ -59,16 +59,29 @@ class TorFile { } getFromPref() { - const prefName = `extensions.torlauncher.${this.fileType}_path`; - const path = Services.prefs.getCharPref(prefName, ""); + const getPath = type => + Services.prefs.getCharPref(`extensions.torlauncher.${type}_path`, ""); + let path = getPath(this.fileType); + let takeParent = false; + if (!path && this.fileType === "torappdatadir") { + // tor-browser-build#40892: for the tor app data dir, try to use also the + // previous behavior (detect it from the torrc-defaults). + path = getPath("torrc-defaults"); + takeParent = true; + } if (path) { - const isUserData = - this.fileType !== "tor" && - this.fileType !== "pt-startup-dir" && - this.fileType !== "torrc-defaults"; + const isUserData = ![ + "tor", + "pt-startup-dir", + "torrc-defaults", + "torappdatadir", + ].includes(this.fileType); // always try to use path if provided in pref this.checkIPCPathLen = false; this.setFileFromPath(path, isUserData); + if (this.file && takeParent) { + this.file = this.file.parent; + } } } @@ -143,17 +156,8 @@ class TorFile { this.file.append(TorLauncherUtil.isWindows ? "tor.exe" : "tor"); break; case "torrc-defaults": - if (TorLauncherUtil.isMac) { - this.file = TorFile.appDir; - this.file.appendRelativePath( - "Contents/Resources/TorBrowser/Tor/torrc-defaults" - ); - } else { - // FIXME: Should we move this file to the tor directory, in the other - // platforms, since it is not user data? - this.file = TorFile.torDataDir; - this.file.append("torrc-defaults"); - } + this.file = TorFile.torAppDataDir; + this.file.append("torrc-defaults"); break; case "torrc": this.file = TorFile.torDataDir; @@ -162,6 +166,9 @@ class TorFile { case "tordatadir": this.file = TorFile.torDataDir; break; + case "torappdatadir": + this.file = TorFile.torAppDataDir; + break; case "toronionauthdir": this.file = TorFile.torDataDir; this.file.append("onion-auth"); @@ -293,6 +300,16 @@ class TorFile { return this._appDir.clone(); } + static get torAppDataDir() { + // No need to call clone on these objects, as they are already clones. + if (TorLauncherUtil.isMac) { + const dir = this.appDir; + dir.appendRelativePath("Contents/Resources/TorBrowser/Tor"); + return dir; + } + return this.torDir; + } + // Returns an nsIFile that points to the data directory. This is usually // TorBrowser/Data/ on Linux and Windows, and TorBrowser-Data/ on macOS. // The parent directory of the default profile directory is taken. ===================================== toolkit/components/tor-launcher/TorProcess.sys.mjs ===================================== @@ -264,20 +264,40 @@ export class TorProcess { ); if (torrcDefaultsFile) { this.#args.push("--defaults-torrc", torrcDefaultsFile.path); - // The geoip and geoip6 files are in the same directory as torrc-defaults. - // TODO: Change TorFile to return the generic path to these files to make - // them independent from the torrc-defaults. - const geoipFile = torrcDefaultsFile.clone(); - geoipFile.leafName = "geoip"; - this.#args.push("GeoIPFile", geoipFile.path); - const geoip6File = torrcDefaultsFile.clone(); - geoip6File.leafName = "geoip6"; - this.#args.push("GeoIPv6File", geoip6File.path); } else { logger.warn( "torrc-defaults was not found, some functionalities will be disabled." ); } + + const torAppDataDir = lazy.TorLauncherUtil.getTorFile( + "torappdatadir", + false + ); + if (torAppDataDir) { + const geoipFile = torAppDataDir.clone(); + geoipFile.append("geoip"); + if (geoipFile.exists()) { + this.#args.push("GeoIPFile", geoipFile.path); + } else { + logger.warn( + "GeoIP file not found, the circuit display will not show locations." + ); + } + const geoip6File = torAppDataDir.clone(); + geoip6File.append("geoip6"); + if (geoip6File.exists()) { + this.#args.push("GeoIPv6File", geoip6File.path); + } else { + logger.warn( + "GeoIP6 file not found, the circuit display will not show locations for IPv6-only relays." + ); + } + } else { + logger.warn( + "App data directory not found, the circuit display will not show locations." + ); + } } /** View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/5c3df05... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/5c3df05... You're receiving this email because of your account on gitlab.torproject.org.
participants (1)
-
Pier Angelo Vendrame (@pierov)