[OpenNMS/opennms] e16a33: NMS-20200: Fix browser notifications in Firefox an...

Marshall Massengill via opennms-cvs <[email protected]>
Newsgroups gmane.network.opennms.cvs
Message-ID <OpenNMS/opennms/push/refs/heads/mm/NMS-20200-smoke/[email protected]>
  Branch: refs/heads/mm/NMS-20200-smoke
  Home:   https://github.com/OpenNMS/opennms
  Commit: e16a33c4fb08ca7bda20ef06b35690e81204fc46
      https://github.com/OpenNMS/opennms/commit/e16a33c4fb08ca7bda20ef06b35690e81204fc46
  Author: Marshall Massengill <[email protected]>
  Date:   2026-08-10 (Mon, 10 Aug 2026)

  Changed paths:
    M core/web-assets/src/main/assets/js/apps/notifications/index.js
    M docs/modules/operation/pages/deep-dive/notifications/introduction.adoc
    M docs/modules/operation/pages/quick-start/notifications.adoc
    M opennms-base-assembly/src/main/filtered/etc/notificationCommands.xml
    M opennms-services/src/main/java/org/opennms/netmgt/notifd/BrowserNotificationStrategy.java
    M opennms-services/src/main/java/org/opennms/netmgt/notifd/browser/BrowserNotificationMessage.java
    M opennms-webapp/src/main/java/org/opennms/web/notification/NotificationStreamServlet.java
    M opennms-webapp/src/main/webapp/WEB-INF/applicationContext-spring-security.xml
    M opennms-webapp/src/main/webapp/WEB-INF/web.xml
    M opennms-webapp/src/main/webapp/account/selfService/index.jsp
    A opennms-webapp/src/main/webapp/includes/notification-optin.jsp
    A opennms-webapp/src/main/webapp/notification-sw.js
    M opennms-webapp/src/main/webapp/notification/index.jsp
    M smoke-test/src/main/resources/opennms-overlay/etc/notificationCommands.xml
    M smoke-test/src/test/java/org/opennms/smoketest/NotificationsPageIT.java
    M smoke-test/src/test/java/org/opennms/smoketest/UserIT.java

  Log Message:
  -----------
  NMS-20200: Fix browser notifications in Firefox and on Chrome for Android

The browser notification command has been broken in Firefox since Firefox 72 and
has never worked on Chrome for Android. Both failures were silent.

Firefox rejects Notification.requestPermission() without transient user
activation, and the client called it from a jQuery ready handler on page load, so
a user who had not already granted permission had no way to grant it. The prompt
now hangs off an explicit opt-in control, rendered by
includes/notification-optin.jsp on the Notifications and account self-service
pages, which also reports the blocked, unsupported and insecure-origin cases.

Chrome for Android throws from the page-scoped Notification constructor and
requires ServiceWorkerRegistration.showNotification(). notification-sw.js is
served from the webapp root so its scope covers the context; it registers no
fetch handler and so never intercepts or caches application requests. The
page-scoped constructor is kept as a fallback for browsers without service worker
support.

Also in this path:

* NotificationStreamServlet built its payload with JSONObject.append(), wrapping
  every value in an array. It rendered only because JavaScript coerces a
  single-element array to its string.
* Clicking a notification did nothing. The browser command now passes noticeid,
  resolved from the notification parameter map, and a click opens the notice.
  Notifd passes 0 for test triggers and -1 for resolution notices, neither of
  which has a notice page, so those fall back to the outstanding notice list.
* Reconnect was a flat 1s retry from every open tab for the duration of an
  OpenNMS restart, and now backs off with jitter to 30s.
* Dropped an unused net.sf.json import.

Two constructs are avoided deliberately in the client: .find() on a jQuery object
and the Promise global. The corejs transform rewrites both, into an
Array.prototype.find helper and a broken Promise reference, each of which throws
at runtime while building and linting cleanly.

worker-src 'self' is named explicitly in the CSP. It was already permitted
through the child-src/script-src fallback chain, but relying on that risks a
browser falling back to default-src 'none'.

Notification APIs are secure-context only, so none of this functions over plain
HTTP regardless of the above.



To unsubscribe from these emails, change your notification settings at https://github.com/OpenNMS/opennms/settings/notifications


_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/wiki/index.php?page=MailingListFaq
opennms-cvs mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.