Skip to content

Commit

Permalink
[css-paint-api] Add in global scope selection rules, i.e. not reusing…
Browse files Browse the repository at this point in the history
… the same GS more than 1000 times in a row.
  • Loading branch information
bfgeek committed Apr 7, 2018
1 parent 2c901ea commit b57b101
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions css-paint-api/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -565,14 +565,8 @@ with), given |snappedConcreteObjectSize| it <em>must</em> run the following step
</div>

12. Let |workletGlobalScope| be a {{PaintWorkletGlobalScope}} from the list of <a>worklet's
WorkletGlobalScopes</a> from the paint {{Worklet}}.

The user agent <em>must</em> have, and select from at least two {{PaintWorkletGlobalScope}}s
in the <a>worklet's WorkletGlobalScopes</a> <a>list</a>, unless the user agent is under
memory constraints.

Note: This is to ensure that authors do not rely on being able to store state on the global
object or non-regeneratable state on the class.
WorkletGlobalScopes</a> from the paint {{Worklet}}, following the rules defined in
[[#global-scope-selection]].

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

Global Scope Selection {#global-scope-selection}
------------------------------------------------

When the user agent needs to select a {{PaintWorkletGlobalScope}} from the paint <a>worklet's
WorkletGlobalScopes</a> <a>list</a> it <em>must</em>:

- Select from at <em>least</em> two {{PaintWorkletGlobalScope}}s, unless the user agent is under
memory constraints.

- <em>Not</em> re-use the same {{PaintWorkletGlobalScope}} more than 1000 times in a row.

Note: The 1000 limit was picked as a high upper bound, this limit may improve (downwards)
over time.

Note: These rules exist to ensure that authors do not rely on being able to store state on the
global object or non-regeneratable state on the class. See [[worklets-1#code-idempotency]].

Examples {#examples}
====================

Expand Down

0 comments on commit b57b101

Please sign in to comment.