@@ -296,7 +296,11 @@ The {{Worklet}} object provides the capability to import module scripts into its
296
296
297
297
<pre class='idl'>
298
298
interface Worklet {
299
- [NewObject] Promise<void> import(USVString moduleURL);
299
+ [NewObject] Promise<void> import(USVString moduleURL, optional WorkletOptions options);
300
+ };
301
+
302
+ dictionary WorkletOptions {
303
+ RequestCredentials credentials = "omit";
300
304
};
301
305
</pre>
302
306
@@ -331,8 +335,8 @@ A <dfn>pending tasks struct</dfn> is a <a>struct</a> consiting of:
331
335
This is used by the algorithms below.
332
336
333
337
<div algorithm>
334
- When the <dfn method for=Worklet>import(|moduleURL|)</dfn> method is called on a {{Worklet}} object,
335
- the user agent <em> must</em> run the following steps:
338
+ When the <dfn method for=Worklet>import(|moduleURL|, |options| )</dfn> method is called on a
339
+ {{Worklet}} object, the user agent <em> must</em> run the following steps:
336
340
1. Let |promise| be <a>a new promise</a> .
337
341
338
342
2. Let |worklet| be the current {{Worklet}} .
@@ -345,13 +349,15 @@ the user agent <em>must</em> run the following steps:
345
349
346
350
5. Return |promise|, and then continue running this algorithm <a>in parallel</a> .
347
351
348
- 6. Let |outsideSettings| be the <a>relevant settings object</a> of <b> this</b> .
352
+ 6. Let |credentialOptions| be the {{WorkletOptions/credentials}} member of |options|.
353
+
354
+ 7. Let |outsideSettings| be the <a>relevant settings object</a> of <b> this</b> .
349
355
350
- 7 . Let |moduleResponsesMap| be |worklet|'s <a>module responses map</a> .
356
+ 8 . Let |moduleResponsesMap| be |worklet|'s <a>module responses map</a> .
351
357
352
- 8 . Let |workletGlobalScopeType| be |worklet|'s <a>worklet global scope type</a> .
358
+ 9 . Let |workletGlobalScopeType| be |worklet|'s <a>worklet global scope type</a> .
353
359
354
- 9 . If the <a>worklet's WorkletGlobalScopes</a> is empty, run the following steps:
360
+ 10 . If the <a>worklet's WorkletGlobalScopes</a> is empty, run the following steps:
355
361
356
362
1. <a>Create a WorkletGlobalScope</a> given |workletGlobalScopeType|, |moduleResponsesMap|,
357
363
and |outsideSettings|.
@@ -362,31 +368,32 @@ the user agent <em>must</em> run the following steps:
362
368
363
369
Wait for this step to complete before continuing.
364
370
365
- 10 . Let |pendingTaskStruct| be a new <a>pending tasks struct</a> with <a
371
+ 11 . Let |pendingTaskStruct| be a new <a>pending tasks struct</a> with <a
366
372
for="pending tasks struct"> counter</a> initialized to the length of <a>worklet's
367
373
WorkletGlobalScopes</a> .
368
374
369
- 11 . For each |workletGlobalScope| in the <a>worklet's WorkletGlobalScopes</a> , <a>queue a
375
+ 12 . For each |workletGlobalScope| in the <a>worklet's WorkletGlobalScopes</a> , <a>queue a
370
376
task</a> on the |workletGlobalScope| to <a>fetch and invoke a worklet script</a> given
371
- |workletGlobalScope|, |moduleURLRecord|, |moduleResponsesMap|, |outsideSettings |,
372
- |pendingTaskStruct|, and |promise|.
377
+ |workletGlobalScope|, |moduleURLRecord|, |moduleResponsesMap|, |credentialOptions |,
378
+ |outsideSettings|, | pendingTaskStruct|, and |promise|.
373
379
374
380
Note: The rejecting and resolving of the |promise| occurs within the <a>fetch and invoke a
375
381
worklet script</a> algorithm.
376
382
</div>
377
383
378
384
<div algorithm>
379
385
When the user agent is to <dfn>fetch and invoke a worklet script</dfn> given |workletGlobalScope|,
380
- |moduleURLRecord|, |moduleResponsesMap|, |outsideSettings |, |pendingTaskStruct|, and |promise|, the
381
- user agent <em> must</em> run the following steps:
386
+ |moduleURLRecord|, |moduleResponsesMap|, |credentialOptions |, |outsideSettings|,
387
+ |pendingTaskStruct|, and |promise|, the user agent <em> must</em> run the following steps:
382
388
383
389
Note: This algorithm is to be run within the <a>worklet global scope execution environment</a> .
384
390
385
391
1. Let |insideSettings| be the |workletGlobalScope|'s associated <a>environment settings
386
392
object</a> .
387
393
388
394
2. Let |script| by the result of <a>fetch a worklet script</a> given |moduleURLRecord|,
389
- |moduleResponsesMap|, |outsideSettings|, and |insideSettings| when it asynchronously completes.
395
+ |moduleResponsesMap|, |credentialOptions|, |outsideSettings|, and |insideSettings| when it
396
+ asynchronously completes.
390
397
391
398
3. If |script| is <em> null</em> , then <a>queue a task</a> on |outsideSettings|'s <a>responsible
392
399
event loop</a> to run these steps:
@@ -414,13 +421,13 @@ user agent <em>must</em> run the following steps:
414
421
415
422
<div algorithm>
416
423
When the user agent is to <dfn>fetch a worklet script</dfn> given |moduleURLRecord|,
417
- |moduleResponsesMap|, |outsideSettings|, and |insideSettings|, the user agent <em> must </em>
418
- run the following steps:
424
+ |moduleResponsesMap|, |credentialOptions|, | outsideSettings|, and |insideSettings|, the user agent
425
+ <em> must </em> run the following steps:
419
426
420
427
Note: This algorithm is to be run within the <a>worklet global scope execution environment</a> .
421
428
422
429
1. <a>Fetch a module worker script graph</a> given |moduleURLRecord|, |outsideSettings|, "script",
423
- "omit" , and |insideSettings|.
430
+ |credentialOptions| , and |insideSettings|.
424
431
425
432
To <a>perform the request</a> given |request|, perform the following steps:
426
433
0 commit comments