Skip to content

Commit

Permalink
Adopt Fetch's extract a location URL
Browse files Browse the repository at this point in the history
Complements whatwg/fetch#1149.
  • Loading branch information
annevk committed Jan 29, 2021
1 parent 48f6b28 commit aefcde2
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2527,9 +2527,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x="concept-response-body" data-x-href="https://fetch.spec.whatwg.org/#concept-response-body">body</dfn></li>
<li><dfn data-x="concept-internal-response" data-x-href="https://fetch.spec.whatwg.org/#concept-internal-response">internal response</dfn></li>
<li><dfn data-x="concept-response-csp-list" data-x-href="https://fetch.spec.whatwg.org/#concept-response-csp-list">CSP list</dfn></li>
<li><dfn data-x="concept-response-location-url" data-x-href="https://fetch.spec.whatwg.org/#concept-response-location-url">location URL</dfn></li>
</ul>
</li>
<li><dfn data-x="concept-response-location-url" data-x-href="https://fetch.spec.whatwg.org/#concept-response-location-url">extract a location URL</dfn></li>
<li>
<dfn data-x="concept-request"
data-x-href="https://fetch.spec.whatwg.org/#concept-request">request</dfn> and its associated:
Expand Down Expand Up @@ -84530,14 +84530,17 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface

<li><p>Let <var>finalSandboxFlags</var> be an empty <span>sandboxing flag set</span>.</p></li>

<li><p>Let <var>locationURL</var> be null.</p></li>

<li><p>Let <var>currentURL</var> be <var>request</var>'s <span
data-x="concept-request-current-url">current URL</span>.</p></li>

<li>
<p>While true:</p>

<ol>
<li><p>Let <var>currentURL</var> be <var>response</var>'s <span
data-x="concept-response-location-url">location URL</span>, if <var>response</var> is not null,
and <var>request</var>'s <span data-x="concept-request-current-url">current URL</span>
otherwise.</p></li>
<li><p>If <var>locationURL</var> is non-null, then set <var>currentURL</var> to
<var>locationURL</var>.</p></li>

<li>
<p>If <var>reservedEnvironment</var> is not null and <var>currentURL</var>'s
Expand Down Expand Up @@ -84669,12 +84672,13 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
embedded content against the parent context, not the navigation source.</p>
</li>

<li><p>Set <var>locationURL</var> to the result of <span data-x="extract a location
URL">extracting a location URL</span> given <var>response</var>.</p></li>

<li>
<p>If <var>response</var> does not have a <span
data-x="concept-response-location-url">location URL</span> or the <span
data-x="concept-response-location-url">location URL</span> is not a <span>URL</span> whose
<span data-x="concept-url-scheme">scheme</span> is an <span>HTTP(S) scheme</span>,
then <span>break</span>.</p>
<p>If <var>locationURL</var> is not a <span>URL</span> whose <span
data-x="concept-url-scheme">scheme</span> is an <span>HTTP(S) scheme</span>, then
<span>break</span>.</p>

<p class="note">Navigation handles redirects manually as navigation is the only place in
the web platform that cares for redirects to <code data-x="mailto protocol">mailto:</code>
Expand All @@ -84685,31 +84689,25 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
</ol>
</li>

<li><p>If <var>response</var> has a <span data-x="concept-response-location-url">location
URL</span> that is failure, then set <var>response</var> to a <span>network
<li><p>If <var>locationURL</var> is failure, then set <var>response</var> to a <span>network
error</span>.</p></li>

<li><p>Otherwise, if <var>response</var> has a <span
data-x="concept-response-location-url">location URL</span> that is a <span>URL</span> whose <span
<li><p>Otherwise, if <var>locationURL</var> is a <span>URL</span> whose <span
data-x="concept-url-scheme">scheme</span> is "<code data-x="">blob</code>", "<code
data-x="">file</code>", "<code data-x="">filesystem</code>", or "<code
data-x="">javascript</code>", then set <var>response</var> to a network error.</p></li>

<li><p>Otherwise, if <var>response</var> has a <span
data-x="concept-response-location-url">location URL</span> that is a <span>URL</span> whose <span
<li><p>Otherwise, if <var>locationURL</var> is a <span>URL</span> whose <span
data-x="concept-url-scheme">scheme</span> is a <span>fetch scheme</span>, then run
<span>process a navigate fetch</span> with a new <span data-x="concept-request">request</span>
whose <span data-x="concept-request-url">url</span> is <var>response</var>'s <span
data-x="concept-response-location-url">location URL</span>, <var>sourceBrowsingContext</var>,
<var>browsingContext</var>, <var>navigationType</var>, <var>sandboxFlags</var>,
<var>incumbentNavigationOrigin</var>, <var>activeDocumentNavigationOrigin</var>, and
<var>historyHandling</var>, and return.

<li><p>Otherwise, if <var>response</var> has a <span
data-x="concept-response-location-url">location URL</span> that is a <span>URL</span>, run the
<span>process a navigate URL scheme</span> given <var>response</var>'s <span
data-x="concept-response-location-url">location URL</span> and
<var>browsingContext</var>, and return.</p></li>
whose <span data-x="concept-request-url">url</span> is <var>locationURL</var>,
<var>sourceBrowsingContext</var>, <var>browsingContext</var>, <var>navigationType</var>,
<var>sandboxFlags</var>, <var>incumbentNavigationOrigin</var>,
<var>activeDocumentNavigationOrigin</var>, and <var>historyHandling</var>, and return.

<li><p>Otherwise, if <var>locationURL</var> is a <span>URL</span>, run the <span>process a
navigate URL scheme</span> given <var>locationURL</var> and <var>browsingContext</var>, and
return.</p></li>

<li><p>Let <var>navigationParams</var> be a new <span>navigation params</span> whose <span
data-x="navigation-params-request">request</span> is <var>request</var>, <span
Expand Down

0 comments on commit aefcde2

Please sign in to comment.