-
Notifications
You must be signed in to change notification settings - Fork 143
[worklets] Make "Code Idempotency" section normative and stronger #308
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
Comments
Note that some uses cases (eg. animationworklet) absolutely need some way to pass state from one invocation to the next in a serial fashion. But this can be explicit according to some contract, not depending on the global object. |
From today’s meeting:
@RByers when such state needs to be passed around, I think it should be explicit though parameters and return values rather than implicit side effects. |
Absolutely. See the above issue for one example of how we're doing this in a demo. |
re FrozenRealms they require freezing all of the globals and all of prototypes of everything which means you can't use polyfills or work around API bugs easily. They also have some serious restrictions: |
https://drafts.css-houdini.org/worklets/#code-idempotency is a non-normative section that starts with:
In order to help make that possible, it goes on with content such as:
I think this is not enough. If one major implementation ships for example CSS Layout API without these "may" precautions, it is likely that many websites will rely and worklet methods being executing in a certain order and in the same global scope. This might effectively make parallelization web-incompatible.
I’d like to make this section normative, and have it specify "must" requirements for user-agents. The details can be discussed, but one idea is to use JavaScript Frozen Realms to make the global scope immutable (or have an immutable prototype so that creating a new global scope with that same prototype is cheap and could be done for every call).
CC @tschneidereit
The text was updated successfully, but these errors were encountered: