gecko-dev/dom/notification
Andrew Sutherland 40b6bf22b1 Bug 1931391 - Simplify ServiceWorkerRegistration.showNotification steps. r=saschanaz
Changes in Bug 1131324 made it possible for
ServiceWorkerRegistration.showNotification to be invoked from Dedicated
and Shared Workers where previously it could only be invoked from
Service Workers.  The fuzzer discovered this new possibility for which
we did not have test coverage for and revealed that the code would call
a WorkerPrivate method that required the global be a ServiceWorker which
causes a diagnostic assert or a release assert depending on the build
type.

It turns out the check in question was enforcing a constraint not
required by the spec that only the active worker associated with the
registration can cause a notification to be shown associated with the
registration.  All that is required is that the registration have some
active worker.

When addressing this it also turned out that since the initial
implementation of the notifications API there has been an unneccessary
check that the principal associated with the global is same-origin to
the scope.  This check additionally required a sync runnable to be
dispatched to the main thread.  This check was unnecessary and has been
removed.  All ServiceWorkerRegistrations exposed to a global are
inherently same-origin to the global and the check as implemented was
not aware of the effective storage principal and was just using the
(node) principal.  (And any checks concerned about dealing with a rogue
content process would need to take place in the parent process, not the
potentially rogue content process.)

For testing, the recently updated test
`test_notification_serviceworker_show.html` has been forked to provide
dedicated worker coverage.  If the test is run without the fix in this
patch applied, the expected assertion trips.

Differential Revision: https://phabricator.services.mozilla.com/D229561
2024-11-20 16:05:33 +00:00
..
test Bug 1931391 - Simplify ServiceWorkerRegistration.showNotification steps. r=saschanaz 2024-11-20 16:05:33 +00:00
components.conf
IPCUtils.h Bug 1928702 - Part 2: Create PNotification via PBackground r=asuth 2024-11-11 20:34:11 +00:00
MemoryNotificationDB.sys.mjs Bug 1889930: Remove source code corresponding to deprecated notification store.r=saschanaz 2024-07-22 16:14:46 +00:00
metrics.yaml Bug 1914203 - Add telemetry for notification permission r=asuth,bvandersloot 2024-09-20 14:02:28 +00:00
moz.build Bug 1930676 - Part 3: Add skeleton PNotification functions r=asuth 2024-11-15 00:35:41 +00:00
Notification.cpp Bug 1931391 - Simplify ServiceWorkerRegistration.showNotification steps. r=saschanaz 2024-11-20 16:05:33 +00:00
Notification.h Bug 1931497 - Part 6: Adjust notification lifetime documentation comment r=asuth 2024-11-19 15:32:19 +00:00
NotificationChild.cpp Bug 1931497 - Part 2: Implement tab focusing for workers on RecvNotifyClick r=asuth 2024-11-19 15:32:18 +00:00
NotificationChild.h Bug 1930676 - Part 7: Implement NotificationChild::FrozenCallback r=asuth 2024-11-15 00:35:43 +00:00
NotificationDB.sys.mjs Bug 1889930: Remove source code corresponding to deprecated notification store.r=saschanaz 2024-07-22 16:14:46 +00:00
NotificationEvent.cpp
NotificationEvent.h
NotificationParent.cpp Bug 1931497 - Part 1: Close NotificationParent on RecvClose r=asuth 2024-11-19 15:32:17 +00:00
NotificationParent.h Bug 1930676 - Part 4: Implement RecvClose r=asuth 2024-11-15 00:35:42 +00:00
NotificationStorage.sys.mjs
NotificationUtils.cpp Bug 1931497 - Part 7: Remove parent process ping in PContent and PushService r=asuth 2024-11-19 15:32:19 +00:00
NotificationUtils.h Bug 1928702 - Part 6: Move NotificationObserver functions to NotificationUtils r=asuth 2024-11-11 20:34:13 +00:00
PNotification.ipdl Bug 1930676 - Part 3: Add skeleton PNotification functions r=asuth 2024-11-15 00:35:41 +00:00