Skip to content

Commit bec03e6

Browse files
dlrobertsonannevk
andauthored
Editorial: various nits and more <div algorithm> wrappers
- Fix unused variables in report timing and extract full timing info. - Fix an unclosed tag in extract full timing info. - Use non-null more consistently. Related to #1526. Fixes #1566. Co-authored-by: Anne van Kesteren <[email protected]>
1 parent f6e9b8d commit bec03e6

File tree

1 file changed

+41
-22
lines changed

1 file changed

+41
-22
lines changed

fetch.bs

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -237,36 +237,45 @@ lt="authentication entry">authentication entries</a> (for HTTP authentication).
237237
<dd>Null or an algorithm accepting nothing.
238238
</dl>
239239

240+
<div algorithm>
240241
<p>To <dfn export for="fetch controller" id="finalize-and-report-timing">report timing</dfn> for a
241242
<a>fetch controller</a> <var>controller</var> given a <a for=/>global object</a> <var>global</var>:
242243

243244
<ol>
244-
<li><p><a for=/>Assert</a>: <a>this</a>'s <a for="fetch controller">report timing steps</a> is not
245-
null.
245+
<li><p><a for=/>Assert</a>: <var>controller</var>'s
246+
<a for="fetch controller">report timing steps</a> is non-null.
246247

247-
<li><p>Call <a>this</a>'s <a for="fetch controller">report timing steps</a> with <var>global</var>.
248+
<li><p>Call <var>controller</var>'s <a for="fetch controller">report timing steps</a> with
249+
<var>global</var>.
248250
</ol>
251+
</div>
249252

253+
<div algorithm>
250254
<p>To <dfn export for="fetch controller">process the next manual redirect</dfn> for a
251255
<a>fetch controller</a> <var>controller</var>:
252256

253257
<ol>
254258
<li><p><a for=/>Assert</a>: <var>controller</var>'s
255-
<a for="fetch controller">next manual redirect steps</a> are not null.
259+
<a for="fetch controller">next manual redirect steps</a> is non-null.
256260

257261
<li><p>Call <var>controller</var>'s <a for="fetch controller">next manual redirect steps</a>.
258262
</ol>
263+
</div>
259264

260-
<p>To <dfn export for="fetch controller" id="extract-full-timing-info">extract full timing info</a>
265+
<div algorithm>
266+
<p>To
267+
<dfn export for="fetch controller" id="extract-full-timing-info">extract full timing info</dfn>
261268
given a <a>fetch controller</a> <var>controller</var>:
262269

263270
<ol>
264-
<li><p><a for=/>Assert</a>: <a>this</a>'s <a for="fetch controller">full timing info</a> is not
265-
null.
271+
<li><p><a for=/>Assert</a>: <var>controller</var>'s <a for="fetch controller">full timing info</a>
272+
is non-null.
266273

267-
<li><p>Return <a>this</a>'s <a for="fetch controller">full timing info</a>.
274+
<li><p>Return <var>controller</var>'s <a for="fetch controller">full timing info</a>.
268275
</ol>
276+
</div>
269277

278+
<div algorithm>
270279
<p>To <dfn export for="fetch controller">abort</dfn> a <a for=/>fetch controller</a>
271280
<var>controller</var> with an optional <var>error</var>:
272281

@@ -284,7 +293,9 @@ given a <a>fetch controller</a> <var>controller</var>:
284293
<li><p>Set <var>controller</var>'s <a for="fetch controller">serialized abort reason</a> to
285294
<var>serializedError</var>.
286295
</ol>
296+
</div>
287297

298+
<div algorithm>
288299
<p>To <dfn>deserialize a serialized abort reason</dfn>, given null or a <a>Record</a>
289300
<var>abortReason</var> and a <a>realm</a> <var>realm</var>:
290301

@@ -299,10 +310,13 @@ given a <a>fetch controller</a> <var>controller</var>:
299310

300311
<li><p>Return <var>deserializedError</var>.
301312
</ol>
313+
</div>
302314

315+
<div algorithm>
303316
<p>To <dfn export for="fetch controller">terminate</dfn> a <a for=/>fetch controller</a>
304317
<var>controller</var>, set <var>controller</var>'s <a for="fetch controller">state</a> to
305318
"<code>terminated</code>".
319+
</div>
306320

307321
<p>A <a for=/>fetch params</a> <var>fetchParams</var> is <dfn for="fetch params">aborted</dfn> if
308322
its <a for="fetch params">controller</a>'s <a for="fetch controller">state</a> is
@@ -348,13 +362,16 @@ following <a for=struct>items</a>: [[RESOURCE-TIMING]] [[NAVIGATION-TIMING]]
348362
<dd>A number.
349363
</dl>
350364

