Make hostname state return early if a port is given#604
Conversation
annevk
left a comment
There was a problem hiding this comment.
Thanks!
(I wondered if this should be a validation error, but that doesn't seem to make sense for API-specific conditions.)
|
Could you also add a test for |
|
@annevk What do you mean? The setter steps don't seem to have any provision for throwing on URL parsing failure. |
|
Oh, sorry, I somehow assumed Firefox's behavior was correct. It seems that Safari does navigate to the current URL. And Chrome ignores the |
|
@annevk I agree that more location tests would be useful, though to be fair, Chrome doesn't exactly follow the current spec: And if the current URL doesn't have a port while the In fact, all the Location properties could probably use some more setter tests. (And yes, Safari is the one we would align to.) By the way, I don't have write permissions to this repo, so you'll have to merge this PR. |
|
I see, I had not tested Chrome when setting from a URL with a port. Alright, I guess we can merge this and consider the |
|
Actually, I don't see why this needs to return failure. I think we only return failure at the moment if it's relevant for the caller. Otherwise we just return. (That's also why I thought the |
There's already web-platform-tests/wpt#4103 to track Location stuff.
Fixed. |
|
Thanks! |
|
It seems a bit late now, but I think if host with port is given, then 2.2. step (added by this PR) must emit validation error. |
|
@rmisev I considered that, but I thought we didn't do it for override cases? |
|
Yeah, it seems the only case, when override emits validation error, is 3.2. step in the host & hostname state. |
…ort is given, a=testonly Automatic update from web-platform-tests url: expect hostname setter no-op if a port is given (#29021) Aligns with whatwg/url#604 -- wpt-commits: 67a580b4a11da1dca6c1195a2b670e361e4013c9 wpt-pr: 29021
…ort is given, a=testonly Automatic update from web-platform-tests url: expect hostname setter no-op if a port is given (#29021) Aligns with whatwg/url#604 -- wpt-commits: 67a580b4a11da1dca6c1195a2b670e361e4013c9 wpt-pr: 29021

Fixes #601.
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff