New issue
Advanced search Search tips

Issue 832944 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

showNotification should be rejected with a TypeError when permission is revoked after renderer-side check

Project Member Reported by awdf@chromium.org, Apr 13 2018

Issue description

Right now we do reject the promise, but we should also be throwing a TypeError exception as per the spec:

https://notifications.spec.whatwg.org/#dom-serviceworkerregistration-shownotification

    Step 5.1: "If permission for notification’s origin is not "granted", then reject promise with a TypeError exception, and abort these steps."
 

Comment 2 by awdf@chromium.org, Apr 16 2018

Summary: showNotification should be rejected with a TypeError when permission is revoked after renderer-side check (was: showNotification should be rejected with a TypeError if permission is not granted)
Aha, yes you're right, that catches it in the standard case, thanks for pointing that out.

However there's an edge case where permission is revoked after that but before the notification is displayed.

Pre-mojo we simply return without sending a message back to the renderer: 

https://cs.chromium.org/chromium/src/content/browser/notifications/notification_message_filter.cc?l=132

(won't this mean the promise is never resolved? I'm a little confused by this)

Once they go through mojo by default, instead we currently just reject with no explanation:

https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/notifications/notification_manager.cc?l=159

Updated the bug title to make this explicit.

Labels: Hotlist-DesktopUIToolingRequired Hotlist-DesktopUIChecked
***Mass UI Triage***

Sign in to add a comment