@@ -10,6 +10,21 @@ Abstract: This specification defines an API for running scripts in stages of th
10
10
Editor : Ian Kilpatrick, ikilpatrick@chromium.org
11
11
</pre>
12
12
13
+ <style>
14
+ /* Put nice boxes around each algorithm. */
15
+ [data-algorithm] :not(.heading) {
16
+ padding: .5em;
17
+ border: thin solid #ddd; border-radius: .5em;
18
+ margin: .5em calc(-0.5em - 1px);
19
+ }
20
+ [data-algorithm] :not(.heading) > :first-child {
21
+ margin-top: 0;
22
+ }
23
+ [data-algorithm] :not(.heading) > :last-child {
24
+ margin-bottom: 0;
25
+ }
26
+ </style>
27
+
13
28
<pre class="anchors">
14
29
urlPrefix: http://heycam.github.io/webidl/; type: dfn;
15
30
text: AbortError
@@ -175,6 +190,7 @@ Note:
175
190
176
191
### Creating a WorkletGlobalScope ### {#creating-a-workletglobalscope}
177
192
193
+ <div algorithm>
178
194
When a user agent is to <dfn>create a WorkletGlobalScope</dfn> , given |workletGlobalScopeType|,
179
195
|moduleResponsesMap|, and |outsideSettings|, it <em> must</em> run the following steps:
180
196
@@ -213,9 +229,11 @@ When a user agent is to <dfn>create a WorkletGlobalScope</dfn>, given |workletGl
213
229
|script| should never be <em> null</em> here.
214
230
215
231
6. Run the <a>responsible event loop</a> specified by |insideSettings|.
232
+ </div>
216
233
217
234
### Script settings for worklets ### {#script-settings-for-worklets}
218
235
236
+ <div algorithm>
219
237
When a user agent is to <dfn>set up a worklet environment settings object</dfn> , given a
220
238
|executionContext|, it must run the following steps:
221
239
1. Let |inheritedResponsibleBrowsingContext| be the <a>responsible browsing context</a>
@@ -264,6 +282,7 @@ When a user agent is to <dfn>set up a worklet environment settings object</dfn>,
264
282
:: Return |workletGlobalScope|'s <a>HTTPS state</a> .
265
283
266
284
7. Return |settingsObject|.
285
+ </div>
267
286
268
287
Issue: Merge this with https://html.spec.whatwg.org/multipage/workers.html#set-up-a-worker-environment-settings-object
269
288
@@ -310,8 +329,7 @@ A <dfn>pending tasks struct</dfn> is a <a>struct</a> consiting of:
310
329
- A <dfn for="pending tasks struct">counter</dfn> .
311
330
This is used by the algorithms below.
312
331
313
- <hr>
314
-
332
+ <div algorithm>
315
333
When the <dfn method for=Worklet>import(|moduleURL|)</dfn> method is called on a {{Worklet}} object,
316
334
the user agent <em> must</em> run the following steps:
317
335
1. Let |promise| be <a>a new promise</a> .
@@ -354,44 +372,46 @@ the user agent <em>must</em> run the following steps:
354
372
355
373
Note: The rejecting and resolving of the |promise| occurs within the <a>fetch and invoke a
356
374
worklet script</a> algorithm.
375
+ </div>
357
376
358
- <hr>
359
-
377
+ <div algorithm>
360
378
When the user agent is to <dfn>fetch and invoke a worklet script</dfn> given |workletGlobalScope|,
361
379
|moduleURLRecord|, |moduleResponsesMap|, |outsideSettings|, |pendingTaskStruct|, and |promise|, the
362
380
user agent <em> must</em> run the following steps:
363
381
364
- Note: This algorithm is to be run within the <a>worklet global scope execution environment</a> .
365
-
366
- 1. Let |insideSettings| be the |workletGlobalScope|'s associated <a>environment settings object</a> .
382
+ Note: This algorithm is to be run within the <a>worklet global scope execution environment</a> .
367
383
368
- 2 . Let |script| by the result of <a>fetch a worklet script</a> given |moduleURLRecord|,
369
- |moduleResponsesMap|, |outsideSettings|, and |insideSettings| when it asynchronously completes .
384
+ 1 . Let |insideSettings| be the |workletGlobalScope|'s associated <a>environment settings
385
+ object</a> .
370
386
371
- 3. If |script| is <em> null </em> , then <a>queue a task </a> on |outsideSettings|'s <a>responsible
372
- event loop</a> to run these steps:
387
+ 2. Let |script| by the result of <a>fetch a worklet script </a> given |moduleURLRecord|,
388
+ |moduleResponsesMap|, |outsideSettings|, and |insideSettings| when it asynchronously completes.
373
389
374
- 1 . If |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> is not <b> -1 </b> , then
375
- run these steps:
390
+ 3 . If |script| is <em> null </em> , then <a>queue a task</a> on |outsideSettings|'s <a>responsible
391
+ event loop</a> to run these steps:
376
392
377
- 1. Set |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> to <b> -1</b> .
393
+ 1. If |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> is not <b> -1</b> , then
394
+ run these steps:
378
395
379
- 2. Reject |promise| with an " <a>AbortError </a>" <a>DOMException</a > .
396
+ 1. Set |pendingTaskStruct|'s <a for="pending tasks struct">counter </a> to <b> -1 </b > .
380
397
381
- 4. <a>Run a module script< /a> given |script| .
398
+ 2. Reject |promise| with an " <a>AbortError</a> " <a>DOMException< /a> .
382
399
383
- 5. <a>Queue a task</a> on |outsideSettings|'s <a>responsible event loop </a> to run these steps:
400
+ 4. <a>Run a module script </a> given |script|.
384
401
385
- 1. If |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> is not <b> -1</b> , then run
386
- these steps:
402
+ 5. <a>Queue a task</a> on |outsideSettings|'s <a>responsible event loop</a> to run these steps:
387
403
388
- 1. Decrement |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> by <b> 1</b> .
404
+ 1. If |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> is not <b> -1</b> , then
405
+ run these steps:
389
406
390
- 1. If |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> is <b> 0 </b> , then
391
- resolve |promise| .
407
+ 1. Decrement |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> by
408
+ <b> 1 </b> .
392
409
393
- <hr>
410
+ 2. If |pendingTaskStruct|'s <a for="pending tasks struct">counter</a> is <b> 0</b> , then
411
+ resolve |promise|.
412
+ </div>
394
413
414
+ <div algorithm>
395
415
When the user agent is to <dfn>fetch a worklet script</dfn> given |moduleURLRecord|,
396
416
|moduleResponsesMap|, |outsideSettings|, and |insideSettings|, the user agent <em> must</em>
397
417
run the following steps:
@@ -454,6 +474,7 @@ Note: Specifically, if a script fails to parse or fails to load over the network
454
474
it would print <code class='lang-javascript'> [paintWorklet#3] Hello from a
455
475
WorkletGlobalScope!</code> again in the debugging tools when this occurs.
456
476
</div>
477
+ </div>
457
478
458
479
Issue(w3c/css-houdini-drafts#47): Need ability to load code into a {{WorkletGlobalScope}}
459
480
declaratively.
0 commit comments