[css-houdini-drafts] [worklets] Make "Code Idempotency" section normative and stronger

SimonSapin has just created a new issue for 
https://github.com/w3c/css-houdini-drafts:

== [worklets] Make "Code Idempotency" section normative and stronger 
==
https://drafts.css-houdini.org/worklets/#code-idempotency is a 
non-normative section that starts with:

> Multiple instances of WorkletGlobalScope can be created for each 
Worklet that they belong to. User agents may choose to do this in 
order to parallelize work over multiple threads, or to move work 
between threads as required.

In order to help make that possible, it goes on with content such as:

> authors […] should make their code idempotent.
>
> User agents may choose to always have at least two 
WorkletGlobalScopes per Worklet


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](https://github.com/FUDCo/proposal-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

Please view or discuss this issue at 
https://github.com/w3c/css-houdini-drafts/issues/308 using your GitHub
 account

Received on Monday, 19 September 2016 12:46:41 UTC