[tor-commits] [torbutton/master] Try to handle some weird exceptions better.

mikeperry at torproject.org mikeperry at torproject.org
Thu Feb 14 06:09:26 UTC 2013


commit 4e30fa2fbf45d7936078225512baeab30a6dad00
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Sun Feb 10 16:22:51 2013 -0800

    Try to handle some weird exceptions better.
---
 src/chrome/content/torbutton.js |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 946c613..c3320f6 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -1694,8 +1694,15 @@ function torbutton_disable_window_js(win) {
         if (b && b.docShell) {
             torbutton_disable_browser_js(b);
 
-            // kill meta-refresh and existing page loading 
-            b.webNavigation.stop(b.webNavigation.STOP_ALL);
+            // kill meta-refresh and existing page loading
+            // XXX: Despite having JUST checked b.docShell, it can
+            // actually end up NULL here in some cases?
+            try {
+              if (b.docShell && b.webNavigation)
+                b.webNavigation.stop(b.webNavigation.STOP_ALL);
+            } catch(e) {
+              torbutton_log(4, "DocShell error: "+e);
+            }
         }
     }
 }
@@ -1722,7 +1729,11 @@ function torbutton_reload_homepage() {
                        Components.interfaces.nsIPrefLocalizedString).data;
 
     torbutton_log(3, "Reloading homepage: "+homepage);
-    gBrowser.loadURI(homepage, null, null);
+    try {
+      gBrowser.loadURI(homepage, null, null);
+    } catch(e) {
+      torbutton_log(4, "Failure reloading homepage "+homepage+": "+e);
+    }
 }
 
 // Bug 1506 P0: Toggle, kill it.





More information about the tor-commits mailing list