commit 2ba36eb269b86ca90835c3e39f6b4a7546dd76ba Author: Georg Koppen gk@torproject.org Date: Wed Sep 12 14:56:36 2018 +0000
Bug 27663: Add New Identity menuitem again
Moving the New Identity button to the hamburger menu without having the redesign of our security controls in place and without having a proper guidance for where we moved it to is confusing. Let's revert that decision until we have all required pieces ready.
We omit the key attribute from the menu item to avoid doing a New Identity twice if users press Ctrl+Shift+u. --- src/chrome/content/popup.xul | 6 ++++++ src/chrome/content/torbutton.js | 12 ++++++++++++ 2 files changed, 18 insertions(+)
diff --git a/src/chrome/content/popup.xul b/src/chrome/content/popup.xul index b4191e30..582593f6 100644 --- a/src/chrome/content/popup.xul +++ b/src/chrome/content/popup.xul @@ -15,6 +15,12 @@ anchor="torbutton-button" position="after_start" > <hbox align="start"> <vbox> + <menuitem id="torbutton-new-identity" + label="&torbutton.context_menu.new_identity;" + accesskey="&torbutton.context_menu.new_identity_key;" + insertafter="context-stop" + oncommand="torbutton_new_identity()"/> + <menuseparator/> <menuitem id="torbutton-cookie-protector" label="&torbutton.context_menu.cookieProtections;" accesskey="&torbutton.context_menu.cookieProtections.key;" diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js index c3f68510..9f6ba898 100644 --- a/src/chrome/content/torbutton.js +++ b/src/chrome/content/torbutton.js @@ -822,6 +822,9 @@ function torbutton_new_identity() { try { // Make sure that we can only click once on New Identiy to avoid race // conditions leading to failures (see bug 11783 for an example). + // TODO: Remove the Torbutton menu entry again once we have done our + // security control redesign. + document.getElementById("torbutton-new-identity").disabled = true; document.getElementById("menu_newIdentity").disabled = true; document.getElementById("appMenuNewIdentity").disabled = true;
@@ -846,6 +849,9 @@ function torbutton_new_identity() { if (confirmed) { torbutton_do_new_identity(); } else { + // TODO: Remove the Torbutton menu entry again once we have done our + // security control redesign. + document.getElementById("torbutton-new-identity").disabled = false; document.getElementById("menu_newIdentity").disabled = false; document.getElementById("appMenuNewIdentity").disabled = false; } @@ -855,6 +861,9 @@ function torbutton_new_identity() { } catch(e) { // If something went wrong make sure we have the New Identity button // enabled (again). + // TODO: Remove the Torbutton menu entry again once we have done our + // security control redesign. + document.getElementById("torbutton-new-identity").disabled = false; document.getElementById("menu_newIdentity").disabled = false; document.getElementById("appMenuNewIdentity").disabled = false; torbutton_log(5, "Unexpected error on new identity: "+e); @@ -1628,6 +1637,9 @@ function torbutton_check_protections() document.getElementById("torbutton-cookie-protector").hidden = m_tb_prefs.getBoolPref("browser.privatebrowsing.autostart");
if (!m_tb_control_pass || (!m_tb_control_ipc_file && !m_tb_control_port)) { + // TODO: Remove the Torbutton menu entry again once we have done our + // security control redesign. + document.getElementById("torbutton-new-identity").disabled = true; document.getElementById("menu_newIdentity").disabled = true; document.getElementById("appMenuNewIdentity").disabled = true; }