Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example that rejects promises from in parallel #10541

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -1634,14 +1634,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<p>The following solution suffers from race conditions:</p>

<ol>
<li><p>Let <var>p</var> be a new promise.</p></li>
<li><p>Let <var>p</var> be a new promise created in <span>this</span>'s <span
data-x="concept-relevant-realm">relevant realm</span>.</p></li>

<li>
<p>Run the following steps <span>in parallel</span>:</p>

<ol>
<li><p>If <var>nameList</var> <span data-x="list contains">contains</span> <var>name</var>,
reject <var>p</var> with a <code>TypeError</code> and abort these steps.</p></li>
then <span>queue a global task</span> on the <span>DOM manipulation task source</span> given
<span>this</span>'s <span>relevant global object</span> to reject <var>p</var> with a
<code>TypeError</code>, and abort these steps.</p></li>

<li><p>Do some potentially lengthy work.</p></li>

Expand All @@ -1663,14 +1666,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<span>starting a new parallel queue</span>, then:</p>

<ol>
<li><p>Let <var>p</var> be a new promise.</p></li>
<li><p>Let <var>p</var> be a new promise created in <span>this</span>'s <span
data-x="concept-relevant-realm">relevant realm</span>.</p></li>

<li>
<p><mark><span>Enqueue the following steps</span> to <var>nameListQueue</var>:</mark></p>

<ol>
<li><p>If <var>nameList</var> <span data-x="list contains">contains</span> <var>name</var>,
reject <var>p</var> with a <code>TypeError</code> and abort these steps.</p></li>
then <span>queue a global task</span> on the <span>DOM manipulation task source</span> given
<span>this</span>'s <span>relevant global object</span> to reject <var>p</var> with a
<code>TypeError</code>, and abort these steps.</p></li>

<li><p>Do some potentially lengthy work.</p></li>

Expand Down