Bug 1078665: Ignore exceptions thrown out of getBrowserForDocument. r=zombie
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 06 Oct 2014 13:56:58 -0700
changeset 209068 5578b160f514fcbfb782c980fee483fa6e410c95
parent 209067 421486270287878ecc350a94d9ff4d29b6798fea
child 209069 b1b103778f93ebea31c13d725232775d48c76418
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerszombie
bugs1078665
milestone35.0a1
Bug 1078665: Ignore exceptions thrown out of getBrowserForDocument. r=zombie
addon-sdk/source/lib/sdk/panel/window.js
--- a/addon-sdk/source/lib/sdk/panel/window.js
+++ b/addon-sdk/source/lib/sdk/panel/window.js
@@ -30,20 +30,24 @@ function getWindow(anchor) {
     for (let enumWindow of windows) {
       // Check if the anchor is in this browser window.
       if (enumWindow == anchorWindow) {
         window = anchorWindow;
         break;
       }
 
       // Check if the anchor is in a browser tab in this browser window.
-      let browser = enumWindow.gBrowser.getBrowserForDocument(anchorDocument);
-      if (browser) {
-        window = enumWindow;
-        break;
+      try {
+        let browser = enumWindow.gBrowser.getBrowserForDocument(anchorDocument);
+        if (browser) {
+          window = enumWindow;
+          break;
+        }
+      }
+      catch (e) {
       }
 
       // Look in other subdocuments (sidebar, etc.)?
     }
   }
 
   // If we didn't find the anchor's window (or we have no anchor),
   // return the most recent browser window.