Skip to content

Permission check happens first on both Gecko and Blink for showNotification #207

@saschanaz

Description

@saschanaz

What is the issue with the Notifications API Standard?

The current spec in https://notifications.spec.whatwg.org/#dom-serviceworkerregistration-shownotification creates a notification in step 5 and do the permission check in step 6 where checks for options bag happen. But in reality:

  1. Gecko checks permission first: https://searchfox.org/mozilla-central/rev/b94e479d0b79b157029379832d05229df646e134/dom/notification/Notification.cpp#2210-2234
  2. Blink checks permission first too: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/notifications/service_worker_registration_notifications.cc;l=61-74;drc=08bac9d4c75f023df86a07be1986884f760dab94
  3. WebKit too: https://searchfox.org/wubkat/rev/25be8d6371093c7bc40042867d31fcb62659346c/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp#300-311 (although there's no renotify/vibrate support there to actually make a difference)

This does not change any visible exception order as both throw TypeError, but maybe worth changing the spec to reflect reality?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions