Bug 22723 - Implement nested Workers
Summary: Implement nested Workers
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P4 Enhancement
Assignee: Chris Dumez
Keywords: BrowserCompat, InRadar
: 24016 25152 158605 245182 (view as bug list)
Depends on: 25212 25215 25255 25270 25273 255458
  Show dependency treegraph
Reported: 2008-12-07 03:27 PST by Alexey Proskuryakov
Modified: 2023-04-14 15:51 PDT (History)
20 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2008-12-07 03:27:30 PST
It should be possible to create new Workers from Workers.

The main low-level functionality that is still missing is an ability to load resources from Workers, same as in XMLhttpRequest and importScripts().
Comment 1 Alexey Proskuryakov 2008-12-07 03:59:22 PST
Comment 2 Alexey Proskuryakov 2009-04-14 02:25:32 PDT
*** Bug 25152 has been marked as a duplicate of this bug. ***
Comment 3 Alexey Proskuryakov 2009-05-07 03:30:22 PDT
Assigning to Jian Li because of all the work done in blocking bugs.
Comment 4 Alexey Proskuryakov 2009-05-07 03:34:38 PDT
Sorry for asking this question relatively late in the game, but what are the use cases for nested workers? Do they warrant increased complexity in the existing and future (e.g. Web Inspector) code at this point?

Creating workers from workers doesn't seem to be a dangerous feature, and it seems potentially useful, but it is not clear to me if it's useful enough to add yet, without feedback from web application authors who use workers.
Comment 5 Jian Li 2009-05-07 13:18:58 PDT
I think they're quite useful in developing a large web application. For example, an online email application can start a worker to fetch emails and store them in the local storage on the background. This worker can start a couple nested workers such that some actions can be done in parallel, like using XHR to send emails and receive emails. With nested worker support, it will become easier to write such big applications.

If you need more information on this. Please ping me.
Comment 6 Dmitry Titov 2009-06-24 14:05:18 PDT
*** Bug 24016 has been marked as a duplicate of this bug. ***
Comment 7 John Abd-El-Malek 2009-07-07 15:24:29 PDT
Note: Firefox 3.5 has launched with support for this.  Over lunch today, I chatted with Maciej about this and he supported the view that we should be at feature parity to avoid developer confusion.
Comment 8 Li Yin 2012-05-13 05:12:21 PDT
Does chromium have a plan to do that?
Where can find detailed information?
Thanks in advance.
Comment 9 Dmitry Titov 2012-05-14 13:52:22 PDT
I don't know about current plans but usually it was a question if there is enough real world need to justify the work... The work can be non-trivial, some part include loading refactoring (currently delegated to the parent, assuming it's a Page) and perhaps things like DevTools integration... In the past, the folks involved found more pressing needs to work on, that's it.

Theoretically, it's a nice feature and it's in the spec :-)
Comment 10 Yehuda Katz 2013-01-25 17:41:04 PST
I am working on a library to support communication with sandboxed code that is agnostic to the specific sandboxing mechanism used. See https://github.com/tildeio/oasis.js

Support for nested contexts is important for this library (and the use-cases that are driving it).
Comment 11 Alon Zakai 2014-06-24 10:43:55 PDT
I think this feature would be great to have. The use case I have right now is I'm taking a large application and moving it to run in a worker, so it's more responsive and never stalls the main thread. The application happens to use workers, so basically I need to be able to create workers from the worker I move the application to, for it to run.

The current situation was a surprise to me: Nested workers are in the spec, are mentioned on html5rocks as working ( http://www.html5rocks.com/en/tutorials/workers/basics/#toc-enviornment-subworkers ), but in practice seem to only work in firefox at the moment :(
Comment 12 Alon Zakai 2014-07-14 12:37:10 PDT
Correction to my last statement, they work in Internet Explorer as well.
Comment 13 Chris Dumez 2016-06-09 22:15:22 PDT
*** Bug 158605 has been marked as a duplicate of this bug. ***
Comment 14 Simon Pieters (:zcorpan) 2019-05-08 12:38:43 PDT
A wpt test for this:


This test is currently marked [ Skip ] in WebKit TestExpectations.
Comment 15 Tobias Uhlig 2021-04-27 12:53:32 PDT
We could use this feature for the neo.mjs UI framework project to spawn the data worker from inside the app worker.

Created a discussion here:

Ideally would be support for spawning a "normal" worker from within a SharedWorker as well. Is there already a ticket for this one?

Spawning SharedWorkers from inside SharedWorkers is not needed for my context.

Best regards,
Comment 16 Jesper van den Ende 2021-06-02 01:07:43 PDT
I have moved a library I'm using to a Worker, but the library itself creates another worker. Now my site works in all browsers except Safari :(
Comment 17 Chris Dumez 2022-09-14 19:22:23 PDT
*** Bug 245182 has been marked as a duplicate of this bug. ***
Comment 18 Chris Dumez 2022-09-14 19:22:42 PDT
Comment 19 EWS 2022-09-17 17:31:28 PDT
Committed 254597@main (48880e342359): <https://commits.webkit.org/254597@main>

Reviewed commits have been landed. Closing PR #4349 and removing active labels.