Skip to content

Commit

Permalink
Ensure we always have fetchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
noamr committed Sep 26, 2021
1 parent ad89094 commit f090669
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -4058,8 +4058,8 @@ steps:

<ol>
<li><p>Let <var>processBodyError</var> be this step: run <a>fetch finale</a> given
<var>fetchParams</var> and a <a>network error</a>.

<var>fetchParams</var> and the result of <a for="network error">creating</a> a
<a>network error</a> given <var>fetchParams</var>.

<li><p>If <var>request</var>'s <a for=request>response tainting</a> is "<code>opaque</code>",
<var>response</var> is a <a>network error</a>, or <var>response</var>'s <a for=response>body</a>
Expand Down Expand Up @@ -4414,7 +4414,8 @@ these steps:
given <var>request</var>.

<li><p>If <var>preflightResponse</var> is a <a>network error</a>, then return
<var>preflightResponse</var>.
the result of <a for="network error">creating</a> a <a>network error</a> given
<var>fetchParams</var>.
</ol>

<p class="note no-backref">This step checks the
Expand All @@ -4437,8 +4438,9 @@ these steps:

<li>
<p>If <var>request</var>'s <a for=request>response tainting</a> is "<code>cors</code>" and a
<a>CORS check</a> for <var>request</var> and <var>response</var> returns failure, then return a
<a>network error</a>.
<a>CORS check</a> for <var>request</var> and <var>response</var> returns failure, then return
the result of <a for="network error">creating</a> a <a>network error</a> given
<var>fetchParams</var>.

<p class="note no-backref">As the <a>CORS check</a> is not to be applied to
<a for=/>responses</a> whose <a for=response>status</a> is 304 or 407, or <a for=/>responses</a>
Expand All @@ -4453,8 +4455,9 @@ these steps:
<a for=response>type</a> is "<code>opaque</code>", and the
<a>cross-origin resource policy check</a> with <var>request</var>'s <a for=request>origin</a>,
<var>request</var>'s <a for=request>client</a>, <var>request</var>'s
<a for=request>destination</a>, and <var>actualResponse</var> returns <b>blocked</b>, then return
a <a>network error</a>.
<a for=request>destination</a>, and <var>actualResponse</var> returns <b>blocked</b>, then
the result of <a for="network error">creating</a> a <a>network error</a> given
<var>fetchParams</var>.

<p class=note>The <a>cross-origin resource policy check</a> runs for responses coming from the
network and responses coming from the service worker. This is different from the
Expand All @@ -4478,7 +4481,8 @@ these steps:

<dl class=switch>
<dt>"<code>error</code>"
<dd><p>Set <var>response</var> to a <a>network error</a>.
<dd><p>Set <var>response</var> to the result of <a for="network error">creating</a> a
<a>network error</a> given <var>fetchParams</var>.

<dt>"<code>manual</code>"
<dd><p>Set <var>response</var> to an <a>opaque-redirect filtered response</a> whose
Expand Down Expand Up @@ -5641,8 +5645,7 @@ number of these <a lt="CORS-preflight fetch">fetches</a>.
<a for=response>header list</a>.

<li><p>If either <var>methods</var> or <var>headerNames</var> is failure,
return the result of <a for="network error">creating</a> a <a>network error</a> given
<var>fetchParams</var>.
return a <a>network error</a>.

<li>
<p>If <var>methods</var> is null and <var>request</var>'s <a>use-CORS-preflight flag</a>
Expand All @@ -5656,22 +5659,19 @@ number of these <a lt="CORS-preflight fetch">fetches</a>.
<li><p>If <var>request</var>'s <a for=request>method</a> is not in <var>methods</var>,
<var>request</var>'s <a for=request>method</a> is not a <a>CORS-safelisted method</a>, and
<var>request</var>'s <a for=request>credentials mode</a> is "<code>include</code>" or
<var>methods</var> does not contain `<code>*</code>`, then return the result of
<a for="network error">creating</a> a <a>network error</a> given <var>fetchParams</var>.
<var>methods</var> does not contain `<code>*</code>`, then return a <a>network error</a>.

<li><p>If one of <var>request</var>'s <a for=request>header list</a>'s
<a lt=name for=header>names</a> is a <a>CORS non-wildcard request-header name</a> and is not a
<a>byte-case-insensitive</a> match for an <a for=list>item</a> in <var>headerNames</var>, then
return the result of <a for="network error">creating</a> a <a>network error</a> given
<var>fetchParams</var>.
return a <a>network error</a>.

<li><p><a for=list>For each</a> <var>unsafeName</var> in the
<a>CORS-unsafe request-header names</a> with <var>request</var>'s
<a for=request>header list</a>, if <var>unsafeName</var> is not a <a>byte-case-insensitive</a>
match for an <a for=list>item</a> in <var>headerNames</var> and <var>request</var>'s
<a for=request>credentials mode</a> is "<code>include</code>" or <var>headerNames</var> does not
contain `<code>*</code>`, return the result of <a for="network error">creating</a> a
<a>network error</a> given <var>fetchParams</var>.
contain `<code>*</code>`, return a <a>network error</a>.

<li><p>Let <var>max-age</var> be the result of <a>extracting header list values</a> given
`<a http-header><code>Access-Control-Max-Age</code></a>` and <var>response</var>'s
Expand Down Expand Up @@ -5704,8 +5704,7 @@ number of these <a lt="CORS-preflight fetch">fetches</a>.
<li><p>Return <var>response</var>.
</ol>

<li><p>Otherwise, return the result of <a for="network error">creating</a> a <a>network error</a>
given <var>fetchParams</var>.
<li><p>Otherwise, return a <a>network error</a>.
</ol>


Expand Down Expand Up @@ -7328,8 +7327,7 @@ constructor steps are:
</ol>

<p>The static <dfn method for=Response><code>error()</code></dfn> method steps are to return the
result of <a for=Response>creating</a> a {{Response}} object, given the result of
<a for="network error">creating</a> a <a>network error</a> given <var>fetchParams</var>,
result of <a for=Response>creating</a> a {{Response}} object, a <a>network error</a>,
"<code>immutable</code>", and <a>this</a>'s <a>relevant Realm</a>.

<p>The static
Expand Down Expand Up @@ -7485,7 +7483,7 @@ method steps are:
<ol>
<li><p><a for=/>Reject</a> <var>p</var> with a {{TypeError}}.

<li><p>Call <var>handleFetchDone</p> with <var>response</var>.
<li><p>Call <var>handleFetchDone</var> with <var>response</var>.

<li><p>terminate these substeps.
</ol>
Expand Down

0 comments on commit f090669

Please sign in to comment.