Pier Angelo Vendrame pushed to branch tor-browser-102.6.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits: 847ff5d3 by Pier Angelo Vendrame at 2023-01-12T14:17:24+01:00 fixup! Bug 40933: Add tor-launcher functionality
Bug 41569: Launch directly the real tor also on macOS, rather than the shim script
Bug 41570: Do not customize environment variables for tor anymore
- - - - -
2 changed files:
- toolkit/components/tor-launcher/TorLauncherUtil.jsm - toolkit/components/tor-launcher/TorProcess.jsm
Changes:
===================================== toolkit/components/tor-launcher/TorLauncherUtil.jsm ===================================== @@ -144,9 +144,10 @@ class TorFile { // Anyway, that macro is also available in AppConstants. if (TorFile.isUserDataOutsideOfAppDir) { if (TorLauncherUtil.isMac) { - torPath = "Contents/Resources/"; + torPath = "Contents/MacOS/Tor"; + } else { + torPath = "TorBrowser/Tor"; } - torPath += "TorBrowser/Tor"; } else { torPath = "Tor"; dataDir = "Data/"; @@ -154,17 +155,16 @@ class TorFile {
switch (this.fileType) { case "tor": - if (TorLauncherUtil.isMac) { - this.path = `${torPath}/tor`; - } else { - this.path = - torPath + "/tor" + (TorLauncherUtil.isWindows ? ".exe" : ""); + this.path = `${torPath}/tor`; + if (TorLauncherUtil.isWindows) { + this.path += ".exe"; } break; case "torrc-defaults": - this.path = TorFile.isUserDataOutsideOfAppDir - ? `${torPath}/torrc-defaults` - : `${dataDir}Tor/torrc-defaults`; + this.path = TorLauncherUtil.isMac + ? "Contents/Resources/TorBrowser/Tor" + : `${dataDir}Tor`; + this.path += "/torrc-defaults"; break; case "torrc": this.path = `${dataDir}Tor/torrc`;
===================================== toolkit/components/tor-launcher/TorProcess.jsm ===================================== @@ -93,27 +93,6 @@ class TorProcess { this._args.push("1"); }
- // Set an environment variable that points to the Tor data directory. - // This is used by meek-client-torbrowser to find the location for - // the meek browser profile. - const environment = { - TOR_BROWSER_TOR_DATA_DIR: this._dataDir.path, - }; - - // On Windows, prepend the Tor program directory to PATH. This is needed - // so that pluggable transports can find OpenSSL DLLs, etc. - // See https://trac.torproject.org/projects/tor/ticket/10845 - if (TorLauncherUtil.isWindows) { - let path = this._exeFile.parent.path; - const env = Cc["@mozilla.org/process/environment;1"].getService( - Ci.nsIEnvironment - ); - if (env.exists("PATH")) { - path += ";" + env.get("PATH"); - } - environment.PATH = path; - } - this._status = TorProcessStatus.Starting; this._didConnectToTorControlPort = false;
@@ -131,10 +110,13 @@ class TorProcess { const options = { command: this._exeFile.path, arguments: this._args, - environment, - environmentAppend: true, stderr: "stdout", }; + if (TorLauncherUtil.isMac) { + // On macOS, we specify pluggable transport relative to the tor + // executable. + options.workdir = this._exeFile.parent.path; + } this._subprocess = await Subprocess.call(options); this._dumpStdout(); this._watchProcess();
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/847ff5d3...