Skip to content

Commit

Permalink
Align with URL API changes for file and non-special URLs
Browse files Browse the repository at this point in the history
This change depends on whatwg/url#224 landing
first.

Tests: web-platform-tests/wpt#4696.

Location API bits are not tested since we generally treat loading from
file URLs as out-of-scope of the web platform, but accounting for it
standards-wise seemed trivial enough.
  • Loading branch information
annevk committed Feb 2, 2017
1 parent 75a9e30 commit 127dac8
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2529,6 +2529,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x-href="https://url.spec.whatwg.org/#host-state">host state</dfn></li>
<li><dfn data-x-href="https://url.spec.whatwg.org/#hostname-state">hostname state</dfn></li>
<li><dfn data-x-href="https://url.spec.whatwg.org/#port-state">port state</dfn></li>
<li><dfn data-x-href="https://url.spec.whatwg.org/#file-host-state">file host state</dfn></li>
<li><dfn data-x-href="https://url.spec.whatwg.org/#path-start-state">path start state</dfn></li>
<li><dfn data-x-href="https://url.spec.whatwg.org/#query-state">query state</dfn></li>
<li><dfn data-x-href="https://url.spec.whatwg.org/#fragment-state">fragment state</dfn></li>
Expand All @@ -2554,6 +2555,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>An <dfn data-x-href="https://url.spec.whatwg.org/#http-scheme">HTTP(S) scheme</dfn></li>
<li>A <dfn data-x-href="https://url.spec.whatwg.org/#network-scheme">network scheme</dfn></li>
<li>A <dfn data-x-href="https://url.spec.whatwg.org/#fetch-scheme">fetch scheme</dfn></li>
<li>The <dfn data-x-href="https://url.spec.whatwg.org/#cannot-have-a-username-password-port">cannot have a username/password/port</dfn> concept</li>
<li>The <dfn data-x="concept-url-serializer" data-x-href="https://url.spec.whatwg.org/#concept-url-serializer">URL serializer</dfn></li>
<li>The <dfn data-x-href="https://url.spec.whatwg.org/#concept-host-parser">host parser</dfn></li>
<li>The <dfn data-x="host serializer" data-x-href="https://url.spec.whatwg.org/#concept-host-serializer">host serializer</dfn></li>
Expand Down Expand Up @@ -21885,9 +21887,8 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
<li><p>Let <var>url</var> be this element's <span
data-x="concept-hyperlink-url">url</span>.</p></li>

<li><p>If <var>url</var> or <var>url</var>'s <span data-x="concept-url-host">host</span> is null,
or <var>url</var>'s <span>cannot-be-a-base-URL flag</span> is set, terminate these
steps.</p></li>
<li><p>If <var>url</var> is null or <var>url</var>
<span>cannot have a username/password/port</span>, then return.</p></li>

<li><p><span>Set the username</span>, given <var>url</var> and the given value.</p></li>

Expand Down Expand Up @@ -21917,9 +21918,8 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
<li><p>Let <var>url</var> be this element's <span
data-x="concept-hyperlink-url">url</span>.</p></li>

<li><p>If <var>url</var> or <var>url</var>'s <span data-x="concept-url-host">host</span> is null,
or <var>url</var>'s <span>cannot-be-a-base-URL flag</span> is set, terminate these
steps.</p></li>
<li><p>If <var>url</var> is null or <var>url</var>
<span>cannot have a username/password/port</span>, then return.</p></li>

<li><p><span>Set the password</span>, given <var>url</var> and the given value.</p></li>

Expand Down Expand Up @@ -21959,9 +21959,12 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
<li><p>If <var>url</var> is null or <var>url</var>'s <span>cannot-be-a-base-URL flag</span> is
set, terminate these steps.</p></li>

<li><p>Let <var>hostState</var> be <span>file host state</span> if <var>url</var>'s <span
data-x="concept-url-scheme">scheme</span> is "<code>file</code>", and <span>host state</span>
otherwise.

<li><p><span data-x="basic url parser">Basic URL parse</span> the given value, with
<var>url</var> as <var>url</var> and <span>host state</span> as <var>state
override</var>.</p></li>
<var>url</var> as <var>url</var> and <var>hostState</var> as <var>state override</var>.</p></li>

<li><p><span>Update <code>href</code></span>.</p></li>
</ol>
Expand Down Expand Up @@ -21994,9 +21997,12 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
<li><p>If <var>url</var> is null or <var>url</var>'s <span>cannot-be-a-base-URL flag</span> is
set, terminate these steps.</p></li>

<li><p>Let <var>hostState</var> be <span>file host state</span> if <var>url</var>'s <span
data-x="concept-url-scheme">scheme</span> is "<code>file</code>", and <span>hostname state</span>
otherwise.

<li><p><span data-x="basic url parser">Basic URL parse</span> the given value, with
<var>url</var> as <var>url</var> and <span>hostname state</span> as <var>state
override</var>.</p></li>
<var>url</var> as <var>url</var> and <var>hostState</var> as <var>state override</var>.</p></li>

<li><p><span>Update <code>href</code></span>.</p></li>
</ol>
Expand Down Expand Up @@ -22025,10 +22031,8 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
<li><p>Let <var>url</var> be this element's <span
data-x="concept-hyperlink-url">url</span>.</p></li>

<li><p>If <var>url</var> or <var>url</var>'s <span data-x="concept-url-host">host</span> is null,
<var>url</var>'s <span>cannot-be-a-base-URL flag</span> is set, or <var>url</var>'s <span
data-x="concept-url-scheme">scheme</span> is "<code data-x="">file</code>", terminate these
steps.</p></li>
<li><p>If <var>url</var> is null or <var>url</var>
<span>cannot have a username/password/port</span>, then return.</p></li>

<li><p>If the given value is the empty string, then set <var>url</var>'s <span
data-x="concept-url-port">port</span> to null.</p></li>
Expand Down Expand Up @@ -81005,8 +81009,12 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
<li><p>If <var>copyURL</var>'s <span>cannot-be-a-base-URL flag</span> is set, terminate these
steps.</p></li>

<li><p>Let <var>hostState</var> be <span>file host state</span> if <var>url</var>'s <span
data-x="concept-url-scheme">scheme</span> is "<code>file</code>", and <span>host state</span>
otherwise.

<li><p><span data-x="basic url parser">Basic URL parse</span> the given value, with
<var>copyURL</var> as <var>url</var> and <span>host state</span> as <var>state
<var>copyURL</var> as <var>url</var> and <var>hostState</var> as <var>state
override</var>.</p></li>

<li><p><span><code>Location</code>-object-setter navigate</span> to <var>copyURL</var>.</p></li>
Expand Down Expand Up @@ -81044,8 +81052,12 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
<li><p>If <var>copyURL</var>'s <span>cannot-be-a-base-URL flag</span> is set, terminate these
steps.</p></li>

<li><p>Let <var>hostState</var> be <span>file host state</span> if <var>url</var>'s <span
data-x="concept-url-scheme">scheme</span> is "<code>file</code>", and <span>host state</span>
otherwise.

<li><p><span data-x="basic url parser">Basic URL parse</span> the given value, with
<var>copyURL</var> as <var>url</var> and <span>hostname state</span> as <var>state
<var>copyURL</var> as <var>url</var> and <var>hostState</var> as <var>state
override</var>.</p></li>

<li><p><span><code>Location</code>-object-setter navigate</span> to <var>copyURL</var>.</p></li>
Expand Down Expand Up @@ -81079,10 +81091,8 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
<li><p>Let <var>copyURL</var> be a copy of this <code>Location</code> object's <span
data-x="concept-location-url">url</span>.</p></li>

<li><p>If <var>copyURL</var>'s <span data-x="concept-url-host">host</span> is null,
<var>copyURL</var>'s <span>cannot-be-a-base-URL flag</span> is set, or <var>copyURL</var>'s <span
data-x="concept-url-scheme">scheme</span> is "<code data-x="">file</code>", terminate these
steps.</p></li>
<li><p>If <var>copyURL</var> <span>cannot have a username/password/port</span>, then
return.</p></li>

<li><p>If the given value is the empty string, then set <var>copyURL</var>'s <span
data-x="concept-url-port">port</span> to null.</p></li>
Expand Down

0 comments on commit 127dac8

Please sign in to comment.