Skip to content

Commit 26aa7c3

Browse files
authored
Fix an algorithm that was treating null as a module script
In particular, the "uninstantiated inclusive descendant module scripts" was not properly skipping null entries in the module map (which represent failed fetches). Only module script entries should be returned and processed by subsequent steps of the calling algorithm. Closes whatwg#2539.
1 parent 9b4d858 commit 26aa7c3

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

source

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87117,12 +87117,19 @@ interface <dfn>NavigatorOnLine</dfn> {
8711787117
<li><p>If <var>result</var> is null, asynchronously complete this algorithm with null and abort
8711887118
these steps.</p></li>
8711987119

87120-
<li><p>Otherwise, <var>result</var> is a <span>module script</span>. <span data-x="fetch the
87121-
descendants of a module script">Fetch the descendants</span> of <var>result</var> given
87122-
<var>destination</var> and an ancestor list obtained by appending <var>url</var> to <var>ancestor
87123-
list</var>. Wait for <span data-x="fetch the descendants of a module script">fetching the
87124-
descendants of a module script</span> to asynchronously complete with <var>descendants
87125-
result</var> before proceeding to the next step.</p></li>
87120+
<li>
87121+
<p>Otherwise, <var>result</var> is a <span>module script</span>. <span data-x="fetch the
87122+
descendants of a module script">Fetch the descendants</span> of <var>result</var> given
87123+
<var>destination</var> and an ancestor list obtained by appending <var>url</var> to <var>ancestor
87124+
list</var>. Wait for <span data-x="fetch the descendants of a module script">fetching the
87125+
descendants of a module script</span> to asynchronously complete with <var>descendants
87126+
result</var> before proceeding to the next step.</p>
87127+
87128+
<p class="note">If the asynchronous completion result is null, meaning that fetching one of the
87129+
descendants failed, we still proceed through the next set of steps. A failure will shortly occur
87130+
during instantiation, which we then react to appropriately. The error signal is eventually
87131+
propagated to the caller of this algorithm in the last step.</p>
87132+
</li>
8712687133

8712787134
<li><p>Let <var>record</var> be <var>result</var>'s <span
8712887135
data-x="concept-module-script-module-record">module record</span>.</p>
@@ -87137,9 +87144,8 @@ interface <dfn>NavigatorOnLine</dfn> {
8713787144
</li>
8713887145

8713987146
<li>
87140-
<p>For each <span>module script</span> <var>script</var> in <var>result</var>'s
87141-
<span>uninstantiated inclusive descendant module scripts</span>, perform the following
87142-
steps:</p>
87147+
<p>For each <var>script</var> in <var>result</var>'s <span>uninstantiated inclusive descendant module
87148+
scripts</span>, perform the following steps:</p>
8714387149

8714487150
<ol>
8714587151
<li>
@@ -87195,6 +87201,9 @@ interface <dfn>NavigatorOnLine</dfn> {
8719587201
<li><p>Let <var>current</var> the result of <span data-x="stack pop">popping</span> from
8719687202
<var>stack</var>.</p></li>
8719787203

87204+
<li><p>Assert: <var>current</var> is a <span>module script</span> (i.e., it is not "<code
87205+
data-x="">fetching</code>" or null).</p></li>
87206+
8719887207
<li>
8719987208
<p>If <var>inclusive descendants</var> and <var>stack</var> both do not <span
8720087209
data-x="list contains">contain</span> <var>current</var>, then:</p>
@@ -87215,10 +87224,21 @@ interface <dfn>NavigatorOnLine</dfn> {
8721587224
data-x="map get">getting each value</span> in <var>moduleMap</var> whose key is given by an
8721687225
item of <var>child URLs</var>.</p></li>
8721787226

87218-
<li><p><span data-x="list iterate">For each</span> <var>s</var> in <var>child modules</var>
87219-
that is not <span data-x="list contains">contained by</span> <var>inclusive
87220-
descendants</var>, <span data-x="stack push">push</span> <var>s</var> onto
87221-
<var>stack</var>.</p></li>
87227+
<li>
87228+
<p><span data-x="list iterate">For each</span> <var>s</var> of <var>child modules</var>:</p>
87229+
87230+
<ol>
87231+
<li><p>If <var>inclusive descendants</var> already <span data-x="list
87232+
contains">contains</span> <var>s</var>, <span>continue</span>.</p></li>
87233+
87234+
<li><p>If <var>s</var> is null, <span>continue</span>.</p></li>
87235+
87236+
<li><p>Assert: <var>s</var> is a <span>module script</span> (i.e., it is not
87237+
"<code data-x="">fetching</code>", since by this point all child modules must have been
87238+
fetched).</p></li>
87239+
87240+
<li><p><span data-x="stack push">Push</span> <var>s</var> onto <var>stack</var>.</p></li>
87241+
</ol>
8722287242
</ol>
8722387243
</li>
8722487244
</ol>

0 commit comments

Comments
 (0)