diff --git a/worklets/Overview.bs b/worklets/Overview.bs
index 75d54393..135a2e9a 100644
--- a/worklets/Overview.bs
+++ b/worklets/Overview.bs
@@ -18,6 +18,7 @@ urlPrefix: http://heycam.github.io/webidl/#dfn-; type: dfn;
urlPrefix: https://fetch.spec.whatwg.org/; type: dfn;
urlPrefix: #concept-;
text: fetch
+ url: request-url; text: url;
urlPrefix: https://html.spec.whatwg.org/multipage/browsers.html; type: dfn;
text: effective script origin
url: #origin-2; text: origin
@@ -180,17 +181,14 @@ When a user agent is to create a WorkletGlobalScope, for a given |wor
4. Associate the |settingsObject| with |workletGlobalScope|.
- 5. For each |entry| in the given |worklet|'s module responses map (in insertion order),
- run the following substeps:
+ 5. For each |resolvedModuleURL| in the given |worklet|'s top level module url list (in
+ insertion order), run the following substeps:
- 1. Let |resolvedModuleURL| be |entry|'s key.
+ 1. Fetch a module worklet script tree given |worklet|, |resolvedModuleURL|,
+ |outsideSettings|, and |settingsObject|.
- 2. Let |script| be the result of fetch a module script tree given
- |resolvedModuleURL|, "anonymous" for the CORS setting attribute, and
- |settingsObject|.
-
- Note: Worklets follow web workers here in not allowing "use-credientials" for
- fetching resources.
+ 2. Let |script| be the result of fetch a module worklet script tree when it
+ asynchronously completes.
3. Run a module script given |script|.
@@ -247,6 +245,44 @@ When a user agent is to set up a worklet environment settings object,
Issue: Merge this with https://html.spec.whatwg.org/multipage/workers.html#set-up-a-worker-environment-settings-object
+### Fetching a module worklet script tree ### {#fetching-a-module-worklet-script-tree}
+
+When a user agent is to fetch a module worklet script tree, given |worklet|,
+ |resolvedModuleURL|, |outsideSettings|, and |insideSettings|, it must run the following steps:
+
+ 1. Fetch a module worker script tree given |resolvedModuleURL|, |outsideSettings|,
+ "script", "omit", and |insideSettings|.
+
+ To perform the fetch given |request|, and the |isTopLevel| flag, perform the
+ following steps:
+
+ 1. Let |cache| be |worklet|'s module responses map.
+
+ 2. Let |url| be |request|'s url.
+
+ 3. If |cache| contains an entry with key |url| whose value is "fetching", wait
+ (in parallel) until that entry's value changes, then proceed to the
+ next step.
+
+ 4. If |cache| contains an entry with key |url|, asynchronously complete this
+ algorithm with that entry's value, and abort these steps.
+
+ 5. Create an entry in |cache| with key |url| and value "fetching".
+
+ 6. Fetch |request|.
+
+ 7. Let |response| be the result of fetch when it asynchronously
+ completes.
+
+ 8. If |isTopLevel| is set, append |resolvedModuleURL| the |worklet|'s top level
+ module url list
+
+ 9. Set the value of the entry in |cache| whose key is |url| to |response|, and
+ asynchronously complete this algorithm with |response|.
+
+ 2. Asynchronously complete this algorithm with the result of fetch a module worker script
+ tree when it completes.
+
Worklet {#worklet-section}
--------------------------
@@ -268,13 +304,17 @@ Note: As an example the worklet global scope type might be a {{PaintWorkl
A {{Worklet}} has a list of the worklet's WorkletGlobalScopes. Initially this list
is empty; it is populated when the user agent chooses to create its {{WorkletGlobalScope}}.
-A {{Worklet}} has a module responses map. This is a ordered map of module URLs to values
-that are a fetch responses. The map's entries are ordered based on their insertion order.
-Access to this map should be thread-safe.
+A {{Worklet}} has a module responses map. This is a map of module URLs to values that are
+a fetch responses. Access to this map should be thread-safe.
+
+A {{Worklet}} has a top level module url list. This is a ordered list of module URLs. The
+list's entries are ordered based on their insertion order. Access to this list should be
+thread-safe.
-The module responses map exists to ensure that {{WorkletGlobalScope}}s created at different
-times contain the same set of script source text and have the same behaviour. The creation of
-additional {{WorkletGlobalScope}}s should be transparent to the author.
+The module responses map and top level module url list exists to ensure that
+{{WorkletGlobalScope}}s created at different times contain the same set of script source text and
+have the same behaviour. The creation of additional {{WorkletGlobalScope}}s should be transparent to
+the author.
When the import(|moduleURL|) method is called on a {{Worklet}} object,
the user agent must run the following steps:
@@ -302,34 +342,10 @@ the user agent must run the following steps:
1. Let |insideSettings| be the {{WorkletGlobalScope}}'s associated environment
settings object.
- 2. Fetch a module script tree given |resolvedModuleURL|, "omit", the empty string
- (as no cryptographic nonce is present for worklets), "not parser-inserted",
- "script", |outsideSettings|, and |insideSettings|.
-
- To perform the request given |request|, perform the following steps:
-
- 1. Let |cache| be the current {{Worklet}}'s module responses map.
-
- 2. Let |url| be |request|'s url.
-
- 3. If |cache| contains an entry with key |url| whose value is "fetching", wait
- (in parallel) until that entry's value changes, then proceed to the
- next step.
-
- 4. If |cache| contains an entry with key |url|, asynchronously complete this
- algorithm with that entry's value, and abort these steps.
-
- 5. Create an entry in |cache| with key |url| and value "fetching".
-
- 6. Fetch |request|.
-
- 7. Let |response| be the result of fetch when it asynchronously
- completes.
-
- 8. Set the value of the entry in |cache| whose key is |url| to |response|, and
- asynchronously complete this algorithm with |response|.
+ 2. Fetch a module worklet script tree given the current {{Worklet}},
+ |resolvedModuleURL|, |outsideSettings|, and |settingsObject|.
- 3. Let |script| be the result of fetch a module script tree when it
+ 3. Let |script| be the result of fetch a module worklet script tree when it
asynchronously completes.
4. Run a module script given |script|.