[tbb-commits] [torbutton/master] Bug 11783: Avoid double-clicking on New Identity.

mikeperry at torproject.org mikeperry at torproject.org
Mon May 26 19:48:19 UTC 2014


commit 0a2b0782af6e0d2608e2542542222764f31d9681
Author: Georg Koppen <gk at torproject.org>
Date:   Tue May 20 13:32:31 2014 +0000

    Bug 11783: Avoid double-clicking on New Identity.
    
    It turns out that clicking several times on New Identity very quickly
    may lead to unexpected behavior, to errors like "TypeError:
    b.webProgress is undefined" and a somewhat broken browser: clicking on
    New Identity again after this error showed up shuts the browser down,
    for example. Thanks to a patch by a cypherpunk we disable the New
    Identity menuitem after the first click which resolves this issue.
---
 src/chrome/content/torbutton.js |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 43d5374..6161995 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -1431,8 +1431,14 @@ function torbutton_send_ctrl_cmd(command) {
 // Bug 1506 P4: Needed for New Identity.
 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).
+    document.getElementById("torbutton-new-identity").disabled = true;
     torbutton_do_new_identity();
   } catch(e) {
+    // If something went wrong make sure we have the New Identity button
+    // enabled (again).
+    document.getElementById("torbutton-new-identity").disabled = false;
     torbutton_log(5, "Unexpected error on new identity: "+e);
     window.alert("Torbutton: Unexpected error on new identity: "+e);
   }



More information about the tbb-commits mailing list