Bug 1078665: Ignore exceptions thrown out of getBrowserForDocument. r=zombie
--- 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.