[webkit-changes] [WebKit/WebKit] 1c96ac: WindowClient.matchAll resolves promise too early

youennf noreply at github.com
Thu Oct 31 07:20:30 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1c96accc39ab19374823137df0e4308f5788f94f
      https://github.com/WebKit/WebKit/commit/1c96accc39ab19374823137df0e4308f5788f94f
  Author: Youenn Fablet <youenn at apple.com>
  Date:   2024-10-31 (Thu, 31 Oct 2024)

  Changed paths:
    A LayoutTests/http/wpt/service-workers/service-worker-match-during-fetch-worker.js
    A LayoutTests/http/wpt/service-workers/service-worker-match-during-fetch.https-expected.txt
    A LayoutTests/http/wpt/service-workers/service-worker-match-during-fetch.https.html
    M Source/WebCore/workers/service/server/SWServer.cpp
    M Source/WebCore/workers/service/server/SWServer.h

  Log Message:
  -----------
  WindowClient.matchAll resolves promise too early
rdar://135742835
https://bugs.webkit.org/show_bug.cgi?id=279458

Reviewed by Ben Nham.

matchAll was returning service worker clients that were not yet active, although https://w3c.github.io/ServiceWorker/#dom-clients-matchall says to not expose them through matchAll.
This patch aligns with the spec and with Chrome.
After the patch, matchAll promise will continue resolving with the same timing but will contain fewer clients.
This also ensures that clients exposed via matchAll can be focused/navigated as they are backed by a Document object in a WebContent process.

We rename m_clientPendingMessagesById to m_clientsToBeCreatedById to make it clearer this map is about clients that are not yet created.
We should further improve our compliance by waiting for the document to become active (https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-execution-ready-flag).
This can be done in a follow-up. Ditto for ServiceWorkerClients.get.

* LayoutTests/http/wpt/service-workers/service-worker-match-during-fetch-worker.js: Added.
* LayoutTests/http/wpt/service-workers/service-worker-match-during-fetch.https-expected.txt: Added.
* LayoutTests/http/wpt/service-workers/service-worker-match-during-fetch.https.html: Added.
* Source/WebCore/workers/service/server/SWServer.cpp:
(WebCore::SWServer::matchAll):
(WebCore::SWServer::registerServiceWorkerClient):
(WebCore::SWServer::unregisterServiceWorkerClient):
(WebCore::SWServer::postMessageToServiceWorkerClient):
(WebCore::SWServer::releaseServiceWorkerClientPendingMessage):
* Source/WebCore/workers/service/server/SWServer.h:

Canonical link: https://commits.webkit.org/285953@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list