Re: [whatwg/url] Defered validation error reporting in IPv4 parser (Issue #706)

Looking at this again, I don't think we can report validation errors directly in the [ipv4-number-parser](https://url.spec.whatwg.org/#ipv4-number-parser) as it is also used in Step 4 of [ends-in-a-number-checker](https://url.spec.whatwg.org/#ends-in-a-number-checker). Doing so would cause the same validation error to be emitted twice in an edge case such as `https://0xF`. Reporting the validation error in [ipv4-number-parser](https://url.spec.whatwg.org/#ipv4-number-parser) Step 6.1 would probably work better.

Proposed changes overview:

- Remove Step 1
- Change Step 3.1 from ~~Set validationError to true.~~ to Validation error.
- Change Step 6.1 from ~~If result\[1\] is true, then set validationError to true.~~ to If result[1] is true, validation error.
- Remove Step 7 (the validation error was moved to Step 6.1)

> The IPv4 and IPv6 parsers should not be invoked directly. You always want to use the host parser. Perhaps we want to stress this some more somehow.

Agreed. I was pretty sure that was the case, but I wasn't sure if the IPv4 parser was exported for other specs.

Feel free to mark as "good first issue". If nobody wants to pick it up, I'd be happy to submit a patch.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/706#issuecomment-1242811713
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/issues/706/1242811713@github.com>

Received on Saturday, 10 September 2022 22:09:08 UTC