Skip to content

Commit 6128ca3

Browse files
authored
Refactor scheme fetch
No longer use "abort when" for blob: URLs as all the handling is synchronous anyway. Capture aborting that might have happened between fetch going in parallel and scheme fetch getting invoked for all schemes.
1 parent b56692a commit 6128ca3

File tree

1 file changed

+45
-49
lines changed

1 file changed

+45
-49
lines changed

fetch.bs

Lines changed: 45 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4615,32 +4615,33 @@ steps:
46154615
<h3 id=scheme-fetch oldids=basic-fetch>Scheme fetch</h3>
46164616

46174617
<p>To <dfn id=concept-scheme-fetch oldids=concept-basic-fetch>scheme fetch</dfn>, given a
4618-
<a for=/>fetch params</a> <var>fetchParams</var>: let <var>request</var> be <var>fetchParams</var>'s
4619-
<a for="fetch params">request</a>, switch on <var>request</var>'s <a for=request>current URL</a>'s
4620-
<a for=url>scheme</a>, and run the associated steps:
4618+
<a for=/>fetch params</a> <var>fetchParams</var>:
46214619

4622-
<dl class=switch>
4623-
<dt>"<code>about</code>"
4624-
<dd>
4625-
<p>If <var>request</var>'s <a for=request>current URL</a>'s <a for=url>path</a> is the string
4626-
"<code>blank</code>", then return a new <a for=/>response</a> whose
4627-
<a for=response>status message</a> is `<code>OK</code>`, <a for=response>header list</a> is «
4628-
(`<code>Content-Type</code>`, `<code>text/html;charset=utf-8</code>`) », and
4629-
<a for=response>body</a> is the empty byte sequence <a for="byte sequence">as a body</a>.
4620+
<ol>
4621+
<li><p>If <var>fetchParams</var> is <a for="fetch params">canceled</a>, then return the
4622+
<a for=/>appropriate network error</a> for <var>fetchParams</var>.
46304623

4631-
<p>Otherwise, return a <a>network error</a>.
4624+
<li><p>Let <var>request</var> be <var>fetchParams</var>'s <a for="fetch params">request</a>.
46324625

4633-
<p class="note no-backref"><a for=/>URLs</a> such as "<code>about:config</code>" are handled
4634-
during <a lt=navigate>navigation</a> and result in a <a>network error</a> in the context of
4635-
<a lt=fetch for=/>fetching</a>.
4626+
<li>
4627+
<p>Switch on <var>request</var>'s <a for=request>current URL</a>'s <a for=url>scheme</a> and run
4628+
the associated steps:
46364629

4637-
<dt>"<code>blob</code>"
4638-
<dd>
4639-
<ol>
4640-
<li>
4641-
<p>Run these steps, but <a>abort when</a> <var>fetchParams</var> is
4642-
<a for="fetch params">canceled</a>:
4630+
<dl class=switch>
4631+
<dt>"<code>about</code>"
4632+
<dd>
4633+
<p>If <var>request</var>'s <a for=request>current URL</a>'s <a for=url>path</a> is the string
4634+
"<code>blank</code>", then return a new <a for=/>response</a> whose
4635+
<a for=response>status message</a> is `<code>OK</code>`, <a for=response>header list</a> is «
4636+
(`<code>Content-Type</code>`, `<code>text/html;charset=utf-8</code>`) », and
4637+
<a for=response>body</a> is the empty byte sequence <a for="byte sequence">as a body</a>.
46434638

4639+
<p class=note><a for=/>URLs</a> such as "<code>about:config</code>" are handled during
4640+
<a lt=navigate>navigation</a> and result in a <a>network error</a> in the context of
4641+
<a lt=fetch for=/>fetching</a>.
4642+
4643+
<dt>"<code>blob</code>"
4644+
<dd>
46444645
<ol>
46454646
<li><p>Let <var>blobURLEntry</var> be <var>request</var>'s <a for=request>current URL</a>'s
46464647
<a for=url>blob URL entry</a>.
@@ -4671,41 +4672,36 @@ steps:
46714672
<a for=response>body</a> is <var>body</var>.
46724673
</ol>
46734674

4674-
<li><p><a>If aborted</a>, then return the <a for=/>appropriate network error</a> for
4675-
<var>fetchParams</var>.
4676-
</ol>
4677-
4678-
<dt>"<code>data</code>"
4679-
<dd>
4680-
<ol>
4681-
<li><p>Let <var>dataURLStruct</var> be the result of running the
4682-
<a><code>data:</code> URL processor</a> on <var>request</var>'s <a for=request>current URL</a>.
4675+
<dt>"<code>data</code>"
4676+
<dd>
4677+
<ol>
4678+
<li><p>Let <var>dataURLStruct</var> be the result of running the
4679+
<a><code>data:</code> URL processor</a> on <var>request</var>'s <a for=request>current URL</a>.
46834680

4684-
<li><p>If <var>dataURLStruct</var> is failure, then return a <a>network error</a>.
4681+
<li><p>If <var>dataURLStruct</var> is failure, then return a <a>network error</a>.
46854682

4686-
<li><p>Let <var>mimeType</var> be <var>dataURLStruct</var>'s
4687-
<a for="data: URL struct">MIME type</a>, <a lt="serialize a MIME type to bytes">serialized</a>.
4683+
<li><p>Let <var>mimeType</var> be <var>dataURLStruct</var>'s
4684+
<a for="data: URL struct">MIME type</a>, <a lt="serialize a MIME type to bytes">serialized</a>.
46884685

4689-
<li><p>Return a new <a for=/>response</a> whose <a for=response>status message</a> is
4690-
`<code>OK</code>`, <a for=response>header list</a> is « (`<code>Content-Type</code>`,
4691-
<var>mimeType</var>) », and <a for=response>body</a> is <var>dataURLStruct</var>'s
4692-
<a for="data: URL struct">body</a> <a for="byte sequence">as a body</a>.
4693-
</ol>
4686+
<li><p>Return a new <a for=/>response</a> whose <a for=response>status message</a> is
4687+
`<code>OK</code>`, <a for=response>header list</a> is « (`<code>Content-Type</code>`,
4688+
<var>mimeType</var>) », and <a for=response>body</a> is <var>dataURLStruct</var>'s
4689+
<a for="data: URL struct">body</a> <a for="byte sequence">as a body</a>.
4690+
</ol>
46944691

4695-
<dt>"<code>file</code>"
4696-
<dd>
4697-
<p>For now, unfortunate as it is, <code>file</code> <a for=/>URLs</a> are left as an exercise for
4698-
the reader.
4692+
<dt>"<code>file</code>"
4693+
<dd>
4694+
<p>For now, unfortunate as it is, <code>file:</code> <a for=/>URLs</a> are left as an exercise
4695+
for the reader.
46994696

4700-
<p>When in doubt, return a <a>network error</a>.
4697+
<p>When in doubt, return a <a>network error</a>.
47014698

4702-
<dt><a>HTTP(S) scheme</a>
4703-
<dd>
4704-
<p>Return the result of running <a>HTTP fetch</a> given <var>fetchParams</var>.
4699+
<dt><a>HTTP(S) scheme</a>
4700+
<dd><p>Return the result of running <a>HTTP fetch</a> given <var>fetchParams</var>.
4701+
</dl>
47054702

4706-
<dt>Otherwise
4707-
<dd><p>Return a <a>network error</a>.
4708-
</dl>
4703+
<li><p>Return a <a for=/>network error</a>.
4704+
</ol>
47094705

47104706

47114707
<h3 id=http-fetch>HTTP fetch</h3>

0 commit comments

Comments
 (0)