365+
<div algorithm>
351366
<p>To
352367
<dfn export lt="create an opaque timing info|creating an opaque timing info">create an opaque timing info</dfn>,
353368
given a <a for=/>fetch timing info</a> <var>timingInfo</var>, return a new
354369
<a for=/>fetch timing info</a> whose <a for="fetch timing info">start time</a> and
355370
<a for="fetch timing info">post-redirect start time</a> are <var>timingInfo</var>'s
356371
<a for="fetch timing info">start time</a>.
372+
</div>
357373

374+
<div algorithm>
358375
<p>To <dfn>queue a fetch task</dfn>, given an algorithm <var>algorithm</var>, a
359376
<a for=/>global object</a> or a <a for=/>parallel queue</a> <var>taskDestination</var>, run these
360377
steps:
@@ -367,6 +384,7 @@ steps:
367384
<li><p>Otherwise, <a>queue a global task</a> on the <a>networking task source</a> with
368385
<var>taskDestination</var> and <var>algorithm</var>.
369386
</ol>
387+
</div>
370388

371389
<hr>
372390

@@ -419,6 +437,7 @@ preferred. Unlike <a>ASCII whitespace</a> this excludes U+000C FF.
419437
<p>An <dfn export>HTTP whitespace byte</dfn> is an <a>HTTP newline byte</a> or
420438
<a>HTTP tab or space byte</a>.
421439

440+
<div algorithm>
422441
<p>To
423442
<dfn export lt="collect an HTTP quoted string|collecting an HTTP quoted string">collect an HTTP quoted string</dfn>
424443
from a <a for=/>string</a> <var>input</var>, given a <a>position variable</a> <var>position</var>
@@ -502,6 +521,7 @@ and optionally an <var>extract-value flag</var>, run these steps:
502521
</table>
503522
<p class=tablenote><small>The <a>position variable</a> always starts at 0 in these examples.</small>
504523
</div>
524+
</div>
505525

506526

507527
<h4 id=methods>Methods</h4>
@@ -850,9 +870,8 @@ directly. Use <a for="header list">get, decode, and split</a> instead.
850870
</div>
851871

852872
<div algorithm>
853-
<p>To
854-
<dfn export for="header list" id=concept-header-list-sort-and-combine>sort and combine</dfn>
855-
a <a for=/>header list</a> <var>list</var>, run these steps:
873+
<p>To <dfn export for="header list" id=concept-header-list-sort-and-combine>sort and combine</dfn> a
874+
<a for=/>header list</a> <var>list</var>:
856875

857876
<ol>
858877
<li><p>Let <var>headers</var> be an empty <a for=/>list</a> of <a for=/>headers</a> with the key
@@ -869,7 +888,7 @@ a <a for=/>header list</a> <var>list</var>, run these steps:
869888
<li><p>Let <var>value</var> be the result of <a for="header list">getting</a> <var>name</var>
870889
from <var>list</var>.
871890

872-
<li><p>Assert: <var>value</var> is not null.
891+
<li><p>Assert: <var>value</var> is non-null.
873892

874893
<li><p><a for=list>Append</a> (<var>name</var>, <var>value</var>) to <var>headers</var>.
875894
</ol>
@@ -2639,7 +2658,7 @@ functionality.
26392658
<p>When a <a for=fetch>fetch group</a> is
26402659
<dfn export for="fetch group" id=concept-fetch-group-terminate>terminated</dfn>, for each associated
26412660
<a for="fetch group">fetch record</a> whose <a for="fetch group">fetch record</a>'s
2642-
<a for="fetch record">controller</a> is not null, and whose <a for="fetch record">request</a>'s
2661+
<a for="fetch record">controller</a> is non-null, and whose <a for="fetch record">request</a>'s
26432662
<a>done flag</a> is unset or <a for=request>keepalive</a> is false,
26442663
<a for="fetch controller">terminate</a> the <a for="fetch group">fetch record</a>'s
26452664
<a for="fetch record">controller</a>.
@@ -4171,7 +4190,7 @@ the request.
41714190
<li><p><var>request</var>'s <a for=request>mode</a> is "<code>same-origin</code>",
41724191
"<code>cors</code>", or "<code>no-cors</code>"
41734192

4174-
<li><p><var>request</var>'s <a for=request>window</a> is not null
4193+
<li><p><var>request</var>'s <a for=request>window</a> is non-null
41754194

