Bug 226407
| Summary: | ServiceWorker matchAll and FetchEvent return incorrect client info | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | apple-rth |
| Component: | Service Workers | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | achristensen, cdumez, webkit-bug-importer, youennf |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=184294 | ||
apple-rth
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
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
apple-rth
It looks like Bug 184294 covers part of this bug, that FetchEvent from a Worker request has the same clientId property as a Window request.
The remaining part of the bug is that matchAll({ type: 'all' }) does not contain a Worker entry.
Radar WebKit Bug Importer
<rdar://problem/78893212>
youenn fablet
(In reply to apple-rth from comment #1)
> It looks like Bug 184294 covers part of this bug, that FetchEvent from a
> Worker request has the same clientId property as a Window request.
>
> The remaining part of the bug is that matchAll({ type: 'all' }) does not
> contain a Worker entry.
Right, we do not support worker clients. Currently, they are considered as part of the window client that created the workers.