RESOLVED FIXED 255402
Web Inspector doesn't show nested workers
https://bugs.webkit.org/show_bug.cgi?id=255402
Summary Web Inspector doesn't show nested workers
Thomas Steiner
Reported 2023-04-13 09:33:04 PDT
Created attachment 465890 [details] Safari Console A Web Worker can spawn other Web Workers; these are sometimes referred to as subworkers or sub-workers. Safari does not seem to request the subworker file and only spawns a Worker from the main thread. Note the screenshots: chrome.png: The expected behavior in Chrome. firefox.png: The expected behavior in Firefox. safari-console.png: Safari only logs the message from worker.js. safari-network.png: Safari does not seem to make the request for subworker.js. safari-sources.png: Safari does not show subworker.js in its sources. Minimal repro: https://safari-subworker.glitch.me/
Attachments
Safari Console (512.54 KB, image/png)
2023-04-13 09:33 PDT, Thomas Steiner
no flags
Safari Network (601.98 KB, image/png)
2023-04-13 09:33 PDT, Thomas Steiner
no flags
Safari Sources (652.18 KB, image/png)
2023-04-13 09:34 PDT, Thomas Steiner
no flags
Chrome (321.44 KB, image/png)
2023-04-13 09:34 PDT, Thomas Steiner
no flags
Firefox (689.33 KB, image/png)
2023-04-13 09:34 PDT, Thomas Steiner
no flags
Thomas Steiner
Comment 1 2023-04-13 09:33:41 PDT
Created attachment 465891 [details] Safari Network
Thomas Steiner
Comment 2 2023-04-13 09:34:02 PDT
Created attachment 465892 [details] Safari Sources
Thomas Steiner
Comment 3 2023-04-13 09:34:19 PDT
Thomas Steiner
Comment 4 2023-04-13 09:34:33 PDT
Thomas Steiner
Comment 5 2023-04-13 09:59:47 PDT
This does _not_ work in: - Safari Tech Preview Release 167 (Safari 16.4, WebKit 18616.1.8.2) - Safari Version 16.5 (18615.2.5.11.2) (I'm on Ventura 13.4 Beta (22F5037d))
Alexey Proskuryakov
Comment 6 2023-04-13 14:59:58 PDT
Nested workers were implemented in bug 22723, quite surprising that this isn't working.
Karl Dubost
Comment 7 2023-04-13 16:08:18 PDT
Karl Dubost
Comment 8 2023-04-13 16:15:09 PDT
I even wonder if it's in fact just a Web Inspector issue. a bit like Bug 252685
Dasa Paddock
Comment 9 2023-04-13 16:20:33 PDT
That sounds right. I see that https://safari-subworker.glitch.me/subworker.js does get loaded when I test https://safari-subworker.glitch.me and have Charles Proxy running.
Karl Dubost
Comment 10 2023-04-13 16:33:33 PDT
I renamed the bug.
Sam Sneddon [:gsnedders]
Comment 11 2023-04-14 04:23:45 PDT
On Safari 16.4, macOS Ventura 13.3.1 (22E261), MacBook Pro 14" 2023 (Mac14,9), I am seeing the "from subworker" console messages, though I can't see anything in the Sources or Network tabs. Given I can see them on relatively fast hardware, this makes me wonder if there's some race happening somewhere?
Thomas Steiner
Comment 12 2023-04-14 04:52:04 PDT
I have added a bunch of postMessage() calls to the demo at https://safari-subworker.glitch.me/, so we can see communication happening in all directions. I can indeed confirm that the worker.js postMessage() call arrives in subworker.js, since its response is logged in worker.js. ## Here're the logs from Chrome: Hello from main thread worker.js:1 Hello from worker.js worker.js:4 Message received in worker.js: From main thread to worker.js script.js:6 Message received in main thread: From worker.js to main thread after message from main thread subworker.js:1 Hello from subworker.js subworker.js:4 Message received in subworker.js: From worker.js to subworker.js worker.js:11 Message received in worker.js: From subworker to worker.js script.js:6 Message received in main thread: From worker.js to main thread after message from subworker.js ## Here're the logs from Firefox: Hello from main thread script.js:1:9 Hello from worker.js worker.js:1:9 Message received in worker.js: From main thread to worker.js worker.js:4:11 Message received in main thread: From worker.js to main thread after message from main thread script.js:6:11 Hello from subworker.js subworker.js:1:9 Message received in subworker.js: From worker.js to subworker.js subworker.js:4:11 Message received in worker.js: From subworker to worker.js worker.js:11:11 Message received in main thread: From worker.js to main thread after message from subworker.js script.js:6:11 ​ ## Here're the logs from Safari (Safari Tech Preview and Stable agree): [Log] Hello from main thread (script.js, line 1) [Log] Hello from worker.js (worker.js, line 1) [Log] Message received in worker.js: – "From main thread to worker.js" (worker.js, line 4) [Log] Message received in main thread: – "From worker.js to main thread after message from main thread" (script.js, line 6) [Log] Message received in worker.js: – "From subworker to worker.js" (worker.js, line 11) [Log] Message received in main thread: – "From worker.js to main thread after message from subworker.js" (script.js, line 6) This means it's indeed a complete Web Inspector blindness to anything happening in subworker.js. Also, it doesn't yet explain why SQLite Wasm backed by the OPFS (https://sqlite-wasm-opfs.glitch.me/) isn't working on Safari yet, but that's a different story then (maybe). I'll keep investigating. The subworkers theory was a good lead, though…
Thomas Steiner
Comment 13 2023-04-14 09:02:50 PDT
Found the root cause of the SQLite Wasm problem: `navigator.storage.getDirectory()` fails in subworker with an `InvalidStateError`: https://bugs.webkit.org/show_bug.cgi?id=255458.
Radar WebKit Bug Importer
Comment 14 2023-04-20 09:34:19 PDT
Devin Rousso
Comment 15 2023-05-08 17:40:50 PDT
Alexey Proskuryakov
Comment 16 2023-05-24 09:29:45 PDT
*** Bug 255637 has been marked as a duplicate of this bug. ***
Alexey Proskuryakov
Comment 17 2024-04-09 11:49:47 PDT
*** Bug 272382 has been marked as a duplicate of this bug. ***
EWS
Comment 18 2024-06-06 22:47:53 PDT
Committed 279793@main (b5d3f9b6724b): <https://commits.webkit.org/279793@main> Reviewed commits have been landed. Closing PR #13614 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.