diff --git a/lib/notifications.js b/lib/notifications.js index 349afd7..e203237 100644 --- a/lib/notifications.js +++ b/lib/notifications.js @@ -23,10 +23,17 @@ exports.notify = function({url, errorStack, messageId}, {lists, notificationPref var tab, tabBrowser; if (browser){ window = tabUtils.getOwnerWindow(browser); + if (!window){ + return; + } tab = tabUtils.getTabForBrowser(browser); + if (!tab){ + // page ist displayed in preview + return; + } tabBrowser = tabUtils.getTabBrowser(window); } - else if (window){ + else if (window){ tab = tabUtils.getTabForContentWindow(window); tabBrowser = tabUtils.getTabBrowserForTab(tab); browser = tabUtils.getBrowserForTab(tab);