[tor-commits] [torbutton/master] Bug 11763: Fix race condition in pref dialog.

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


commit 377bc3d2b64d1cffcb863b534077882e7ef9af68
Author: Georg Koppen <gk at torproject.org>
Date:   Wed May 21 20:46:29 2014 +0000

    Bug 11763: Fix race condition in pref dialog.
    
    If a user is clicking on the Accept button on the preferences dialog
    more than once the code in torbutton_prefs_save() is executed more than
    once as well which may lead to unexpected and unintended behavior. We
    fix this thanks to a patch by a cypherpunk by disabling the Accept
    button after the first click.
---
 src/chrome/content/preferences.js |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/chrome/content/preferences.js b/src/chrome/content/preferences.js
index e1b2bf5..4c3c74d 100644
--- a/src/chrome/content/preferences.js
+++ b/src/chrome/content/preferences.js
@@ -189,6 +189,10 @@ function torbutton_prefs_init(doc) {
 }
 
 function torbutton_prefs_save(doc) {
+    // Disable the Accept button once the user clicked on it as clicking on
+    // our active Accept button more than once can lead to all sort of weird
+    // behavior. See bug 11763 for an example.
+    doc.documentElement.getButton("accept").disabled = true;
     torbutton_log(2, "called prefs_save()");
     var o_torprefs = torbutton_get_prefbranch('extensions.torbutton.');
     var o_customprefs = torbutton_get_prefbranch('extensions.torbutton.custom.');





More information about the tor-commits mailing list