New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[worklets] There is no way to catch "throw" or "unhandledrejection" #975
Comments
Worklets aren't Workers; they share a similar API surface and are conceptually close, but are quite different things in impl. You can't (currently) post messages to them, for instance. Whether they live on the main thread or not is an impl detail; how many worklets live in a single global realm is also an impl detail. This is very different from Workers, which have unique Realms. So, we can't reasonably register a single global error/rejection handler, as the error/rejection could come from any of the unpredictable set of the other worklets currently sharing a global with you. Potentially each individual Worklet registration could take such handlers, but I'm not sure what the impl costs would be. |
Great. |
I didn't say they live on the main thread; I said it's undefined what thread they live on. I'm not sure what the rest of your post is about, it seems to be a completely different topic from the OP. Can you bring it up in a different issue and elaborate more with examples or use-cases? |
Do you mean that a paintWorklet thread is unknown? -P.S |
Yes. In the introduction the spec explains that worklets:
They might be run in the main thread, or on a unique process per worklet, or on a small number of dedicated processes with the worklets allocated from a pool. Which is used depends on the architecture of the browser, the design of the particular worklet (AudioWorklet has different concerns than PaintWorklet, for example), and the perf/security tradeoff each browser wants to take on. |
I think this issue is probably best closed, as it's gone in several different directions and hasn't seen much followup. It could be reopened on https://github.com/whatwg/html/issues if the OP still has concerns. |
It seems that we can not handle throw(s) happened in worklets.
As far as I know, worklets are kind of workers, if so, having
[onerror, onmessage, postmessage, terminate]
methods are expected and should behave asynchronously.If they are more like dynamic module, we should have the ability of catching unhandled promise rejections.
Otherwise, can we call a Worklet a synchronous sandboxed "Realm" which they are living in main thread? If yes, still we need to catch all of its errors.
The text was updated successfully, but these errors were encountered: