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
-
9f0b2da8
by Pier Angelo Vendrame at 2026-03-05T18:16:38+01:00
-
45691865
by Pier Angelo Vendrame at 2026-03-05T18:16:38+01:00
3 changed files:
- python/mozbuild/mozbuild/backend/base.py
- toolkit/components/tor-launcher/TorLauncherUtil.sys.mjs
- toolkit/components/tor-launcher/TorProcess.sys.mjs
Changes:
| ... | ... | @@ -305,9 +305,9 @@ class BuildBackend(LoggingMixin): |
| 305 | 305 | "docs": tbdir / "TorBrowser/Docs",
|
| 306 | 306 | "exts": tbdir / "distribution/extensions",
|
| 307 | 307 | "tor_bin": tbdir / "TorBrowser/Tor",
|
| 308 | - "tor_config": tbdir / "TorBrowser/Data/Tor",
|
|
| 309 | 308 | "fonts": tbdir / "fonts",
|
| 310 | 309 | }
|
| 310 | + paths["tor_config"] = paths["tor_bin"]
|
|
| 311 | 311 | |
| 312 | 312 | fonts_location = config.substs.get("TOR_BROWSER_FONTS")
|
| 313 | 313 | if fonts_location:
|
| ... | ... | @@ -59,16 +59,29 @@ class TorFile { |
| 59 | 59 | }
|
| 60 | 60 | |
| 61 | 61 | getFromPref() {
|
| 62 | - const prefName = `extensions.torlauncher.${this.fileType}_path`;
|
|
| 63 | - const path = Services.prefs.getCharPref(prefName, "");
|
|
| 62 | + const getPath = type =>
|
|
| 63 | + Services.prefs.getCharPref(`extensions.torlauncher.${type}_path`, "");
|
|
| 64 | + let path = getPath(this.fileType);
|
|
| 65 | + let takeParent = false;
|
|
| 66 | + if (!path && this.fileType === "torappdatadir") {
|
|
| 67 | + // tor-browser-build#40892: for the tor app data dir, try to use also the
|
|
| 68 | + // previous behavior (detect it from the torrc-defaults).
|
|
| 69 | + path = getPath("torrc-defaults");
|
|
| 70 | + takeParent = true;
|
|
| 71 | + }
|
|
| 64 | 72 | if (path) {
|
| 65 | - const isUserData =
|
|
| 66 | - this.fileType !== "tor" &&
|
|
| 67 | - this.fileType !== "pt-startup-dir" &&
|
|
| 68 | - this.fileType !== "torrc-defaults";
|
|
| 73 | + const isUserData = ![
|
|
| 74 | + "tor",
|
|
| 75 | + "pt-startup-dir",
|
|
| 76 | + "torrc-defaults",
|
|
| 77 | + "torappdatadir",
|
|
| 78 | + ].includes(this.fileType);
|
|
| 69 | 79 | // always try to use path if provided in pref
|
| 70 | 80 | this.checkIPCPathLen = false;
|
| 71 | 81 | this.setFileFromPath(path, isUserData);
|
| 82 | + if (this.file && takeParent) {
|
|
| 83 | + this.file = this.file.parent;
|
|
| 84 | + }
|
|
| 72 | 85 | }
|
| 73 | 86 | }
|
| 74 | 87 | |
| ... | ... | @@ -143,17 +156,8 @@ class TorFile { |
| 143 | 156 | this.file.append(TorLauncherUtil.isWindows ? "tor.exe" : "tor");
|
| 144 | 157 | break;
|
| 145 | 158 | case "torrc-defaults":
|
| 146 | - if (TorLauncherUtil.isMac) {
|
|
| 147 | - this.file = TorFile.appDir;
|
|
| 148 | - this.file.appendRelativePath(
|
|
| 149 | - "Contents/Resources/TorBrowser/Tor/torrc-defaults"
|
|
| 150 | - );
|
|
| 151 | - } else {
|
|
| 152 | - // FIXME: Should we move this file to the tor directory, in the other
|
|
| 153 | - // platforms, since it is not user data?
|
|
| 154 | - this.file = TorFile.torDataDir;
|
|
| 155 | - this.file.append("torrc-defaults");
|
|
| 156 | - }
|
|
| 159 | + this.file = TorFile.torAppDataDir;
|
|
| 160 | + this.file.append("torrc-defaults");
|
|
| 157 | 161 | break;
|
| 158 | 162 | case "torrc":
|
| 159 | 163 | this.file = TorFile.torDataDir;
|
| ... | ... | @@ -162,6 +166,9 @@ class TorFile { |
| 162 | 166 | case "tordatadir":
|
| 163 | 167 | this.file = TorFile.torDataDir;
|
| 164 | 168 | break;
|
| 169 | + case "torappdatadir":
|
|
| 170 | + this.file = TorFile.torAppDataDir;
|
|
| 171 | + break;
|
|
| 165 | 172 | case "toronionauthdir":
|
| 166 | 173 | this.file = TorFile.torDataDir;
|
| 167 | 174 | this.file.append("onion-auth");
|
| ... | ... | @@ -293,6 +300,16 @@ class TorFile { |
| 293 | 300 | return this._appDir.clone();
|
| 294 | 301 | }
|
| 295 | 302 | |
| 303 | + static get torAppDataDir() {
|
|
| 304 | + // No need to call clone on these objects, as they are already clones.
|
|
| 305 | + if (TorLauncherUtil.isMac) {
|
|
| 306 | + const dir = this.appDir;
|
|
| 307 | + dir.appendRelativePath("Contents/Resources/TorBrowser/Tor");
|
|
| 308 | + return dir;
|
|
| 309 | + }
|
|
| 310 | + return this.torDir;
|
|
| 311 | + }
|
|
| 312 | + |
|
| 296 | 313 | // Returns an nsIFile that points to the data directory. This is usually
|
| 297 | 314 | // TorBrowser/Data/ on Linux and Windows, and TorBrowser-Data/ on macOS.
|
| 298 | 315 | // The parent directory of the default profile directory is taken.
|
| ... | ... | @@ -264,20 +264,40 @@ export class TorProcess { |
| 264 | 264 | );
|
| 265 | 265 | if (torrcDefaultsFile) {
|
| 266 | 266 | this.#args.push("--defaults-torrc", torrcDefaultsFile.path);
|
| 267 | - // The geoip and geoip6 files are in the same directory as torrc-defaults.
|
|
| 268 | - // TODO: Change TorFile to return the generic path to these files to make
|
|
| 269 | - // them independent from the torrc-defaults.
|
|
| 270 | - const geoipFile = torrcDefaultsFile.clone();
|
|
| 271 | - geoipFile.leafName = "geoip";
|
|
| 272 | - this.#args.push("GeoIPFile", geoipFile.path);
|
|
| 273 | - const geoip6File = torrcDefaultsFile.clone();
|
|
| 274 | - geoip6File.leafName = "geoip6";
|
|
| 275 | - this.#args.push("GeoIPv6File", geoip6File.path);
|
|
| 276 | 267 | } else {
|
| 277 | 268 | logger.warn(
|
| 278 | 269 | "torrc-defaults was not found, some functionalities will be disabled."
|
| 279 | 270 | );
|
| 280 | 271 | }
|
| 272 | + |
|
| 273 | + const torAppDataDir = lazy.TorLauncherUtil.getTorFile(
|
|
| 274 | + "torappdatadir",
|
|
| 275 | + false
|
|
| 276 | + );
|
|
| 277 | + if (torAppDataDir) {
|
|
| 278 | + const geoipFile = torAppDataDir.clone();
|
|
| 279 | + geoipFile.append("geoip");
|
|
| 280 | + if (geoipFile.exists()) {
|
|
| 281 | + this.#args.push("GeoIPFile", geoipFile.path);
|
|
| 282 | + } else {
|
|
| 283 | + logger.warn(
|
|
| 284 | + "GeoIP file not found, the circuit display will not show locations."
|
|
| 285 | + );
|
|
| 286 | + }
|
|
| 287 | + const geoip6File = torAppDataDir.clone();
|
|
| 288 | + geoip6File.append("geoip6");
|
|
| 289 | + if (geoip6File.exists()) {
|
|
| 290 | + this.#args.push("GeoIPv6File", geoip6File.path);
|
|
| 291 | + } else {
|
|
| 292 | + logger.warn(
|
|
| 293 | + "GeoIP6 file not found, the circuit display will not show locations for IPv6-only relays."
|
|
| 294 | + );
|
|
| 295 | + }
|
|
| 296 | + } else {
|
|
| 297 | + logger.warn(
|
|
| 298 | + "App data directory not found, the circuit display will not show locations."
|
|
| 299 | + );
|
|
| 300 | + }
|
|
| 281 | 301 | }
|
| 282 | 302 | |
| 283 | 303 | /**
|