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

Add abort reason to abort fetch #1343

Merged
merged 31 commits into from
Oct 5, 2022
Merged
Changes from 20 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a18ee76
add abort reason to abort fetch
nidhijaju Oct 27, 2021
6e0fe40
add name to acknowledgments
nidhijaju Oct 27, 2021
4a06427
remove if condition
nidhijaju Oct 27, 2021
eb499b4
use aborted predicate
nidhijaju Nov 1, 2021
c0833a5
fix
nidhijaju Nov 1, 2021
55d734e
Merge branch 'whatwg:main' into update-with-abortreason
nidhijaju Jul 25, 2022
4df5ef6
use aborted predicate
nidhijaju Nov 1, 2021
75d4bad
make changes
nidhijaju Aug 4, 2022
b6ddcaa
fix syntax
nidhijaju Aug 4, 2022
ba73b86
address comments
nidhijaju Aug 4, 2022
ddd1628
Apply suggestions from code review
nidhijaju Aug 9, 2022
62edcfe
Merge branch 'whatwg:main' into update-with-abortreason
nidhijaju Aug 15, 2022
14dac0d
incorporate review comments
nidhijaju Aug 15, 2022
8194bf6
update abort controller
nidhijaju Aug 15, 2022
f660a6e
update fetch()
nidhijaju Aug 15, 2022
2255611
move serialization to abort fetch
nidhijaju Aug 15, 2022
f44930c
pass reason to cancelAlgorithm
nidhijaju Aug 15, 2022
122bae5
address comments
nidhijaju Sep 6, 2022
cc54cd6
rename abort fetch
nidhijaju Sep 7, 2022
647f4f5
Apply suggestions from code review
nidhijaju Sep 7, 2022
e5b0236
Merge branch 'whatwg:main' into update-with-abortreason
nidhijaju Sep 28, 2022
1b86ddc
resolve conflict
nidhijaju Sep 28, 2022
b6a779d
fix
nidhijaju Sep 28, 2022
6a0f4aa
wrap fetch with <code>
nidhijaju Sep 28, 2022
63ad081
deserialize abort reason
nidhijaju Sep 30, 2022
f86437e
use controller's reason
nidhijaju Sep 30, 2022
38ea956
fix indentation
nidhijaju Sep 30, 2022
662fe10
fix deserialization & make serialized reason default undefined
nidhijaju Oct 3, 2022
70ade67
fix indentation
nidhijaju Oct 3, 2022
a29fd77
wrap abort fetch calls in <code>
nidhijaju Oct 3, 2022
01a87c0
Go back to null instead of undefined, address logic sharing comment, …
annevk Oct 4, 2022
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
56 changes: 43 additions & 13 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ lt="authentication entry">authentication entries</a> (for HTTP authentication).

<dt><dfn for="fetch controller">report timing steps</dfn> (default null)
<dd>Null or an algorithm accepting a <a for=/>global object</a>.

<dt><dfn for="fetch controller">serialized abort reason</dfn> (default null)
<dd>Null or a serialization from [$StructuredSerialize$].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: might want to add a source comment here about this being a Record.

nidhijaju marked this conversation as resolved.
Show resolved Hide resolved
</dl>

<p>To <dfn export for="fetch controller" id="finalize-and-report-timing">report timing</dfn> for a
Expand All @@ -254,8 +257,20 @@ given a <a>fetch controller</a> <var>controller</var>:
</ol>

<p>To <dfn export for="fetch controller">abort</dfn> a <a for=/>fetch controller</a>
<var>controller</var>, set <var>controller</var>'s <a for="fetch controller">state</a> to
"<code>aborted</code>".
<var>controller</var> with optional <var>error</var>:
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved

<ol>
<li><p>Set <var>controller</var>'s <a for="fetch controller">state</a> to "<code>aborted</code>".

<li><p>Let <var>error</var> be an "{{AbortError}}" {{DOMException}}, if it is not given.
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved

<li><p>Let <var>serializedError</var> be [$StructuredSerialize$](<var>error</var>).
If that threw an exception, catch it, and let <var>serializedError</var> be
[$StructuredSerialize$](a new "{{AbortError}}" {{DOMException}}).
annevk marked this conversation as resolved.
Show resolved Hide resolved

<li><p>Set <var>controller</var>'s <a for="fetch controller">serialized abort reason</a> to
<var>serializedError</var>.
</ol>

