Skip to content
Snippets Groups Projects
Verified Commit 847ff5d3 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

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
parent 2ec04e75
Branches
No related tags found
1 merge request!512Bug 41569&41570: Decluttering of TorProcess.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" : "");
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`;
......
......
......@@ -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();
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment