Skip to content

Commit b205cae

Browse files
authored
Correct innards of document.domain
This fixes a regression introduced in 326c644. Fixes #6509.
1 parent c619ded commit b205cae

File tree

1 file changed

+116
-14
lines changed

1 file changed

+116
-14
lines changed

source

Lines changed: 116 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2332,8 +2332,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
23322332
<li><dfn data-x="concept-host" data-x-href="https://url.spec.whatwg.org/#concept-host">host</dfn></li>
23332333
<li><dfn data-x-href="https://url.spec.whatwg.org/#host-public-suffix">public suffix</dfn></li>
23342334
<li><dfn data-x="concept-domain" data-x-href="https://url.spec.whatwg.org/#concept-domain">domain</dfn></li>
2335-
<li><dfn data-x-href="https://url.spec.whatwg.org/#concept-ipv4">IPv4 address</dfn></li>
2336-
<li><dfn data-x-href="https://url.spec.whatwg.org/#concept-ipv6">IPv6 address</dfn></li>
2335+
<li><dfn data-x-href="https://url.spec.whatwg.org/#ip-address">IP address</dfn></li>
23372336
<li><dfn data-x-href="https://url.spec.whatwg.org/#concept-url">URL</dfn></li>
23382337
<li><dfn data-x="concept-url-origin" data-x-href="https://url.spec.whatwg.org/#concept-url-origin">Origin</dfn> of URLs</li>
23392338
<li><dfn data-x-href="https://url.spec.whatwg.org/#syntax-url-absolute">Absolute URL</dfn></li>
@@ -82302,36 +82301,139 @@ interface <dfn interface>BarProp</dfn> {
8230282301
<ol>
8230382302
<li><p>If <var>hostSuffixString</var> is the empty string, then return false.</p></li>
8230482303

82305-
<li><p>Let <var>host</var> be the result of <span data-x="host parser">parsing</span>
82304+
<li><p>Let <var>hostSuffix</var> be the result of <span data-x="host parser">parsing</span>
8230682305
<var>hostSuffixString</var>.</p></li>
8230782306

82308-
<li><p>If <var>host</var> is failure, then return false.</p></li>
82307+
<li><p>If <var>hostSuffix</var> is failure, then return false.</p></li>
8230982308

8231082309
<li>
82311-
<p>If <var>host</var> does not <span data-x="host equals">equal</span> <var>originalHost</var>,
82312-
then:</p>
82310+
<p>If <var>hostSuffix</var> does not <span data-x="host equals">equal</span>
82311+
<var>originalHost</var>, then:</p>
8231382312

8231482313
<ol>
8231582314
<li>
82316-
<p>If <var>host</var> or <var>originalHost</var> is not a <span
82315+
<p>If <var>hostSuffix</var> or <var>originalHost</var> is not a <span
8231782316
data-x="concept-domain">domain</span>, then return false.</p>
8231882317

82319-
<p class="note">This excludes <span data-x="concept-host">hosts</span> that are an <span>IPv4
82320-
address</span> or an <span>IPv6 address</span>.</p>
82318+
<p class="note">This excludes <span data-x="concept-host">hosts</span> that are <span
82319+
data-x="IP address">IP addresses</span>.</p>
8232182320
</li>
8232282321

82323-
<li><p>If <var>host</var>, prefixed by a U+002E FULL STOP (.), does not exactly match the end
82324-
of <var>originalHost</var>, then return false.</p></li>
82325-
<!-- This seems okay, but does pretend hosts are strings which URL does not. -->
82322+
<li><p>If <var>hostSuffix</var>, prefixed by U+002E (.), does not match the end of
82323+
<var>originalHost</var>, then return false.</p></li>
82324+
<!-- It would be cleaner to avoid string manipulation on domains. -->
82325+
82326+
<li>
82327+
<p>If one of the following is true</p>
82328+
82329+
<ul class="brief">
82330+
<li><p><var>hostSuffix</var> <span data-x="host equals">equals</span> <var>hostSuffix</var>'s
82331+
<span>public suffix</span></p></li>
8232682332

82327-
<li><p>If <var>host</var> <span data-x="host equals">equals</span> <var>host</var>'s
82328-
<span>public suffix</span>, then return false. <ref spec=URL></p></li>
82333+
<li><p><var>hostSuffix</var>, prefixed by U+002E (.), matches the end
82334+
<var>originalHost</var>'s <span>public suffix</span></p></li>
82335+
<!-- It would be cleaner to avoid string manipulation on domains. -->
82336+
</ul>
82337+
82338+
<p>then return false. <ref spec=URL></p>
82339+
</li>
82340+
82341+
<li><p>Assert: <var>originalHost</var>'s <span>public suffix</span>, prefixed by U+002E (.),
82342+
matches the end of <var>hostSuffix</var>.</p></li>
82343+
<!-- It would be cleaner to avoid string manipulation on domains. -->
8232982344
</ol>
8233082345
</li>
8233182346

8233282347
<li><p>Return true.</p></li>
8233382348
</ol>
8233482349

82350+
<div class="example" id="example-registrable-domain-suffix">
82351+
<table>
82352+
<tr>
82353+
<th><var>hostSuffixString</var></th>
82354+
<th><var>originalHost</var></th>
82355+
<th>Outcome of <span>is a registrable domain suffix of or is equal to</span></th>
82356+
<th>Notes</th>
82357+
</tr>
82358+
<tr>
82359+
<td>"<code data-x="">0.0.0.0</code>"</td>
82360+
<td><code data-x="">0.0.0.0</code></td>
82361+
<td>✅</td>
82362+
<td></td>
82363+
</tr>
82364+
<tr>
82365+
<td>"<code data-x="">0x10203</code>"</td>
82366+
<td><code data-x="">0.1.2.3</code></td>
82367+
<td>✅</td>
82368+
<td></td>
82369+
</tr>
82370+
<tr>
82371+
<td>"<code data-x="">[0::1]</code>"</td>
82372+
<td><code data-x="">::1</code></td>
82373+
<td>✅</td>
82374+
<td></td>
82375+
</tr>
82376+
<tr>
82377+
<td>"<code data-x="">example.com</code>"</td>
82378+
<td><code data-x="">example.com</code></td>
82379+
<td>✅</td>
82380+
<td></td>
82381+
</tr>
82382+
<tr>
82383+
<td>"<code data-x="">example.com</code>"</td>
82384+
<td><code data-x="">example.com.</code></td>
82385+
<td>❌</td>
82386+
<td rowspan="2">Trailing dot is significant.</td>
82387+
</tr>
82388+
<tr>
82389+
<td>"<code data-x="">example.com.</code>"</td>
82390+
<td><code data-x="">example.com</code></td>
82391+
<td>❌</td>
82392+
</tr>
82393+
<tr>
82394+
<td>"<code data-x="">example.com</code>"</td>
82395+
<td><code data-x="">www.example.com</code></td>
82396+
<td>✅</td>
82397+
<td></td>
82398+
</tr>
82399+
<tr>
82400+
<td>"<code data-x="">com</code>"</td>
82401+
<td><code data-x="">example.com</code></td>
82402+
<td>❌</td>
82403+
<td>At the time of writing, <code data-x="">com</code> is a public suffix.</td>
82404+
</tr>
82405+
<tr>
82406+
<td>"<code data-x="">example</code>"</td>
82407+
<td><code data-x="">example</code></td>
82408+
<td>✅</td>
82409+
<td></td>
82410+
</tr>
82411+
<tr>
82412+
<td>"<code data-x="">compute.amazonaws.com</code>"</td>
82413+
<td><code data-x="">example.compute.amazonaws.com</code></td>
82414+
<td>❌</td>
82415+
<td rowspan="3">At the time of writing, <code
82416+
data-x=""><var>*</var>.compute.amazonaws.com</code> is a public suffix.</td>
82417+
</tr>
82418+
<tr>
82419+
<td>"<code data-x="">example.compute.amazonaws.com</code>"</td>
82420+
<td><code data-x="">www.example.compute.amazonaws.com</code></td>
82421+
<td>❌</td>
82422+
</tr>
82423+
<tr>
82424+
<td>"<code data-x="">amazonaws.com</code>"</td>
82425+
<td><code data-x="">www.example.compute.amazonaws.com</code></td>
82426+
<td>❌</td>
82427+
</tr>
82428+
<tr>
82429+
<td>"<code data-x="">amazonaws.com</code>"</td>
82430+
<td><code data-x="">test.amazonaws.com</code></td>
82431+
<td>✅</td>
82432+
<td>At the time of writing, <code data-x="">amazonaws.com</code> is a registrable domain.</td>
82433+
</tr>
82434+
</table>
82435+
</div>
82436+
8233582437
</div>
8233682438

8233782439

0 commit comments

Comments
 (0)