[Webkit-unassigned] [Bug 226407] New: ServiceWorker matchAll and FetchEvent return incorrect client info

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 28 17:25:55 PDT 2021


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

            Bug ID: 226407
           Summary: ServiceWorker matchAll and FetchEvent return incorrect
                    client info
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Service Workers
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: apple-rth at hashimoto.us

The page at https://rhashimoto.github.io/serviceworker-clientid/src/
logs FetchEvent.clientId and clients.matchAll({ type: 'all' }) for requests made from both a Window and a Worker. The expectation is that the clientId should be different and matchAll({ type: 'all' }) should have entries for both the Window and Worker when both are instantiated.

Instead, WebKit only seems to know about the Window. Here is the copied text from the above URL:

5:19:35 PM (sw): Hello from Service Worker!
5:19:35 PM (sw): 46-61 /serviceworker-clientid/src/from-window
[
  {
    "frameType": "top-level",
    "id": "46-61",
    "type": "window",
    "url": "https://rhashimoto.github.io/serviceworker-clientid/src/"
  }
]
5:19:35 PM (sw): 46-61 /serviceworker-clientid/src/from-worker
[
  {
    "frameType": "top-level",
    "id": "46-61",
    "type": "window",
    "url": "https://rhashimoto.github.io/serviceworker-clientid/src/"
  }
]

Chrome has a similar problem, and I have also filed a bug there (https://bugs.chromium.org/p/chromium/issues/detail?id=1214362&q=&can=4). Firefox works correctly; here is the Firefox output:

5:21:29 PM (sw): Hello from Service Worker!
5:21:29 PM (sw): 36caec94-de12-d74a-9fde-4f18b5749b63 /favicon.ico
[
  {
    "frameType": "top-level",
    "id": "36caec94-de12-d74a-9fde-4f18b5749b63",
    "type": "window",
    "url": "https://rhashimoto.github.io/serviceworker-clientid/src/"
  }
]
5:21:29 PM (sw): 36caec94-de12-d74a-9fde-4f18b5749b63 /serviceworker-clientid/src/from-window
[
  {
    "frameType": "top-level",
    "id": "36caec94-de12-d74a-9fde-4f18b5749b63",
    "type": "window",
    "url": "https://rhashimoto.github.io/serviceworker-clientid/src/"
  }
]
5:21:29 PM (sw): 36caec94-de12-d74a-9fde-4f18b5749b63 /serviceworker-clientid/src/worker.js
[
  {
    "frameType": "top-level",
    "id": "36caec94-de12-d74a-9fde-4f18b5749b63",
    "type": "window",
    "url": "https://rhashimoto.github.io/serviceworker-clientid/src/"
  }
]
5:21:29 PM (sw): 74a1067e-1bd8-b34f-bf8b-e6de36cfa22e /serviceworker-clientid/src/from-worker
[
  {
    "frameType": "top-level",
    "id": "36caec94-de12-d74a-9fde-4f18b5749b63",
    "type": "window",
    "url": "https://rhashimoto.github.io/serviceworker-clientid/src/"
  },
  {
    "frameType": "none",
    "id": "74a1067e-1bd8-b34f-bf8b-e6de36cfa22e",
    "type": "worker",
    "url": "https://rhashimoto.github.io/serviceworker-clientid/src/worker.js"
  }
]

Note that the Firefox "from-window" request and "from-worker" request have different clientId, and after the Worker has been created matchAll({ type: 'all' }) returns information for the Worker as well as the Window.

The code for the test page can be viewed at:
https://github.com/rhashimoto/serviceworker-clientid/tree/master/src

-- 
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/20210529/65250ada/attachment-0001.htm>


More information about the webkit-unassigned mailing list