mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
40b6bf22b1
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 |
||
---|---|---|
.. | ||
test | ||
components.conf | ||
IPCUtils.h | ||
MemoryNotificationDB.sys.mjs | ||
metrics.yaml | ||
moz.build | ||
Notification.cpp | ||
Notification.h | ||
NotificationChild.cpp | ||
NotificationChild.h | ||
NotificationDB.sys.mjs | ||
NotificationEvent.cpp | ||
NotificationEvent.h | ||
NotificationParent.cpp | ||
NotificationParent.h | ||
NotificationStorage.sys.mjs | ||
NotificationUtils.cpp | ||
NotificationUtils.h | ||
PNotification.ipdl |