<p>To <dfn export for="fetch controller">terminate</dfn> a <a for=/>fetch controller</a>
<var>controller</var>, set <var>controller</var>'s <a for="fetch controller">state</a> to
Expand Down Expand Up @@ -5654,7 +5669,8 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
ongoing fetch if it is <a lt=suspend for=fetch>suspended</a>.

<li><p>Let <var>cancelAlgorithm</var> be an algorithm that <a for="fetch controller">aborts</a>
<var>fetchParams</var>'s <a for="fetch params">controller</a>.
<var>fetchParams</var>'s <a for="fetch params">controller</a> with <var>reason</var>, given
<var>reason</var>.

<li><p>Let <var>highWaterMark</var> be a non-negative, non-NaN number, chosen by the user agent.

Expand Down Expand Up @@ -7740,7 +7756,8 @@ method steps are:
then:

<ol>
<li><p><a>Abort fetch</a> with <var>p</var>, <var>request</var>, and null.
<li><p><a>Abort the fetch() call</a> with <var>p</var>, <var>request</var>, null, and <var>requestObject</var>'s
<a for=Request>signal</a>'s <a for=AbortSignal>abort reason</a>.

<li><p>Return <var>p</var>.
</ol>
Expand Down Expand Up @@ -7770,10 +7787,12 @@ method steps are:
<ol>
<li><p>Set <var>locallyAborted</var> to true.

<li><p><a>Abort fetch</a> with <var>p</var>, <var>request</var>, and <var>responseObject</var>.
<li><p><a>Abort the fetch() call</a> with <var>p</var>, <var>request</var>, <var>responseObject</var>, and
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved
<var>requestObject</var>'s <a for=Request>signal</a>'s <a for=AbortSignal>abort reason</a>.

<li><p>If <var>controller</var> is not null, then <a for="fetch controller">abort</a>
<var>controller</var>.
<var>controller</var> with <var>requestObject</var>'s <a for=Request>signal</a>'s
<a for=AbortSignal>abort reason</a>.
</ol>

<li>
Expand All @@ -7784,9 +7803,21 @@ method steps are:
<ol>
<li><p>If <var>locallyAborted</var> is true, terminate these substeps.

<li><p>If <var>response</var>'s <a for=response>aborted flag</a> is set, then <a>abort fetch</a>
with <var>p</var>, <var>request</var>, and <var>responseObject</var>, and terminate these
substeps.
<li><p>If <var>response</var>'s <a for=response>aborted flag</a> is set, then:
annevk marked this conversation as resolved.
Show resolved Hide resolved

<ol>
<li><p>Let <var>error</var> be an "{{AbortError}}" {{DOMException}}.

<li><p>If <var>requestObject</var>'s <a for=Request>signal</a>'s <a for=AbortSignal>abort reason</a>
is not undefined, set <var>error</var> to <var>requestObject</var>'s <a for=Request>signal</a>'s
<a for=AbortSignal>abort reason</a>.

<li><p><a>Abort the fetch() call</a> with <var>p</var>, <var>request</var>, <var>responseObject</var>, and
<var>error</var>.

<li><p><a for="fetch controller">Abort</a> <var>controller</var> with <var>error</var>, and
terminate these substeps.
</ol>

<li><p>If <var>response</var> is a <a>network error</a>, then <a for=/>reject</a> <var>p</var>
with a {{TypeError}} and terminate these substeps.
Expand All @@ -7800,12 +7831,10 @@ method steps are:
<li><p>Return <var>p</var>.
</ol>

<p>To <dfn>abort fetch</dfn> with a <var>promise</var>, <var>request</var>, and
<var>responseObject</var>, run these steps:
<p>To <dfn lt="abort the fetch() call" export id=abort-fetch-algorithm>abort a fetch() call</dfn> with a
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved
<var>promise</var>, <var>request</var>, <var>responseObject</var>, and an <var>error</var>, run these steps:

<ol>
<li><p>Let <var>error</var> be an "<code><a exception>AbortError</a></code>" {{DOMException}}.

<li>
<p><a for=/>Reject</a> <var>promise</var> with <var>error</var>.

Expand Down Expand Up @@ -8411,6 +8440,7 @@ Moritz Kneilmann,
Ms2ger,
Nico Schlömer,
Nicolás Peña Moreno,
Nidhi Jaju,
Nikhil Marathe,
Nikki Bee,
Nikunj Mehta,
Expand Down