[Webkit-unassigned] [Bug 252544] If a Home Screen Web App is backgrounded and tries to focus() a ServiceWorkerWindowClient in a notificationclick handler, the focus() promise rejects

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 7 19:08:01 PST 2023


https://bugs.webkit.org/show_bug.cgi?id=252544

--- Comment #11 from Brady Eidson <beidson at apple.com> ---
Yup, this will run into the exact same issue as mentioned above.

(In reply to lehu from comment #10)
> 
> async function openPushNotification(event) {
>   console.log("[Service Worker] Notification click Received.", event);
> 
>   event.notification.close();
>   event.waitUntil((async () => {
>     const allClients = await clients.matchAll({ type: 'window' });
> 
>     for (const client of allClients) {
>       // if (!client.focused) {
>       //   await client.focus().catch(e => { console.log(e) });
>       // }
>       client.postMessage(event.notification.data);
>       return;
>     }
> ...

Because of the weird mismatch in Networking's idea of the truth with Web Content's idea of the truth, the matchAll() call returns a client...  But that client doesn't *ACTUALLY* exist yet. It is "just about to exist"

So it's a different way of triggering the exact same issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230308/b8dd56f9/attachment.htm>


More information about the webkit-unassigned mailing list