Skip to content

Commit

Permalink
Make sure all responses have a URL list
Browse files Browse the repository at this point in the history
In #146 I tried to let service worker responses that were not synthetic
to keep their url list. However, the way I fixed that regressed url
lists for a number of responses: HTTP cache responses, about URL
responses, etc.

This fix instead tries to keep the old setup and only overwrites the
url list of a response if it’s empty.

Fixes #312.
  • Loading branch information
annevk committed Jun 9, 2016
1 parent 9ca86dd commit df09f7b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
21 changes: 13 additions & 8 deletions Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<p><a class="logo" href="https://whatwg.org/"><img alt="WHATWG" height="100" src="https://resources.whatwg.org/logo-fetch.svg" width="100"></a>
<h1 id="cors">Fetch</h1>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-7-june-2016">Living Standard — Last Updated 7 June 2016</h2>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-9-june-2016">Living Standard — Last Updated 9 June 2016</h2>

<dl>
<dt>Participate:
Expand Down Expand Up @@ -2555,6 +2555,18 @@ <h3 id="main-fetch"><span class="secno">5.1 </span>Main fetch</h3>
<a href="#concept-network-error" title="concept-network-error">network error</a>, and <var>response</var>'s
<a href="#concept-internal-response" title="concept-internal-response">internal response</a> otherwise.

<li>
<p>If <var>internalResponse</var>'s <a href="#concept-response-url-list" title="concept-response-url-list">url list</a> is
empty, then set it to a copy of <var>request</var>'s
<a href="#concept-request-url-list" title="concept-request-url-list">url list</a>.

<p class="note">A <a href="#concept-response" title="concept-response">response</a>'s
<a href="#concept-response-url-list" title="concept-response-url-list">url list</a> will typically be empty at this point,
unless it came from a service worker, in which case it will only be empty if it was created
through <a href="#dom-response"><code title="dom-response">new Response()</code></a>.
<!-- If you are ever tempted to move this around, carefully consider responses from about URLs,
blob URLs, service workers, HTTP cache, HTTP network, etc. -->

<li>
<p>If <var>response</var> is not a <a href="#concept-network-error" title="concept-network-error">network error</a> and any
of the following algorithms returns <b title="">blocked</b>, then set <var>response</var> and
Expand Down Expand Up @@ -2837,10 +2849,6 @@ <h3 id="http-fetch"><span class="secno">5.3 </span>HTTP fetch</h3>
<a href="#concept-response-url-list" title="concept-response-url-list">url list</a> has more than one item.
</ul>

<li><p>If <var>actualResponse</var>'s <a href="#concept-response-url-list" title="concept-response-url-list">url list</a> is
empty, set it to a copy of <var>request</var>'s
<a href="#concept-request-url-list" title="concept-request-url-list">url list</a>.

<li><p>Execute
<a href="https://w3c.github.io/webappsec-csp/#set-response-csp-list">set <var>response</var>'s CSP list</a>
on <var>actualResponse</var>. <a href="#refsCSP">[CSP]</a>
Expand Down Expand Up @@ -3539,9 +3547,6 @@ <h3 id="http-network-fetch"><span class="secno">5.6 </span>HTTP-network fetch</h
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1030660">bug 1030660</a> looks
into whether this quirk can be removed.

<li><p>Set <var>response</var>'s <a href="#concept-response-url-list" title="concept-response-url-list">url list</a> to a copy of
<var>request</var>'s <a href="#concept-request-url-list" title="concept-request-url-list">url list</a>.

<li><p>Execute
<a href="https://w3c.github.io/webappsec-csp/#set-response-csp-list">set <var>response</var>'s CSP list</a>
on <var>response</var>. <a href="#refsCSP">[CSP]</a>
Expand Down
19 changes: 12 additions & 7 deletions Overview.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -2483,6 +2483,18 @@ <h3>Main fetch</h3>
<span title=concept-network-error>network error</span>, and <var>response</var>'s
<span title=concept-internal-response>internal response</span> otherwise.

<li>
<p>If <var>internalResponse</var>'s <span title=concept-response-url-list>url list</span> is
empty, then set it to a copy of <var>request</var>'s
<span title=concept-request-url-list>url list</span>.

<p class="note">A <span title=concept-response>response</span>'s
<span title=concept-response-url-list>url list</span> will typically be empty at this point,
unless it came from a service worker, in which case it will only be empty if it was created
through <code title=dom-response>new Response()</code>.
<!-- If you are ever tempted to move this around, carefully consider responses from about URLs,
blob URLs, service workers, HTTP cache, HTTP network, etc. -->

<li>
<p>If <var>response</var> is not a <span title=concept-network-error>network error</span> and any
of the following algorithms returns <b title>blocked</b>, then set <var>response</var> and
Expand Down Expand Up @@ -2765,10 +2777,6 @@ <h3>HTTP fetch</h3>
<span title=concept-response-url-list>url list</span> has more than one item.
</ul>

<li><p>If <var>actualResponse</var>'s <span title=concept-response-url-list>url list</span> is
empty, set it to a copy of <var>request</var>'s
<span title=concept-request-url-list>url list</span>.

<li><p>Execute
<a href=https://w3c.github.io/webappsec-csp/#set-response-csp-list>set <var>response</var>'s CSP list</a>
on <var>actualResponse</var>. <span data-anolis-ref>CSP</span>
Expand Down Expand Up @@ -3467,9 +3475,6 @@ <h3>HTTP-network fetch</h3>
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1030660">bug 1030660</a> looks
into whether this quirk can be removed.

<li><p>Set <var>response</var>'s <span title=concept-response-url-list>url list</span> to a copy of
<var>request</var>'s <span title=concept-request-url-list>url list</span>.

<li><p>Execute
<a href=https://w3c.github.io/webappsec-csp/#set-response-csp-list>set <var>response</var>'s CSP list</a>
on <var>response</var>. <span data-anolis-ref>CSP</span>
Expand Down

0 comments on commit df09f7b

Please sign in to comment.