Skip to content

Commit eba7046

Browse files
committed
[worklets] Reject promise with "AbortError" if fetching the module tree fails.
Fixes w3c#226.
1 parent 4b7d4df commit eba7046

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

worklets/Overview.bs

+18-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ Editor: Ian Kilpatrick, ikilpatrick@chromium.org
1111
</pre>
1212

1313
<pre class="anchors">
14-
urlPrefix: http://heycam.github.io/webidl/#dfn-; type: dfn;
15-
urlPrefix: #dfn-;
14+
urlPrefix: http://heycam.github.io/webidl/; type: dfn;
15+
text: AbortError
16+
text: SyntaxError
17+
urlPrefix: #idl-;
1618
text: DOMException
17-
text: SyntaxError
19+
urlPrefix: #dfn-;
1820
text: inherit
1921
urlPrefix: #es-;
2022
text: invoking callback functions
@@ -283,6 +285,15 @@ The <a>module responses map</a> exists to ensure that {{WorkletGlobalScope}}s cr
283285
times contain the same set of script source text and have the same behaviour. The creation of
284286
additional {{WorkletGlobalScope}}s should be transparent to the author.
285287

288+
Note:
289+
Practically user-agents aren't expected to implement the following algorithm using a
290+
thread-safe map. Instead when {{Worklet/import}} is called user-agents can fetch the module
291+
graph on the main thread, and send the fetched sources (the data contained in the <a>module
292+
responses map</a>) to each thread which has a {{WorkletGlobalScope}}.
293+
294+
If the user agent wishes to create a new {{WorkletGlobalScope}} it can simply sent the list of
295+
all fetched sources from the main thread to the thread which owns the {{WorkletGlobalScope}}.
296+
286297
When the <dfn method for=Worklet>import(|moduleURL|)</dfn> method is called on a {{Worklet}} object,
287298
the user agent <em>must</em> run the following steps:
288299
1. Let |promise| be <a>a new promise</a>.
@@ -339,13 +350,16 @@ the user agent <em>must</em> run the following steps:
339350
3. Let |script| be the result of <a>fetch a module script tree</a> when it
340351
asynchronously completes.
341352

353+
If |script| is <em>null</em> reject |promise| with a "<a>AbortError</a>"
354+
<a>DOMException</a> and abort all these steps.
355+
342356
4. <a>Run a module script</a> given |script|.
343357

344358
2. If <em>all</em> the steps above succeeded (in particular, if all of the scripts parsed
345359
and loaded into the global scopes), resolve |promise|.
346360
<br>Otherwise, reject |promise|.
347361

348-
Note: Specifically, if a script fails to parse or fails to load over the network, it should
362+
Note: Specifically, if a script fails to parse or fails to load over the network, it will
349363
reject the promise; if the script throws an error while first evaluating the promise
350364
should resolve as a classes may have been registered correctly.
351365

0 commit comments

Comments
 (0)