Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process a URLPatternInit doesn't call basic URL parser on base URL #242

Open
shannonbooth opened this issue Jan 6, 2025 · 3 comments
Open

Comments

@shannonbooth
Copy link

What is the issue with the URL Pattern Standard?

process a URLPatternInit does:

Set baseURL to the result of parsing init["baseURL"].

Which has blob handling, which does not seem required. This seems like it should be changed to invoke the basic URL parser instead: https://url.spec.whatwg.org/#concept-basic-url-parser

@shannonbooth
Copy link
Author

shannonbooth commented Jan 6, 2025

Another editorial problem I noticed in the same AO is that "process a URLPatternInit" does:

  1. Let baseHost be baseURL’s host.
  2. If baseHost is null, then set baseHost to the empty string.
  3. Set result["hostname"] to the result of processing a base URL string given baseHost and type.

But URL's host is a concept/variant, and is not a string. e.g it may be an ipv4 address which is a 32 bit integer. I believe the spec should be calling this on host's serialization instead (https://url.spec.whatwg.org/#concept-host-serializer). But I can split this into a different issue if preferred (I will probably run into a few of these type of things, I am implementing the spec from scratch).

@shannonbooth
Copy link
Author

shannonbooth commented Jan 8, 2025

One more I noticed I can also split out into a different issue, but putting it down here for reference.

Parse a pattern string (https://urlpattern.spec.whatwg.org/#parse-a-pattern-string), step 3.9.1 does:

  1. Set prefix be the result of running consume text given parser.

But not prefix is in scope, so I believe should be 'let'. Similar story for modifier token on step 3.9.6

@shannonbooth
Copy link
Author

Noticed another thing (I will do a pass over this afterwards and clean up this issue).

Canonicalizing an opaque pathname https://urlpattern.spec.whatwg.org/#canonicalize-an-opaque-pathname

On step 3. does:

  1. Set dummyURL’s path to the empty string.

But in this case the URL path is a list. So I guess this must means to set it to a list with one item of the empty string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant