Closed Bug 1504962 Opened 6 years ago Closed 6 years ago

URL API does not parse out hostnames as specced

Categories

(Firefox :: Untriaged, defect)

64 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1374505

People

(Reporter: felix.b, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36

Steps to reproduce:

`new URL('ssh://github.com/test/repo.git')` 


Actual results:

The URL object has `hostname` "" and `pathname` "//github.com/test/repo.git".



Expected results:

The URL object should have `hostname` "github.com" and `pathname "/test/repo.git" according to the spec.

Repro website: https://felixfbecker.github.io/whatwg-url-custom-host-repro/
Filed on https://github.com/webcompat/web-bugs/issues/19792
Files on Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=902253
Specific test case added in https://github.com/web-platform-tests/wpt/pull/13516 (although also already covered in existing tests)

Firefox and Chrome both misbehave, while Edge, Safari, Node and whatwg-url behave spec-compliant.

This makes the URL API unreliable to use for generic URL parsing and always requires us to polyfill it (which is pretty big).
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.