@@ -4199,9 +4199,7 @@ steps:
4199
4199
<p> <a>If aborted</a> , then:
4200
4200
4201
4201
<ol>
4202
- <li><p> Let <var> aborted</var> be the termination's aborted flag.
4203
-
4204
- <li><p> If <var> aborted</var> is set, then return an <a>aborted network error</a> .
4202
+ <li><p> If the termination's aborted flag is set, then return an <a>aborted network error</a> .
4205
4203
4206
4204
<li><p> Return a <a>network error</a> .
4207
4205
</ol>
@@ -4937,9 +4935,7 @@ steps. They return a <a for=/>response</a>.
4937
4935
<p> <a>If aborted</a> , then:
4938
4936
4939
4937
<ol>
4940
- <li><p> Let <var> aborted</var> be the termination's aborted flag.
4941
-
4942
- <li><p> If <var> aborted</var> is set, then return an <a>aborted network error</a> .
4938
+ <li><p> If the termination's aborted flag is set, then return an <a>aborted network error</a> .
4943
4939
4944
4940
<li><p> Return a <a>network error</a> .
4945
4941
</ol>
@@ -5039,9 +5035,7 @@ steps. They return a <a for=/>response</a>.
5039
5035
<p> If the ongoing fetch is <a for=fetch>terminated</a> , then:
5040
5036
5041
5037
<ol>
5042
- <li><p> Let <var> aborted</var> be the termination's aborted flag.
5043
-
5044
- <li><p> If <var> aborted</var> is set, then return an <a>aborted network error</a> .
5038
+ <li><p> If the termination's aborted flag is set, then return an <a>aborted network error</a> .
5045
5039
5046
5040
<li><p> Return a <a>network error</a> .
5047
5041
</ol>
@@ -5075,9 +5069,7 @@ steps. They return a <a for=/>response</a>.
5075
5069
<p> If the ongoing fetch is <a for=fetch>terminated</a> , then:
5076
5070
5077
5071
<ol>
5078
- <li><p> Let <var> aborted</var> be the termination's aborted flag.
5079
-
5080
- <li><p> If <var> aborted</var> is set, then return an <a>aborted network error</a> .
5072
+ <li><p> If the termination's aborted flag is set, then return an <a>aborted network error</a> .
5081
5073
5082
5074
<li><p> Return a <a>network error</a> .
5083
5075
</ol>
@@ -5113,9 +5105,7 @@ steps. They return a <a for=/>response</a>.
5113
5105
<p> If the ongoing fetch is <a for=fetch>terminated</a> , then:
5114
5106
5115
5107
<ol>
5116
- <li><p> Let <var> aborted</var> be the termination's aborted flag.
5117
-
5118
- <li><p> If <var> aborted</var> is set, then return an <a>aborted network error</a> .
5108
+ <li><p> If the termination's aborted flag is set, then return an <a>aborted network error</a> .
5119
5109
5120
5110
<li><p> Return a <a>network error</a> .
5121
5111
</ol>
@@ -5320,11 +5310,9 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
5320
5310
<p> <a>If aborted</a> , then:
5321
5311
5322
5312
<ol>
5323
- <li><p> Let <var> aborted</var> be the termination's aborted flag.
5324
-
5325
5313
<li><p> If <var> connection</var> uses HTTP/2, then transmit an <code> RST_STREAM</code> frame.
5326
5314
5327
- <li><p> If <var> aborted</var> is set, then return an <a>aborted network error</a> .
5315
+ <li><p> If the termination's aborted flag is set, then return an <a>aborted network error</a> .
5328
5316
5329
5317
<li><p> Return a <a>network error</a> .
5330
5318
</ol>
@@ -5378,9 +5366,7 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
5378
5366
<p> <a>If aborted</a> , then:
5379
5367
5380
5368
<ol>
5381
- <li><p> Let <var> aborted</var> be the termination's aborted flag.
5382
-
5383
- <li><p> If <var> aborted</var> is set, then set <var> response</var> 's
5369
+ <li><p> If the termination's aborted flag is set, then set <var> response</var> 's
5384
5370
<a for=response>aborted flag</a> .
5385
5371
5386
5372
<li><p> Return <var> response</var> .
@@ -5423,20 +5409,28 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
5423
5409
<li><p> If <var> bytes</var> is failure, then <a lt=terminated for=fetch>terminate</a> the
5424
5410
ongoing fetch.
5425
5411
5426
- <li><p> <a for=ReadableStream>Enqueue</a> a {{Uint8Array}} wrapping an {{ArrayBuffer}}
5427
- containing <var> bytes </var> into <var> stream </var> .
5412
+ <li>
5413
+ <p> Let <var> handleResponseBytes </var> be these steps:
5428
5414
5429
- <li><p> If <var> stream</var> is <a for=ReadableStream>errored</a> , then
5430
- <a lt=terminated for=fetch>terminate</a> the ongoing fetch.
5415
+ <ol>
5416
+ <li><p> <a for=ReadableStream>Enqueue</a> a {{Uint8Array}} wrapping an {{ArrayBuffer}}
5417
+ containing <var> bytes</var> into <var> stream</var> .
5431
5418
5432
- <li><p> If <var> stream</var> doesn't <a for=ReadableStream>need more data</a> ask the user
5433
- agent to <a for=fetch>suspend</a> the ongoing fetch.
5419
+ <li><p> If <var> stream</var> is <a for=ReadableStream>errored</a> , then
5420
+ <a lt=terminated for=fetch>terminate</a> the ongoing fetch.
5421
+
5422
+ <li><p> If <var> stream</var> doesn't <a for=ReadableStream>need more data</a> ask the user
5423
+ agent to <a for=fetch>suspend</a> the ongoing fetch.
5424
+ </ol>
5425
+
5426
+ <li><p> Otherwise, if the bytes transmission for <var> response</var> 's message body is done
5427
+ normally and <var> stream</var> is <a for=ReadableStream>readable</a> , then
5428
+ <a for=ReadableStream>close</a> <var> stream</var> , <a for=/>finalize response</a> for
5429
+ <var> fetchParams</var> and <var> response</var> .
5434
5430
</ol>
5435
5431
5436
- <li><p> Otherwise, if the bytes transmission for <var> response</var> 's message body is done
5437
- normally and <var> stream</var> is <a for=ReadableStream>readable</a> , then
5438
- <a for=ReadableStream>close</a> <var> stream</var> , <a for=/>finalize response</a> for
5439
- <var> fetchParams</var> and <var> response</var> , and abort these in-parallel steps.
5432
+ <li><p> <a>Queue a fetch task</a> given <var> handleResponseBytes</var> and
5433
+ <var> fetchParams</var> 's <a for="fetch params">task destination</a> .
5440
5434
</ol>
5441
5435
</ol>
5442
5436
@@ -5446,22 +5440,6 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
5446
5440
<ol>
5447
5441
<li> <a for=/>Finalize response</a> for <var> fetchParams</var> and <var> response</var> .
5448
5442
5449
- <li><p> Let <var> aborted</var> be the termination's aborted flag.
5450
-
5451
- <li>
5452
- <p> If <var> aborted</var> is set, then:
5453
-
5454
- <ol>
5455
- <li><p> Set <var> response</var> 's <a for=response>aborted flag</a> .
5456
-
5457
- <li><p> If <var> stream</var> is <a for=ReadableStream>readable</a> ,
5458
- <a for=ReadableStream>error</a> <var> stream</var> with an
5459
- "<code> <a exception>AbortError</a> </code> " {{DOMException}} .
5460
- </ol>
5461
-
5462
- <li><p> Otherwise, if <var> stream</var> is <a for=ReadableStream>readable</a> ,
5463
- <a for=ReadableStream>error</a> <var> stream</var> with a {{TypeError}} .
5464
-
5465
5443
<li><p> If <var> connection</var> uses HTTP/2, then transmit an <code> RST_STREAM</code> frame.
5466
5444
5467
5445
<li>
@@ -5471,6 +5449,28 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
5471
5449
<p class=note> For instance, the user agent could keep the connection open if it knows there's
5472
5450
only a few bytes of transfer remaining on a reusable connection. In this case it could be
5473
5451
worse to close the connection and go through the handshake process again for the next fetch.
5452
+
5453
+ <li>
5454
+ <p> Let <var> handleResponseError</var> be these steps:
5455
+
5456
+ <ol>
5457
+ <li>
5458
+ <p> If the termination's aborted flag is set, then:
5459
+
5460
+ <ol>
5461
+ <li><p> Set <var> response</var> 's <a for=response>aborted flag</a> .
5462
+
5463
+ <li><p> If <var> stream</var> is <a for=ReadableStream>readable</a> ,
5464
+ <a for=ReadableStream>error</a> <var> stream</var> with an
5465
+ "<code> <a exception>AbortError</a> </code> " {{DOMException}} .
5466
+ </ol>
5467
+
5468
+ <li><p> Otherwise, if <var> stream</var> is <a for=ReadableStream>readable</a> ,
5469
+ <a for=ReadableStream>error</a> <var> stream</var> with a {{TypeError}} .
5470
+ </ol>
5471
+
5472
+ <li><p> <a>Queue a fetch task</a> given <var> handleResponseError</var> and
5473
+ <var> fetchParams</var> 's <a for="fetch params">task destination</a> .
5474
5474
</ol>
5475
5475
</ol>
5476
5476
0 commit comments