Skip to content

Commit 54b811f

Browse files
dtapuskadomenic
authored andcommitted
Add pausing execution of worklets and dedicated workers
The lifecycle of workers and worklets was undefined in the specification. Add some formalization around dedicated workers and worklets. Still to be determined is what happens with shared workers and service workers.
1 parent e12ec1c commit 54b811f

File tree

2 files changed

+205
-92
lines changed

2 files changed

+205
-92
lines changed

spec.bs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,17 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/;
3232
type: dfn; text: media elements; url: media.html#media-element
3333
type: dfn; text: media pause; url: media.html#internal-pause-steps
3434
type: dfn; text: media play; url: media.html#internal-play-steps
35+
type: dfn; text: dedicated worker agent; url: webappapis.html#dedicated-worker-agent
36+
type: dfn; text: worklet agent; url: webappapis.html#worklet-agent
3537
spec: CSS2; urlPrefix: https://www.w3.org/TR/CSS2/
3638
type: dfn; text: viewport; url: visuren.html#viewport
3739
spec: IntersectionObserver; urlPrefix: https://w3c.github.io/IntersectionObserver/
3840
type: dfn; text: compute the intersection of a target element and the root; url: #calculate-intersection-rect-algo
41+
spec: ECMA262; urlPrefix: https://tc39.github.io/ecma262/;
42+
type: dfn; text: blocked; url: #sec-forward-progress
43+
type: dfn; text: realm; url: #sec-code-realms
44+
spec: CSS-Houdini; urlPrefix: https://drafts.css-houdini.org/worklets;
45+
type: dfn; text: owning document; for: worklet; url: #workletglobalscope-owner-document
3946
</pre>
4047

4148

@@ -179,6 +186,23 @@ If these conditions aren't met, the document will be in the [=/unfrozen=] state.
179186
Processing model {#sec-processing-model}
180187
========================================
181188

189+
Modifications to worklet and worker behavior {#worklets-workers}
190+
----------------------------------------------------------------
191+
192+
Any [=worklet agent=] whose single [=/realm=]'s [=Realm/global object=]'s [=worklet/owning document=] is [=/frozen=] must become [=blocked=].
193+
Any [=dedicated worker agent=] whose single [=/realm=]'s [=Realm/global object=]'s [=DedicatedWorkerGlobalScope/owning document=] is non-null and [=/frozen=] must become [=blocked=].
194+
195+
<div algorithm>
196+
To determine the <dfn for="DedicatedWorkerGlobalScope" export>owning document</dfn> for a {{DedicatedWorkerGlobalScope}} |workerGlobalScope|:
197+
198+
1. If |workerGlobalScope|'s [=owner set=] consists of a single {{Document}} |document|, then return |document|.
199+
1. If |workerGlobalScope|'s [=owner set=] consists of a single {{DedicatedWorkerGlobalScope}} |parentWorkerGlobalScope|, then return |parentWorkerGlobalScope|'s [=owning document=].
200+
1. Return null.
201+
202+
NOTE: A {{DedicatedWorkerGlobalScope}}'s [=owner set=] will always have exactly one item.
203+
</div>
204+
205+
182206
Modifications to the HTML Standard {#mod}
183207
--------------------------------------------
184208

0 commit comments

Comments
 (0)