Compat problem with new URL()
Categories
(Core :: Networking, defect, P3)
Tracking
()
People
(Reporter: Luke, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged])
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36
Steps to reproduce:
- Navigate to https://jsfiddle.net/40abpv7d/
- Look at the HTML output
Actual results:
new URL(https://"google.com
).toString() has different behaviour depending on which browser you're in.
Firefox outputs TypeError: URL constructor: https://"google.com is not a valid URL.
Expected results:
I'm not entirely sure. Chrome, Firefox and Safari all behave differently.
Chrome - https://%22google.com/
Safari - https://"google.com/
Firefox - TypeError: URL constructor: https://"google.com is not a valid URL.
As I say I'm not sure if Chrome, Firefox or Safari is "correct" as far as the spec is concerned. But from what I as a web developer expect I would say that Firefox or Chrome is correct.
Comment 2•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Updated•3 years ago
|
Comment 3•3 years ago
|
||
According to the reference implementation it seems Firefox might be in the wrong (webcompat-wise)
Firefox doesn't currently allow " in the hostname.
Potentially worth checking with the chrome team what their plans are. I'd hate for these bugs to flip both implementations and not actually end with interop. Personally I think interop is more important than spec compliance to most developers and certainly to me.
Comment 5•3 years ago
|
||
I am not very keen to allow "
in the hostname.
It is not an allowed DNS character anyway.
Anne, any opinion about this?
Comment 6•3 years ago
|
||
Per the specification "
is allowed. We don't have very strict host requirements as a) not everything browsers do is DNS-backed and b) even things that are DNS-backed don't always follow the rules (e.g., underscores in YouTube subdomains has been a thing).
It's possible to add further restrictions here, but ideally we'd come up with something principled and also consider other code points, such as '
, at the same time. Unless there's a compelling reason to do that I'd rather align with Safari here.
Updated•3 years ago
|
Comment 7•3 years ago
|
||
Thanks for the info. I'll try to schedule some time this quarter to work on improving our WPT pass rate.
Description
•