Re: [whatwg/url] Named validation errors (#502)

@domenic approved this pull request.

LGTM with nits. Very clean.

> +    [[UTS46]]
+    <p class=note>If details about <a abstract-op lt=ToASCII>Unicode ToASCII</a> errors are
+    recorded, user agents are encouraged to pass those along.
+   <td>Yes
+  <tr>
+   <td><dfn>domain-to-Unicode</dfn>
+   <td>
+    <p><a abstract-op lt=ToUnicode>Unicode ToUnicode</a> records an error. [[UTS46]]
+    <p class=note>The same considerations as with <a>domain-to-ASCII</a> apply.
+   <td>·
+ <tbody>
+  <tr>
+   <th colspan=3 scope=rowgroup><a href=#host-parsing>Host parsing</a>
+  <!-- host parser -->
+  <tr>
+   <td><dfn>IPv6-unclosed</dfn>

Maybe consider alphabetizing within the table? Or at least moving this IPv6- one to be adjacent to the others.

> +  <tr>
+   <th colspan=3 scope=rowgroup><a href=#idna>IDNA</a>
+  <tr>
+   <td><dfn id=validation-error-domain-to-ascii>domain-to-ASCII</dfn>
+   <td>
+    <p><a abstract-op lt=ToASCII>Unicode ToASCII</a> records an error or returns the empty string.
+    [[UTS46]]
+    <p class=note>If details about <a abstract-op lt=ToASCII>Unicode ToASCII</a> errors are
+    recorded, user agents are encouraged to pass those along.
+   <td>Yes
+  <tr>
+   <td><dfn>domain-to-Unicode</dfn>
+   <td>
+    <p><a abstract-op lt=ToUnicode>Unicode ToUnicode</a> records an error. [[UTS46]]
+    <p class=note>The same considerations as with <a>domain-to-ASCII</a> apply.
+   <td>·

I think you need a bit of styling like https://html.spec.whatwg.org/#linkTypes to center and, maybe, make the failure cells colored.

> +   <th colspan=3 scope=rowgroup><a href=#host-parsing>Host parsing</a>
+  <!-- host parser -->
+  <tr>
+   <td><dfn>IPv6-unclosed</dfn>
+   <td>
+    <p>An <a for=/>IPv6 address</a> is missing the closing U+005D (]).
+    <p class=example id=example-ipv6-unclosed"<code>https://[::1</code>"
+   <td>Yes
+  <tr>
+   <td><dfn>domain-invalid-code-point</dfn>
+   <td>
+    <p>The input's <a for=/>host</a> contains a <a>forbidden domain code point</a>.
+    <div class=example id=example-domain-invalid-code-point>
+     <p>Hosts are <a for=string>percent-decoded</a> before being processed when the URL
+     <a>is special</a>, which would result in the following host portion becoming
+     "<code>exa#mple.org</code>".

```suggestion
     "<code>exa#mple.org</code>" and thus triggering this error.
```

> +     <a>is special</a>, which would result in the following host portion becoming
+     "<code>exa#mple.org</code>".
+     <p>"<code>https://exa%23mple.org</code>"
+    </div>
+   <td>Yes
+  <!-- IPv4 parser -->
+  <tr>
+   <td><dfn>IPv4-empty-part</dfn>
+   <td>
+    <p>An <a for=/>IPv4 address</a> ends with a U+002E (.).
+    <p class=example id=example-ipv4-empty-part>"<code>https://127.0.0.1./</code>"
+   <td>·
+  <tr>
+   <td><dfn>IPv4-too-many-parts</dfn>
+   <td>
+    <p>An <a for=/>IPv4 address</a> has to consist of 4 parts.

```suggestion
    <p>An <a for=/>IPv4 address</a> does not consist of exactly 4 parts.
```

> +  <tr>
+   <td><dfn>IPv4-empty-part</dfn>
+   <td>
+    <p>An <a for=/>IPv4 address</a> ends with a U+002E (.).
+    <p class=example id=example-ipv4-empty-part>"<code>https://127.0.0.1./</code>"
+   <td>·
+  <tr>
+   <td><dfn>IPv4-too-many-parts</dfn>
+   <td>
+    <p>An <a for=/>IPv4 address</a> has to consist of 4 parts.
+    <p class=example id=example-ipv4-too-many-parts>"<code>https://1.2.3.4.5/</code>"
+   <td>Yes
+  <tr>
+   <td><dfn>IPv4-non-numeric-part</dfn>
+   <td>
+    <p>An <a for=/>IPv4 address</a> part was not numeric.

```suggestion
    <p>An <a for=/>IPv4 address</a> part is not numeric.
```

> +   <td>
+    <p>An <a for=/>IPv4 address</a> part was not numeric.
+    <p class=example id=example-ipv4-non-numeric-part>"<code>https://test.42</code>"
+   <td>Yes
+  <tr>
+   <td><dfn>IPv4-non-decimal-part</dfn>
+   <td>
+    <p>The <a for=/>IPv4 address</a> contains numbers expressed using hexadecimal or octal digits.
+    <p class=example id=example-ipv4-non-decimal-part>"<code>https://127.0.0x0.1</code>"
+   <td>·
+  <tr>
+   <td><dfn>IPv4-out-of-range-part</dfn>
+   <td>
+    <p>An <a for=/>IPv4 address</a> part exceeds 255.
+    <p class=example id=example-ipv4-out-of-range-part>"<code>https://255.255.4000.1</code>"
+   <td>Yes (only if applicable to the last part)

```suggestion
   <td>Yes<br>(only if applicable to the last part)
```

maybe?

> +   <td>Yes
+  <tr>
+   <td><dfn>IPv6-multiple-compression</dfn>
+   <td>
+    <p>An <a for=/>IPv6 address</a> is compressed in more than one spot.
+    <p class=example id=example-ipv6-multiple-compression>"<code>https://[1::1::1]</code>"
+   <td>Yes
+  <tr>
+   <td><dfn>IPv4-in-IPv6-too-many-pieces</dfn>
+   <td>
+    <p>An <a for=/>IPv6 address</a> with <a for=/>IPv4 address</a> syntax: the IPv6 address has more
+    than 6 pieces.
+    <p class=example id=example-ipv4-in-ipv6-too-many-pieces>"<code>https://[1:1:1:1:1:1:1:127.0.0.1]</code>"
+   <td>Yes
+  <tr>
+   <td><dfn>IPv4-in-IPv6-invalid-code-point</dfn>

Really seems like this should be split into multiple errors, but I guess that could be refactored later.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/pull/502#pullrequestreview-1298900495

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/pull/502/review/1298900495@github.com>

Received on Wednesday, 15 February 2023 07:04:18 UTC