Skip to content

wrong result after setting port to a string that doesn't parse as a number #46861

@meixg

Description

@meixg

Version

v20.0.0-pre

Platform

Linux meixg-desktop 5.11.0-43-generic #47~20.04.2-Ubuntu SMP Mon Dec 13 11:06:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

let u = new URL('http://example.net:8080/path')
u.port = 'randomstring'

How often does it reproduce? Is there a required condition?

always

What is the expected behavior?

{
    "href": "http://example.net:8080/path",
    "host": "example.net:8080",
    "hostname": "example.net",
    "port": "8080"
}

What do you see instead?

{
  href: 'http://example.net/path',
  host: 'example.net',
  hostname: 'example.net',
  port: ''
}

Additional information

https://github.com/web-platform-tests/wpt/blob/master/url/resources/setters_tests.json#L1596

#46860

Metadata

Metadata

Assignees

No one assigned

    Labels

    whatwg-urlIssues and PRs related to the WHATWG URL implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions