-
Notifications
You must be signed in to change notification settings - Fork 23
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
Correct null handling when computing base URL host string #251
Conversation
@shannonbooth Does this address the null handling issue you identified? |
It's maybe a little ambiguous which thing is being null checked, but the expansion into two separate points is also a little awkward. Still, can change to that if you think this wording is unclear. |
Oops, sorry, I somehow left that comment early. But yup, that fixes the issue I saw, thanks! (I'm getting somewhat close to finishing the implementation now, ~80% of the test suite passing :^) ) |
spec.bs
Outdated
@@ -1858,8 +1858,7 @@ To <dfn>convert a modifier to a string</dfn> given a [=part/modifier=] |modifier | |||
1. If |type| is not "`pattern`" and |init| [=map/contains=] none of "{{URLPatternInit/protocol}}", "{{URLPatternInit/hostname}}", "{{URLPatternInit/port}}" and "{{URLPatternInit/username}}", then set |result|["{{URLPatternInit/username}}"] to the result of [=processing a base URL string=] given |baseURL|'s [=url/username=] and |type|. | |||
1. If |type| is not "`pattern`" and |init| [=map/contains=] none of "{{URLPatternInit/protocol}}", "{{URLPatternInit/hostname}}", "{{URLPatternInit/port}}", "{{URLPatternInit/username}}" and "{{URLPatternInit/password}}", then set |result|["{{URLPatternInit/password}}"] to the result of [=processing a base URL string=] given |baseURL|'s [=url/password=] and |type|. | |||
1. If |init| [=map/contains=] neither "{{URLPatternInit/protocol}}" nor "{{URLPatternInit/hostname}}", then: | |||
1. Let |baseHost| be the [=host serializer|serialization=] of |baseURL|'s [=url/host=]. | |||
1. If |baseHost| is null, then set |baseHost| to the empty string. | |||
1. Let |baseHost| be the [=host serializer|serialization=] of |baseURL|'s [=url/host=], if it is not null, and the empty string otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Infra suggests:
1. Let |baseHost| be the [=host serializer|serialization=] of |baseURL|'s [=url/host=], if it is not null, and the empty string otherwise. | |
1. Let |baseHost| be the [=host serializer|serialization=] of |baseURL|'s [=url/host=], if it is not null; otherwise the empty string. |
But I think initializing baseHost to the empty string and then conditionally overwriting it will be clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did the conditional overwrite thing.
Preview | Diff