Skip to content

Commit b57b101

Browse files
committed
[css-paint-api] Add in global scope selection rules, i.e. not reusing the same GS more than 1000 times in a row.
1 parent 2c901ea commit b57b101

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

css-paint-api/Overview.bs

+19-8
Original file line numberDiff line numberDiff line change
@@ -565,14 +565,8 @@ with), given |snappedConcreteObjectSize| it <em>must</em> run the following step
565565
</div>
566566

567567
12. Let |workletGlobalScope| be a {{PaintWorkletGlobalScope}} from the list of <a>worklet's
568-
WorkletGlobalScopes</a> from the paint {{Worklet}}.
569-
570-
The user agent <em>must</em> have, and select from at least two {{PaintWorkletGlobalScope}}s
571-
in the <a>worklet's WorkletGlobalScopes</a> <a>list</a>, unless the user agent is under
572-
memory constraints.
573-
574-
Note: This is to ensure that authors do not rely on being able to store state on the global
575-
object or non-regeneratable state on the class.
568+
WorkletGlobalScopes</a> from the paint {{Worklet}}, following the rules defined in
569+
[[#global-scope-selection]].
576570

577571
The user agent <em>may</em> also <a>create a WorkletGlobalScope</a> at this time, given the
578572
paint {{Worklet}}.
@@ -716,6 +710,23 @@ Note: The contents of the resulting image are not designed to be accessible. Aut
716710
any useful information through the standard accessibility APIs.
717711
</div>
718712

713+
Global Scope Selection {#global-scope-selection}
714+
------------------------------------------------
715+
716+
When the user agent needs to select a {{PaintWorkletGlobalScope}} from the paint <a>worklet's
717+
WorkletGlobalScopes</a> <a>list</a> it <em>must</em>:
718+
719+
- Select from at <em>least</em> two {{PaintWorkletGlobalScope}}s, unless the user agent is under
720+
memory constraints.
721+
722+
- <em>Not</em> re-use the same {{PaintWorkletGlobalScope}} more than 1000 times in a row.
723+
724+
Note: The 1000 limit was picked as a high upper bound, this limit may improve (downwards)
725+
over time.
726+
727+
Note: These rules exist to ensure that authors do not rely on being able to store state on the
728+
global object or non-regeneratable state on the class. See [[worklets-1#code-idempotency]].
729+
719730
Examples {#examples}
720731
====================
721732

0 commit comments

Comments
 (0)