From 9c7e842f4b6ea81e64ede7ec5c188d8030675314 Mon Sep 17 00:00:00 2001 From: kkapsner Date: Tue, 31 Jan 2017 20:03:48 +0100 Subject: [PATCH] Prevented error message when notifications where triggered on preview, which is not possible. --- lib/notifications.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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);