New issue
Advanced search Search tips

Issue 862687 link

Starred by 2 users

Issue metadata

Status: Unconfirmed
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Service worker's getNotification(filter) not returning notification in order (as in specs)

Project Member Reported by sebisebi@google.com, Jul 11

Issue description

Chrome Version: 67.0.3396.99 (Official Build) (64-bit)
Chrome OS Version: Version 67.0.3396.99 (Official Build) (64-bit)
Chrome OS Platform: Google Pixelbook

Steps To Reproduce (in the context of YouTube push notifications)
(1) Go to go/feeds-debug
(2) Click "Add new Pending Notification"
(3) Click "Send"
(4) Repeat the process until 4 notifications are kept in the service worker
(5) Go to www.youtube.com and open the service worker's console.
(6) Run the following code:
    self.registration.getNotifications().then((notifications) => {
        console.log(notifications);
    });
(7) Observe the notifications order.
(8) Send another notification with go/feeds-debug
(9) Go to the service worker's console and list the notifications again.
(10) Observe that the last notification sent is not the first or the last in the notifications array.

This process describes a way to reproduce the result using YouTube notifications. However it should behave the same way for vanilla push notifications.

Expected Result: Notifications should be added in their creation order as in specs: https://notifications.spec.whatwg.org/#dom-serviceworkerregistration-getnotifications

Actual Result: The last created notification is neither the first one nor the last one in the array, so clearly not in the creation order (either desc or ascending).

How frequently does this problem reproduce? (Always, sometimes, hard to
reproduce?)

It does not happen 100%. It may take 2-3 tries to arrive at the actual result.

What is the impact to the user, and is there a workaround? If so, what is
it?

If the order is not as in specs we may end up closing wrong notifications (we cap the number of notifications shown to the user programmatically).

Console log output: https://drive.google.com/file/d/1riqHWnPTvbRXCOkHU0E9RhQFiHe7N2M5/view?usp=sharing

Please look at the end of the log since it took some tries to reproduce the result.


 
Components: Platform>Apps>ServiceWorker

Sign in to add a comment