RESOLVED FIXED Bug 25212
Support constructing nested workers.
https://bugs.webkit.org/show_bug.cgi?id=25212
Summary Support constructing nested workers.
Jian Li
Reported 2009-04-15 10:47:22 PDT
This is to make nested worker constructor work in JS bindings.
Attachments
Proposed Patch (7.19 KB, patch)
2009-04-15 10:49 PDT, Jian Li
no flags
Jian Li
Comment 1 2009-04-15 10:49:33 PDT
Created attachment 29502 [details] Proposed Patch
Alexey Proskuryakov
Comment 2 2009-04-16 13:03:33 PDT
We can't enable constructing nested workers in default build when they don't work nearly correctly. What changes does this depend upon?
Jian Li
Comment 3 2009-04-16 13:17:36 PDT
(In reply to comment #2) > We can't enable constructing nested workers in default build when they don't > work nearly correctly. What changes does this depend upon? > This change depends on the script loading work and termination work. I am currently working on the termination issue. I can have this change check in at last.
Alexey Proskuryakov
Comment 4 2010-06-08 13:15:10 PDT
*** Bug 40288 has been marked as a duplicate of this bug. ***
Jesper van den Ende
Comment 5 2021-06-02 01:02:58 PDT
Are there any plans for this?
Peter B
Comment 6 2022-09-09 10:55:57 PDT
This is extremely useful to support parallelism
Chris Dumez
Comment 7 2022-09-17 19:39:22 PDT
Radar WebKit Bug Importer
Comment 8 2022-09-17 19:41:25 PDT
Peter B
Comment 9 2022-09-18 01:30:10 PDT
(In reply to Chris Dumez from comment #7) > https://commits.webkit.org/254597@main Chris! My hero! Do you know approximately when this commit will see the light of day?
Lanny Heidbreder
Comment 10 2022-11-20 14:29:17 PST
This appears to have already made it into Safari Technology Preview, at least.
frederik.bertling
Comment 11 2023-03-26 12:22:55 PDT
When trying to use sqlite wasm on safari tech preview, "new Worker(new URL("sqlite3-opfs-async-proxy.js", import.meta.url));" inside a worker successfully creates a new worker, but it never starts.
Jesper van den Ende
Comment 12 2023-03-26 14:52:06 PDT
Fwiw I managed to work around this challenge using the following polyfill: https://github.com/dmihal/Subworkers I have created a fork that adds support for module imports, i.e: new Worker("file.js", { type: "module" }); https://github.com/jespertheend/Subworkers
frederik.bertling
Comment 13 2023-03-27 02:27:51 PDT
Thanks for the polyfill, I tried it, but in subworkers.js the following message function is called: self.postMessage({ _subworker: true, cmd: 'newWorker', id: this.id, path: absPath }); but never receiver anywhere. I guess, it should be received here: var messageRecieved = function(event){ if (event.data._subworker){ cmds[event.data.cmd](event); } };
Jesper van den Ende
Comment 14 2023-03-27 02:41:48 PDT
When I first used the polyfill I wasn't working for me either. I believe it was because I was also using this module workers polyfill: https://gist.github.com/developit/220246bc99044af74a6680ce13284f59 and they were interfering with each other. I had to play around with the order of imports for a bit in order to fix it. Though I'm not sure if you're running into the same issue here.
frederik.bertling
Comment 15 2023-03-27 03:59:50 PDT
I'm not sure why, but I have to load the subworkers script in the head part of my index.html to work. It has to be there in the tests as well. Anyway thanks :-).
Note You need to log in before you can comment on or make changes to this bug.