Closed Bug 1877573 Opened 8 months ago Closed 8 months ago

URL constructor doesn't parse URL correctly

Categories

(Firefox :: Untriaged, defect)

Firefox 122
defect

Tracking

()

RESOLVED DUPLICATE of bug 1507354

People

(Reporter: nicholas, Unassigned)

Details

(Keywords: regression)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0

Steps to reproduce:

const url = new URL("file://foo/bar/baz")

Actual results:

Got these values for the properties:

host: ""
hostname: ""
href: "file:///bar/baz"
origin: "null",
pathname: "/bar/baz"
protocol: "file:"

Expected results:

host: "foo"
hostname: "foo"
href: "file://foo/bar/baz"
origin: "file://",
pathname: "/bar/baz"
protocol: "file:"

Parses exactly as the reference parser says it should: https://jsdom.github.io/whatwg-url/#url=ZmlsZTovL2Zvby9iYXIvYmF6&base=YWJvdXQ6Ymxhbms=

You may find const url = new URL("file:foo/bar/baz") is really what you're looking for here.

Status: UNCONFIRMED → RESOLVED
Closed: 8 months ago
Resolution: --- → INVALID
Keywords: regression
Regressed by: 1603699

It's not parsed as the specified. That is why some parts are red on jsdom.

Duplicate of bug: 1507354
Resolution: INVALID → DUPLICATE
No longer regressed by: 1603699
You need to log in before you can comment on or make changes to this bug.