[tor-commits] [tor-launcher/master] Bug #11077: Always show wizard if TOR_FORCE_NET_CONFIG=1

brade at torproject.org brade at torproject.org
Thu Feb 27 22:00:28 UTC 2014


commit a232915ecdeab54881cc96214f31752dc2134bda
Author: Tails developers <amnesia at boum.org>
Date:   Mon Feb 17 20:36:20 2014 +0100

    Bug #11077: Always show wizard if TOR_FORCE_NET_CONFIG=1
---
 src/components/tl-process.js |   10 ++--------
 src/modules/tl-util.jsm      |   16 ++++++++++++++++
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/components/tl-process.js b/src/components/tl-process.js
index 2517ae5..48f0126 100644
--- a/src/components/tl-process.js
+++ b/src/components/tl-process.js
@@ -270,9 +270,6 @@ TorProcessService.prototype =
   {
     this.mTorProcessStatus = this.kStatusUnknown;
 
-    var isInitialBootstrap =
-                     TorLauncherUtil.getBoolPref(this.kPrefPromptAtStartup);
-
     try
     {
       // Ideally, we would cd to the Firefox application directory before
@@ -329,7 +326,7 @@ TorProcessService.prototype =
         args.push("" + pid);
       }
 
-      if (isInitialBootstrap)
+      if (TorLauncherUtil.shouldShowNetworkSettings)
       {
         args.push("DisableNetwork");
         args.push("1");
@@ -360,14 +357,11 @@ TorProcessService.prototype =
 
   _controlTor: function()
   {
-    var isInitialBootstrap =
-          TorLauncherUtil.getBoolPref(this.kPrefPromptAtStartup);
-
     try
     {
       this._monitorTorProcessStartup();
 
-      if (isInitialBootstrap)
+      if (TorLauncherUtil.shouldShowNetworkSettings)
       {
         if (this.mProtocolSvc)
           this._openNetworkSettings(true); // Blocks until dialog is closed.
diff --git a/src/modules/tl-util.jsm b/src/modules/tl-util.jsm
index 5b1c6c0..0c31aa5 100644
--- a/src/modules/tl-util.jsm
+++ b/src/modules/tl-util.jsm
@@ -197,6 +197,22 @@ let TorLauncherUtil =  // Public
     return this.getBoolPref(kPrefStartTor, true);
   },
 
+  get shouldShowNetworkSettings()
+  {
+    const kPrefPromptAtStartup = "extensions.torlauncher.prompt_at_startup";
+    try
+    {
+      const kEnvForceShowNetConfig = "TOR_FORCE_NET_CONFIG";
+
+      var env = Cc["@mozilla.org/process/environment;1"]
+                  .getService(Ci.nsIEnvironment);
+      if (env.exists(kEnvForceShowNetConfig))
+        return ("1" == env.get(kEnvForceShowNetConfig));
+    } catch(e) {}
+
+    return this.getBoolPref(kPrefPromptAtStartup, true);
+  },
+
   get shouldOnlyConfigureTor()
   {
     const kPrefOnlyConfigureTor = "extensions.torlauncher.only_configure_tor";



More information about the tor-commits mailing list