@@ -268,10 +268,10 @@ A <dfn>task handle</dfn> is a [=struct=] with the following [=struct/items=]:
268
268
1 . Let |priority| be |options|[ "{{SchedulerPostTaskOptions/priority}}"] if
269
269
|options|[ "{{SchedulerPostTaskOptions/priority}}"] [ =map/exists=] , or otherwise null.
270
270
1 . Let |enqueueSteps| be the following steps:
271
- 1 . Let |queue| be the result of [ =selecting the scheduler task queue=] for |scheduler| given
272
- |signal| and |priority|.
273
- 1 . [ =Schedule a task to invoke a callback=] for |scheduler| given |queue|, | callback|, |result|,
274
- and |handle|.
271
+ 1 . Set |handle|'s [ =task handle/queue= ] to the result of [ =selecting the scheduler task queue=]
272
+ for |scheduler| given |signal| and |priority|.
273
+ 1 . [ =Schedule a task to invoke a callback=] for |scheduler| given |callback|, |result|, and
274
+ |handle|.
275
275
1 . Let |delay| be |options|[ "{{SchedulerPostTaskOptions/delay}}"] .
276
276
1 . If |delay| is greater than 0, then [ =run steps after a timeout=] given |scheduler|'s [ =relevant
277
277
global object=] , "` scheduler-postTask ` ", |delay|, and the following steps:
@@ -314,21 +314,19 @@ Issue: [=Run steps after a timeout=] doesn't necessarily account for suspension;
314
314
315
315
<div algorithm >
316
316
To <dfn >schedule a task to invoke a callback</dfn > for {{Scheduler}} |scheduler| given a
317
- [ =scheduler task queue=] |queue|, a {{SchedulerPostTaskCallback}} |callback|, a promise |result|,
318
- and a [ =task handle=] |handle|:
317
+ {{SchedulerPostTaskCallback}} |callback|, a promise |result|, and a [ =task handle=] |handle|:
319
318
320
319
1 . Let |global| be the [ =relevant global object=] for |scheduler|.
321
320
1 . Let |document| be |global|'s <a attribute for =" Window " >associated ` Document ` </a > if |global| is
322
321
a {{Window}} object; otherwise null.
323
322
1 . Let |enqueue order| be |scheduler|'s [ =Scheduler/next enqueue order=] .
324
323
1 . Increment |scheduler|'s [ =Scheduler/next enqueue order=] by 1.
325
- 1 . Let |task| be the result of [ =queuing a scheduler task=] on |queue| given |enqueue order|,
326
- [ =the posted task task source=] , and |document|, and that performs the following steps:
324
+ 1 . Set |handle|'s [ =task handle/task=] to the result of [ =queuing a scheduler task=] on |handle|'s
325
+ [ =task handle/queue=] given |enqueue order|, [ =the posted task task source=] , and |document|,
326
+ and that performs the following steps:
327
327
1 . Let |callback result| be the result of [ =invoking=] |callback|. If that threw an exception,
328
328
then [ =reject=] |result| with that, otherwise resolve |result| with |callback result|.
329
329
1 . Run |handle|'s [ =task handle/task complete steps=] .
330
- 1 . Set |handle|'s [ =task handle/task=] to |task|.
331
- 1 . Set |handle|'s [ =task handle/queue=] to |queue|.
332
330
333
331
Issue: Because this algorithm can be called from [ =in parallel=] steps, parts of this and other
334
332
algorithms are racy. Specifically, the [ =Scheduler/next enqueue order=] should be updated
0 commit comments