[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit a232915ecdeab54881cc96214f31752dc2134bda
Author: Tails developers <amnesia@xxxxxxxx>
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";

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits