-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Closed
Labels
whatwg-urlIssues and PRs related to the WHATWG URL implementation.Issues and PRs related to the WHATWG URL implementation.
Description
- Version:
Node 12.10.0
- Platform:
macOS 64bit
- Subsystem:
When using new URL
in Nodejs the result of passing an invalid URL to the constructor is inconsistent with the result returned by the same call inside the browser. For example(where url == https://<script></script>
:
try {
let websiteURL = new URL(url);
} catch (error) {
console.error(err);
}
running the above in browser devtools return the following expected result:
TypeError: https://<script></script> is not a valid URL.
Running the same in Nodejs, returns the following:
URL {
href: 'https://<script></script%3E',
origin: 'https://<script><',
protocol: 'https:',
username: '',
password: '',
host: '<script><',
hostname: '<script><',
port: '',
pathname: '/script%3E',
search: '',
searchParams: URLSearchParams {},
hash: ''
}
Metadata
Metadata
Assignees
Labels
whatwg-urlIssues and PRs related to the WHATWG URL implementation.Issues and PRs related to the WHATWG URL implementation.