Fixed Fix JavaScript error "ReferenceError: Notification is not defined"

Steffen

Well-known member
Affected version
2.1.0
XenForo uses "Notification.permission" without checking whether "Notification" is defined. We log this error for a few Firefox users. It seems like they have somehow disabled notifications but pass all the other checks in "XF.Push.isSupported".

Diff:
--- a/js/xf/core.js
+++ b/js/xf/core.js
@@ -6728,6 +6728,7 @@ if (window.jQuery === undefined) jQuery = $ = {};
                 && XF.getApp() === 'public'
                 && 'serviceWorker' in navigator
                 && 'PushManager' in window
+                && 'Notification' in window
             );
         }
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.1).

Change log:
When testing for push support, check we have access to the Notification API also.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Back
Top Bottom