Browse Source

Bug 21091: Hide the "Check for Tor Browser Update..." menu entry when running under the sandbox.

If the sandbox specific enviornment variable `TOR_SANDBOX` is set to
`linux-v0`, hide the "Check for Tor Browser Update..." menu entry and
the separator that sits right above it.
Yawning Angel 3 years ago
parent
commit
9abc7fd22f
2 changed files with 12 additions and 1 deletions
  1. 1 1
      src/chrome/content/popup.xul
  2. 11 0
      src/chrome/content/torbutton.js

+ 1 - 1
src/chrome/content/popup.xul

@@ -44,7 +44,7 @@
                   label="&torbutton.context_menu.networksettings;"
                   accesskey="&torbutton.context_menu.networksettings.key;"
                   oncommand="torbutton_open_network_settings()"/>
-        <menuseparator/>
+        <menuseparator id="torbutton-checkForUpdateSeparator"/>
         <menuitem id="torbutton-checkForUpdate"
                   label="&torbutton.context_menu.downloadUpdate;"
                   accesskey="&torbutton.context_menu.downloadUpdate.key;"

+ 11 - 0
src/chrome/content/torbutton.js

@@ -1822,6 +1822,17 @@ function torbutton_check_protections()
   else
     document.getElementById("torbutton-networksettings").hidden = false;
 
+  // Bug 21091: check for the existence and value of an enviornment variable
+  // in order to toggle the visibility of torbutton-checkForUpdate menuitem,
+  // and it's separator.
+  if (env.exists("TOR_SANDBOX") && env.get("TOR_SANDBOX") == "linux-v0") {
+    document.getElementById("torbutton-checkForUpdateSeparator").hidden = true;
+    document.getElementById("torbutton-checkForUpdate").hidden = true;
+  } else {
+    document.getElementById("torbutton-checkForUpdateSeparator").hidden = false;
+    document.getElementById("torbutton-checkForUpdate").hidden = false;
+  }
+
   var cookie_pref = m_tb_prefs.getBoolPref("extensions.torbutton.cookie_protections");
   document.getElementById("torbutton-cookie-protector").disabled = !cookie_pref;