Open Bug 1729733 Opened 3 years ago Updated 3 years ago

Compat problem with new URL()

Categories

(Core :: Networking, defect, P3)

Firefox 92
defect

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:

  1. Navigate to https://jsfiddle.net/40abpv7d/
  2. 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.

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.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Component: DOM: Core & HTML → Networking

According to the reference implementation it seems Firefox might be in the wrong (webcompat-wise)

Firefox doesn't currently allow " in the hostname.

Blocks: url

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.

I am not very keen to allow " in the hostname.
It is not an allowed DNS character anyway.
Anne, any opinion about this?

Severity: -- → S3
Flags: needinfo?(annevk)
Priority: -- → P3

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.

Flags: needinfo?(annevk)
Whiteboard: [necko-triaged]

Thanks for the info. I'll try to schedule some time this quarter to work on improving our WPT pass rate.

Status: UNCONFIRMED → NEW
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.