41764195
<li><p><var>request</var>'s <a for=request>method</a> is `<code>GET</code>`
41774196

@@ -4348,7 +4367,7 @@ steps:
43484367
corresponding to the first matching statement:
43494368

43504369
<dl class=switch>
4351-
<dt><var>fetchParams</var>'s <a for="fetch params">preloaded response candidate</a> is not null
4370+
<dt><var>fetchParams</var>'s <a for="fetch params">preloaded response candidate</a> is non-null
43524371
<dd>
43534372
<ol>
43544373
<li><p>Wait until <var>fetchParams</var>'s
@@ -4453,7 +4472,7 @@ steps:
44534472
<a for=response>header list</a>.
44544473

44554474
<li>
4456-
<p>Otherwise, if <var>headerNames</var> is not null or failure, then set <var>response</var>'s
4475+
<p>Otherwise, if <var>headerNames</var> is non-null or failure, then set <var>response</var>'s
44574476
<a for=response>CORS-exposed header-name list</a> to <var>headerNames</var>.
44584477

44594478
<p class="note">One of the <var>headerNames</var> can still be `<code>*</code>` at this point,
@@ -4637,7 +4656,7 @@ steps:
46374656
<var>response</var>'s <a for=response>status</a>.
46384657

46394658
<li><p>If <var>fetchParams</var>'s <a for="fetch params">request</a>'s
4640-
<a for=request>initiator type</a> is not null, then
4659+
<a for=request>initiator type</a> is non-null, then
46414660
<a for=/>mark resource timing</a> given <var>timingInfo</var>, <var>request</var>'s
46424661
<a for=request>URL</a>, <a for="fetch params">request</a>'s
46434662
<a for=request>initiator type</a>, <var>global</var>, <var>cacheState</var>,
@@ -4878,7 +4897,7 @@ these steps:
48784897
<a for="fetch params">cross-origin isolated capability</a>. [[!HTML]] [[!SW]]
48794898

48804899
<li>
4881-
<p>If <var>response</var> is not null, then:
4900+
<p>If <var>response</var> is non-null, then:
48824901

48834902
<ol>
48844903
<li><p>Set <var>fetchParams</var>'s <a for="fetch params">timing info</a>'s
@@ -4993,7 +5012,7 @@ these steps:
49935012
<ol>
49945013
<li>
49955014
<p>If <var>actualResponse</var>'s <a for=response>status</a> is not 303, <var>request</var>'s
4996-
<a for=request>body</a> is not null, and the <a>connection</a> uses HTTP/2, then user agents
5015+
<a for=request>body</a> is non-null, and the <a>connection</a> uses HTTP/2, then user agents
49975016
may, and are even encouraged to, transmit an <code>RST_STREAM</code> frame.
49985017

49995018
<p class=note>303 is excluded as certain communities ascribe special status to it.
@@ -7472,7 +7491,7 @@ constructor steps are:
74727491
<li><p>Set <a>this</a>'s <a for=Request>signal</a> to a <a for=/>new</a> {{AbortSignal}} object
74737492
with <a>this</a>'s <a>relevant Realm</a>.
74747493

7475-
<li><p>If <var>signal</var> is not null, then make <a>this</a>'s <a for=Request>signal</a>
7494+
<li><p>If <var>signal</var> is non-null, then make <a>this</a>'s <a for=Request>signal</a>
74767495
<a for=AbortSignal>follow</a> <var>signal</var>.
74777496

74787497
<li><p>Set <a>this</a>'s <a for=Request>headers</a> to a <a for=/>new</a> {{Headers}} object with
@@ -8352,8 +8371,8 @@ in a <a for=/>parallel queue</a> if <a for=fetch><i>useParallelQueue</i></a> is
83528371
<p>If the <a for=/>request</a>'s <a for=request>mode</a> is "<code>navigate</code>" and its
83538372
<a for=request>redirect mode</a> is "<code>manual</code>", then callers need to follow a very
83548373
specific flow with this algorithm to get the intended behavior. They should compute the
8355-
appropriate <a for=response>location URL</a>, and if it is not null or a failure, then they
8356-
should call <a for="fetch controller">process the next manual redirect</a>. This will result in
8374+
appropriate <a for=response>location URL</a>, and if it is non-null or failure, then they should
8375+
call <a for="fetch controller">process the next manual redirect</a>. This will result in
83578376
<a for=fetch><i>processResponse</i></a> being called again, with the next <a for=/>response</a>
83588377
in the redirect chain.
83598378

0 commit comments

Comments
 (0)