WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
226407
ServiceWorker matchAll and FetchEvent return incorrect client info
https://bugs.webkit.org/show_bug.cgi?id=226407
Summary
ServiceWorker matchAll and FetchEvent return incorrect client info
apple-rth
Reported
2021-05-28 17:25:55 PDT
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
Comment 1
2021-05-28 19:35:32 PDT
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
Comment 2
2021-06-04 17:26:19 PDT
<
rdar://problem/78893212
>
youenn fablet
Comment 3
2021-06-07 02:19:48 PDT
(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.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug