[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torbutton/master] Bug #10800: Prevent exception in New Identity



commit 32621b90f7322aaee5806e5600a23380241044d8
Author: Mike Perry <mikeperry-git@xxxxxxxxxxxxxx>
Date:   Mon Feb 3 12:16:39 2014 -0800

    Bug #10800: Prevent exception in New Identity
    
    Exceptions can apparently happen in rare, unknown cases while clearing
    search/find boxes.
---
 src/chrome/content/torbutton.js |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 3b51c86..1f8e82c 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -1486,14 +1486,24 @@ function torbutton_do_new_identity() {
 
   torbutton_close_on_toggle(true, true);
 
-  var searchBar = window.document.getElementById("searchbar");
-  if (searchBar)
-      searchBar.textbox.reset();
-
-  if (gFindBarInitialized) {
-      var findbox = gFindBar.getElement("findbar-textbox");
-      findbox.reset();
-      gFindBar.close();
+  // Bug #10800: Trying to clear search/find can cause exceptions
+  // in unknown cases. Just log for now.
+  try {
+    var searchBar = window.document.getElementById("searchbar");
+    if (searchBar)
+        searchBar.textbox.reset();
+  } catch(e) {
+    torbutton_log(5, "New Identity: Exception on clearing search box: "+e);
+  }
+
+  try {
+    if (gFindBarInitialized) {
+        var findbox = gFindBar.getElement("findbar-textbox");
+        findbox.reset();
+        gFindBar.close();
+    }
+  } catch(e) {
+    torbutton_log(5, "New Identity: Exception on clearing find bar: "+e);
   }
 
   torbutton_log(3, "New Identity: Emitting Private Browsing Session clear event");



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits