[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #9531 [TorBrowserButton]: More Torbutton hangs on New Identity control port access
#9531: More Torbutton hangs on New Identity control port access
------------------------------+---------------------------------------------
Reporter: mikeperry | Owner: mikeperry
Type: defect | Status: needs_review
Priority: major | Milestone:
Component: TorBrowserButton | Version:
Keywords: tbb-usability | Parent:
Points: | Actualpoints:
------------------------------+---------------------------------------------
Changes (by cypherpunks):
* status: new => needs_review
Comment:
This code helps to avoid conditions that leads to hang if no connection
able to create.
{{{
--- torbutton.js.original
+++ torbutton.js
@@ -1385,6 +1385,20 @@
}
}
+function torbutton_process_even_queue() {
+ // Get the current thread.
+ var thread = Components.classes["@mozilla.org/thread-manager;1"].
+
getService(Components.interfaces.nsIThreadManager).currentThread;
+/*
+Warning: Calling nsIThread.processNextEvent allows network
+and UI events to run which can modify data structures that
+your code isn't expecting to be modified during a synchronous
+method call. This can cause random crashes and other bugs that
+may be hard to find and fix. Consider use asynchronous callbacks instead.
+*/
+ while (thread.processNextEvent(false)) {}
+}
+
/* The "New Identity" implementation does the following:
* 1. Disables Javascript and plugins on all tabs
* 2. Clears state:
@@ -1580,7 +1594,8 @@
var prefService = Components.classes["@mozilla.org/preferences-
service;1"]
.getService(Components.interfaces.nsIPrefService);
prefService.savePrefFile(null);
-
+
+ torbutton_process_even_queue();
torbutton_log(3, "New Identity: Sending NEWNYM");
// We only support TBB for newnym.
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9531#comment:10>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs