[tbb-commits] [torbutton/master] Bug 9535: Fix hang on New Identity.

mikeperry at torproject.org mikeperry at torproject.org
Tue Aug 5 02:36:24 UTC 2014


commit e4c902b03302f99ce69c3f148573aa89122d169f
Author: Georg Koppen <gk at torproject.org>
Date:   Fri Jun 27 15:56:43 2014 +0000

    Bug 9535: Fix hang on New Identity.
    
    The related bug 10804 needs a different fix as this one applied there
    would stall the start-up for a short amount of time resulting in a bad
    user experience.
---
 src/chrome/content/torbutton.js |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index f682f05..4cd9c3d 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -1634,7 +1634,7 @@ function torbutton_do_new_identity() {
   }
 
   torbutton_log(3, "New Identity: Clearing LocalStorage");
-  
+
   try {
       Components.utils.import("resource:///modules/offlineAppCache.jsm");
       OfflineAppCacheHelper.clear();
@@ -1700,6 +1700,18 @@ function torbutton_do_new_identity() {
            getService(Ci.nsIPermissionManager);
   pm.removeAll();
 
+  // We spin the event queue until it is empty and we can be sure that sending
+  // NEWNYM is not leading to a deadlock (see bug 9531 comment 23 for an
+  // invstigation on why and when this may happen). This is surrounded by
+  // suppressing/unsuppressing user initiated events in a window's document to
+  // be sure that these events are not interfering with processing events being
+  // in the event queue.
+  var thread = Cc["@mozilla.org/thread-manager;1"].
+               getService(Ci.nsIThreadManager).currentThread;
+  m_tb_domWindowUtils.suppressEventHandling(true);
+  while (thread.processNextEvent(false)) {}
+  m_tb_domWindowUtils.suppressEventHandling(false);
+
   torbutton_log(3, "New Identity: Sending NEWNYM");
 
   // We only support TBB for newnym.





More information about the tbb-commits mailing list