GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 9e444ef8 authored by Kathleen Brade's avatar Kathleen Brade
Browse files

If env var TOR_SKIP_LAUNCH=1, do not start the tor process.

parent 0ae1c768
......@@ -30,7 +30,6 @@ TorProcessService.prototype =
kServiceName : "Tor Launcher Process Service",
kClassID: Components.ID("{FE7B4CAF-BCF4-4848-8BFF-EFA66C9AFDA1}"),
kPrefStartTor: "extensions.torlauncher.start_tor",
kPrefPromptAtStartup: "extensions.torlauncher.prompt_at_startup",
kInitialMonitorDelayMS: 1000, // TODO: how can we avoid this delay?
kMonitorDelayMS: 200,
......@@ -78,7 +77,7 @@ TorProcessService.prototype =
this.mObsSvc.addObserver(this, kOpenNetworkSettingsTopic, false);
this.mObsSvc.addObserver(this, kUserQuitTopic, false);
if (TorLauncherUtil.getBoolPref(this.kPrefStartTor))
if (TorLauncherUtil.shouldStartAndOwnTor)
this._startTor();
}
else if ("quit-application-granted" == aTopic)
......
......@@ -71,8 +71,6 @@ TorProtocolService.prototype =
kServiceName : "Tor Launcher Protocol Service",
kClassID: Components.ID("{4F476361-23FB-43EF-A427-B36A14D3208E}"),
kPrefStartTor: "extensions.torlauncher.start_tor",
// nsISupports implementation.
QueryInterface: function(aIID)
{
......@@ -438,7 +436,7 @@ TorProtocolService.prototype =
return null;
}
if (TorLauncherUtil.getBoolPref(this.kPrefStartTor))
if (TorLauncherUtil.shouldStartAndOwnTor)
{
// Try to become the primary controller (TAKEOWNERSHIP).
reply = this._sendCommand(conn, "TAKEOWNERSHIP", null);
......
......@@ -128,6 +128,22 @@ let TorLauncherUtil = // Public
return rv;
},
get shouldStartAndOwnTor()
{
const kPrefStartTor = "extensions.torlauncher.start_tor";
try
{
const kEnvSkipLaunch = "TOR_SKIP_LAUNCH";
var env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
if (env.exists(kEnvSkipLaunch))
return ("1" != env.get(kEnvSkipLaunch));
} catch(e) {}
return this.getBoolPref(kPrefStartTor, true);
},
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment