Skip to content

Commit

Permalink
Host cannot be null. utf-8 decode is wrong because of BOM. xref conte…
Browse files Browse the repository at this point in the history
…xt object.
  • Loading branch information
annevk committed Jan 15, 2014
1 parent a0a8e32 commit 889793c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
26 changes: 16 additions & 10 deletions url.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ <h2 id="conformance"><span class="secno">1 </span>Conformance</h2>
<h2 id="terminology"><span class="secno">2 </span>Terminology</h2>

<p>Some terms used in this specification are defined in the
Encoding Standard. <a href="#refsENCODING">[ENCODING]</a>
DOM and Encoding Standards.
<a href="#refsDOM">[DOM]</a>
<a href="#refsENCODING">[ENCODING]</a>

<p>The <dfn id="ascii-digits">ASCII digits</dfn> are code points in the range U+0030 to U+0039.
<!-- XXX ref Encoding? -->
Expand Down Expand Up @@ -177,7 +179,8 @@ <h2 id="percent-encoded-bytes"><span class="secno">3 </span>Percent-encoded byte
two <a href="#ascii-hex-digits">ASCII hex digits</a>. Sequences of
<a href="#percent-encoded-byte" title="percent-encoded byte">percent-encoded bytes</a>, after
conversion to bytes, should not cause
<a class="external" data-anolis-spec="encoding" href="http://encoding.spec.whatwg.org/#utf-8-decode">utf-8 decode</a> to run into any
<a class="external" data-anolis-spec="encoding" href="http://encoding.spec.whatwg.org/#utf-8">utf-8</a>'s
<a class="external" data-anolis-spec="encoding" href="http://encoding.spec.whatwg.org/#decoder">decoder</a> to run into any
<a class="external" data-anolis-spec="encoding" href="http://encoding.spec.whatwg.org/#error" title="error">errors</a>.

<p>To <dfn id="percent-encode">percent encode</dfn> a <var title="">byte</var> into a
Expand Down Expand Up @@ -279,8 +282,8 @@ <h2 id="hosts-(domains-and-ip-addresses)"><span class="secno">4 </span>Hosts (do
http://tools.ietf.org/html/rfc3492
http://mothereff.in/punycode -->

<p>A <dfn id="concept-host" title="concept-host">host</dfn> is null or a network address in the form of either
a <a href="#concept-domain" title="concept-domain">domain</a> or an
<p>A <dfn id="concept-host" title="concept-host">host</dfn> is a network address in the form of a
<a href="#concept-domain" title="concept-domain">domain</a> or an
<a href="#concept-ipv6" title="concept-ipv6">IPv6 address</a>.

<p>A <dfn id="concept-domain" title="concept-domain">domain</dfn> is an ordered list of one or
Expand Down Expand Up @@ -406,7 +409,8 @@ <h3 id="host-parsing"><span class="secno">4.3 </span>Parsing</h3>
</ol>

<li><p>Let <var title="">host</var> be the result of running
<a class="external" data-anolis-spec="encoding" href="http://encoding.spec.whatwg.org/#utf-8-decode">utf-8 decode</a> on the
<a class="external" data-anolis-spec="encoding" href="http://encoding.spec.whatwg.org/#utf-8">utf-8</a>'s
<a class="external" data-anolis-spec="encoding" href="http://encoding.spec.whatwg.org/#decoder">decoder</a> on the
<a href="#percent-decode" title="percent decode">percent decoding</a> of running
<a class="external" data-anolis-spec="encoding" href="http://encoding.spec.whatwg.org/#utf-8-encode">utf-8 encode</a> on <var title="">input</var>.
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=309671 -->
Expand Down Expand Up @@ -618,13 +622,12 @@ <h3 id="host-parsing"><span class="secno">4.3 </span>Parsing</h3>

<h3 id="host-serializing"><span class="secno">4.4 </span>Serializing</h3>

<p>The <dfn id="concept-host-serializer" title="concept-host-serializer">host serializer</dfn> takes a
<p>The <dfn id="concept-host-serializer" title="concept-host-serializer">host serializer</dfn> takes null or a
<a href="#concept-host" title="concept-host">host</a> <var title="">host</var> and then runs
these steps:

<ol>
<li><p>If <var title="">host</var> is null, return the empty string.
<!-- XXX Are we okay with this? -->

<li><p>If <var title="">host</var> is an
<a href="#concept-ipv6" title="concept-ipv6">IPv6 address</a>, return
Expand Down Expand Up @@ -2187,8 +2190,8 @@ <h3 id="urlutils-and-urlutilsreadonly-members"><span class="secno">7.3 </span><a
<li><p>Run the <a href="#concept-uu-set-the-input" title="concept-UU-set-the-input">set the input</a> algorithm for
the given value.

<li><p>If the <span>context object</span> is a <a href="#url"><code>URL</code></a> object and its
<a href="#concept-uu-url" title="concept-UU-url">url</a> is null,
<li><p>If the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a> is a <a href="#url"><code>URL</code></a>
object and its <a href="#concept-uu-url" title="concept-UU-url">url</a> is null,
<a class="external" data-anolis-spec="webidl" href="http://heycam.github.io/webidl/#dfn-throw">throw</a> a <code title="">TypeError</code> exception.

<li><p>Run the <a href="#pre-update-steps">pre-update steps</a> with the given value.
Expand Down Expand Up @@ -2662,7 +2665,10 @@ <h3 id="interface-urlsearchparams"><span class="secno">7.4 </span>Interface <a h


<h2 class="no-num" id="references">References</h2>
<div id="anolis-references"><dl><dt id="refsENCODING">[ENCODING]
<div id="anolis-references"><dl><dt id="refsDOM">[DOM]
<dd><cite><a href="http://dom.spec.whatwg.org/">DOM</a></cite>, Anne van Kesteren, Aryeh Gregor and Ms2ger. WHATWG.

<dt id="refsENCODING">[ENCODING]
<dd><cite><a href="http://encoding.spec.whatwg.org/">Encoding</a></cite>, Anne van Kesteren. WHATWG.

<dt id="refsHTML">[HTML]
Expand Down
21 changes: 12 additions & 9 deletions url.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ <h2>Conformance</h2>
<h2>Terminology</h2>

<p>Some terms used in this specification are defined in the
Encoding Standard. <span data-anolis-ref>ENCODING</span>
DOM and Encoding Standards.
<span data-anolis-ref>DOM</span>
<span data-anolis-ref>ENCODING</span>

<p>The <dfn>ASCII digits</dfn> are code points in the range U+0030 to U+0039.
<!-- XXX ref Encoding? -->
Expand Down Expand Up @@ -147,7 +149,8 @@ <h2>Percent-encoded bytes</h2>
two <span>ASCII hex digits</span>. Sequences of
<span title="percent-encoded byte">percent-encoded bytes</span>, after
conversion to bytes, should not cause
<span data-anolis-spec=encoding>utf-8 decode</span> to run into any
<span data-anolis-spec=encoding>utf-8</span>'s
<span data-anolis-spec=encoding>decoder</span> to run into any
<span data-anolis-spec=encoding title=error>errors</span>.

<p>To <dfn>percent encode</dfn> a <var title>byte</var> into a
Expand Down Expand Up @@ -249,8 +252,8 @@ <h2>Hosts (domains and IP addresses)</h2>
http://tools.ietf.org/html/rfc3492
http://mothereff.in/punycode -->

<p>A <dfn title=concept-host>host</dfn> is null or a network address in the form of either
a <span title=concept-domain>domain</span> or an
<p>A <dfn title=concept-host>host</dfn> is a network address in the form of a
<span title=concept-domain>domain</span> or an
<span title=concept-ipv6>IPv6 address</span>.

<p>A <dfn title=concept-domain>domain</dfn> is an ordered list of one or
Expand Down Expand Up @@ -376,7 +379,8 @@ <h3 id=host-parsing>Parsing</h3>
</ol>

<li><p>Let <var title>host</var> be the result of running
<span data-anolis-spec=encoding>utf-8 decode</span> on the
<span data-anolis-spec=encoding>utf-8</span>'s
<span data-anolis-spec=encoding>decoder</span> on the
<span title="percent decode">percent decoding</span> of running
<span data-anolis-spec=encoding>utf-8 encode</span> on <var title>input</var>.
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=309671 -->
Expand Down Expand Up @@ -588,13 +592,12 @@ <h3 id=host-parsing>Parsing</h3>

<h3 id=host-serializing>Serializing</h3>

<p>The <dfn title=concept-host-serializer>host serializer</dfn> takes a
<p>The <dfn title=concept-host-serializer>host serializer</dfn> takes null or a
<span title=concept-host>host</span> <var title>host</var> and then runs
these steps:

<ol>
<li><p>If <var title>host</var> is null, return the empty string.
<!-- XXX Are we okay with this? -->

<li><p>If <var title>host</var> is an
<span title=concept-ipv6>IPv6 address</span>, return
Expand Down Expand Up @@ -2157,8 +2160,8 @@ <h3><code>URLUtils</code> and <code>URLUtilsReadOnly</code> members</h3>
<li><p>Run the <span title=concept-UU-set-the-input>set the input</span> algorithm for
the given value.

<li><p>If the <span>context object</span> is a <code>URL</code> object and its
<span title=concept-UU-url>url</span> is null,
<li><p>If the <span data-anolis-spec=dom>context object</span> is a <code>URL</code>
object and its <span title=concept-UU-url>url</span> is null,
<span data-anolis-spec=webidl>throw</span> a <code title>TypeError</code> exception.

<li><p>Run the <span>pre-update steps</span> with the given value.
Expand Down

0 comments on commit 889793c

Please sign in to comment.