[tbb-commits] [torbutton/master] Bug 14100: Add option to hide NetworkSettings

gk at torproject.org gk at torproject.org
Tue Jan 13 08:46:05 UTC 2015


commit 765fee607af6fa88b99476dee10298e5db3b9eb1
Author: Georg Koppen <gk at torproject.org>
Date:   Tue Jan 13 09:36:35 2015 +0000

    Bug 14100: Add option to hide NetworkSettings
    
    This patch hides the NetworkSettings menuitem if the environment
    variable TOR_NO_DISPLAY_NETWORK_SETTINGS is set. Thanks to linostar
    for writing it.
---
 src/chrome/content/torbutton.js |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index bf06e04..4715fb6 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -2386,6 +2386,16 @@ function torbutton_close_on_toggle(mode, newnym) {
 // New Identity where it is not supported (ie no control port).
 function torbutton_check_protections()
 {
+  var env = Cc["@mozilla.org/process/environment;1"]
+              .getService(Ci.nsIEnvironment);
+
+  // Bug 14100: check for the existence of an environment variable
+  // in order to toggle the visibility of networksettings menuitem
+  if (env.exists("TOR_NO_DISPLAY_NETWORK_SETTINGS"))
+    document.getElementById("torbutton-networksettings").hidden = true;
+  else
+    document.getElementById("torbutton-networksettings").hidden = false;
+
   var cookie_pref = m_tb_prefs.getBoolPref("extensions.torbutton.cookie_protections");
   document.getElementById("torbutton-cookie-protector").disabled = !cookie_pref;
 



More information about the tbb-commits mailing list