-
Notifications
You must be signed in to change notification settings - Fork 22
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
Spec and WPT inconsistencies #239
Comments
Another issue @annevk : new URLPattern({ hostname: 'bad#hostname' }); should not throw but there is a WPT that validates that it throws.
This is wrongly implemented on Deno's URLPattern, Cloudflare's workerd and Chromium. |
Hmm, but |
If I understand it correctly: This doesn't fail, hence it shouldn't fail on URLPattern as well:
|
Host parser (specifically domain to ASCII with domain and false) strip all trailing values whenever it sees |
Another test case is invalid: ada-url/ada@d17f000 If you run the following on Google Chrome, you'll get the following error:
But, Particularly, the following should work and works according to URL spec:
Therefore, this test case shouldn't fail. |
Going to see how many of these I can get through today. For this example: new URLPattern({ "protocol": "http", "port": "80 " }) that's not the relevant Chromium code, but instead that we use
I think this change is probably minor enough (especially since it only makes previously invalid patterns valid) that changing the implementation(s) to match the spec is okay. |
@jeremyroman I think there are more invalid cases like this. I've removed and updated the following test cases on Appreciate if you could take a look. They are mostly around |
Yeah, I'm in the process of looking into what you've said. For the port example, on further inspection the change I mention does address some whitespace (newlines and tabs) but not spaces. In the Chromium implementation, it also winds through ParsePortFromStringPosition which simply ignores any leading zeroes and any junk after the ASCII digit sequence, whose spec counterpart is here. |
For the hostname ones, the cases of /?# seem quite parallel to the port ones. The case of \ is quite weird -- during pattern parsing we can't tell for sure if the URL is special so treat it as not, but for interpreting the init dictionary to For the other bad characters, we have comments in Chromium linking to https://issues.chromium.org/u/0/issues/40124263. If it's just a matter of a (long-standing?) Chromium-specific bug I suppose we should probably test the standard behavior, though that kinda suggests it might be tough for us to fix which might motivate the spec changing. Not familiar enough with that bug yet to comment off the top of my head. |
What is the issue with the URL Pattern Standard?
There is a web-platform test that is even implemented by Chrome that is not covered with the URLPattern spec.
This fails on Chromium due to this function validation: https://chromium.googlesource.com/chromium/src/+/main/extensions/common/url_pattern.cc#101
But other than canonicalizePort there is no place that actually validates the validity of the port, and canonicalizePort calls url parser setter which removes leading and trailing spaces which makes
"80 "
input valid.Relevant WPT: https://github.com/web-platform-tests/wpt/blob/0c1d19546fd4873bb9f4147f0bbf868e7b4f91b7/urlpattern/resources/urlpatterntestdata.json#L1146
The text was updated successfully, but these errors were encountered: