-
Notifications
You must be signed in to change notification settings - Fork 145
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
Report all hostname state failures for URLPattern #863
Conversation
URLPattern's canonicalize a hostname is the only invocation of the basic URL parser with a URL and state override set to hostname state that looks at the return failure. And since the URL that URLPattern uses is a dummy URL that is ideally not exposed, knowing about all the failure conditions is kind of important. (Now technically the second return failure added here cannot be observed as the dummy URL won't have credentials or a non-null port, but it seemed good to change that at the same time for consistency.) This is covered by existing URLPattern web-platform-tests. Some more background can be found in whatwg/urlpattern#252.
@anonrig @sisidovski what do you think of this approach? |
It is kind of vague to me what the returning failure is. Can we be more explicit and standardize the error? |
I'm not sure what you mean. |
I assume @anonrig is talking about "failure" itself. In the spec returning "failure" in many places and the caller handles failures appropriately e.g.
As the basic url parser is an internally called algorithm, it's totally fine to just return "failure" in failure cases as far as I understand it. |
You did not specify validation errors when returning failure. I think it might be useful to specify them. |
We don't currently specify validation errors for API calls. |
Since port was mentioned, Is it intended that basic URL parsing I guess the pattern spec was written with the intent of failure being returned here, but without URL spec doing it? Currently spec will return a null port, the WPT test above seems to expect no match to happen by error being thrown during canonicalization. |
I can't approve this (due to insufficient permissions), but after reading it once again, I'm OK with landing it. |
Thanks everyone! I'm going to land this as this is just a bug fix for whatwg/urlpattern#252. I suggest that as resolving that issue the remaining implementer bugs get filed. |
URLPattern's canonicalize a hostname is the only invocation of the basic URL parser with a URL and state override set to hostname state that looks at the return failure.
And since the URL that URLPattern uses is a dummy URL that is ideally not exposed, knowing about all the failure conditions is kind of important.
(Now technically the second return failure added here cannot be observed as the dummy URL won't have credentials or a non-null port, but it seemed good to change that at the same time for consistency.)
This is covered by existing URLPattern web-platform-tests. Some more background can be found in whatwg/urlpattern#252.
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff