Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL issues #46755

Closed
zloirock opened this issue Feb 21, 2023 · 7 comments · Fixed by ada-url/ada#225 or #46784
Closed

URL issues #46755

zloirock opened this issue Feb 21, 2023 · 7 comments · Fixed by ada-url/ada#225 or #46784
Assignees
Labels
confirmed-bug Issues with confirmed bugs. url Issues and PRs related to the legacy built-in url module. whatwg-url Issues and PRs related to the WHATWG URL implementation.

Comments

@zloirock
Copy link

Version

19.7

Platform

All

Subsystem

URL

What steps will reproduce the bug?

It seems after #46410:

const url = new URL('file:///var/log/system.log');
url.href = 'http://0300.168.0xF0';
url.href; // => 'file://192.168.0.240/', should be 'http://0300.168.0xF0'

new URL('', 'about:blank'); // should be an error, now it's not

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

No response

What is the expected behavior?

No response

What do you see instead?

^

Additional information

No response

zloirock added a commit to zloirock/core-js that referenced this issue Feb 21, 2023
@lpinca lpinca added the url Issues and PRs related to the legacy built-in url module. label Feb 21, 2023
@lpinca
Copy link
Member

lpinca commented Feb 21, 2023

cc: @nodejs/url @anonrig

@anonrig
Copy link
Member

anonrig commented Feb 21, 2023

const url = new URL('file:///var/log/system.log');
url.href = 'http://0300.168.0xF0';
url.href; // => 'file://192.168.0.240/', should be 'http://0300.168.0xF0'

This is an expected and in compliance with the WHATWG URL standard. url.href setter directly calls basic URL parser on the given value. Safari also returns the same. Reference: https://url.spec.whatwg.org/#dom-url-href

new URL('', 'about:blank'); // should be an error, now it's not

This is indeed a bug. Safari throws an error, but we don't. It seems like web platform tests do not cover this case.

@anonrig anonrig added confirmed-bug Issues with confirmed bugs. whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Feb 21, 2023
@anonrig anonrig self-assigned this Feb 21, 2023
@zloirock
Copy link
Author

This is an expected and in compliance with the WHATWG URL standard. url.href setter directly calls basic URL parser on the given value. Safari also returns the same. Reference: url.spec.whatwg.org/#dom-url-href

Nope. See the spec and ALL other implementations.

image

@anonrig
Copy link
Member

anonrig commented Feb 21, 2023

Your response also returns 192.168.0.240, the same as Node.js?

➜  url-parser git:(perf-improve-undici) ✗ node
Welcome to Node.js v19.7.0.
Type ".help" for more information.
> const url = new URL('file:///var/log/system.log');
undefined
> url.href = 'http://0300.168.0xF0';
'http://0300.168.0xF0'
> url.href
'file://192.168.0.240/'
>

@zloirock
Copy link
Author

See the protocol.

@anonrig
Copy link
Member

anonrig commented Feb 21, 2023

See the protocol.

I see. Looking into it now. Thanks.

@anonrig
Copy link
Member

anonrig commented Feb 21, 2023

Fixed the bug on Ada (ada-url/ada#225). Thanks for the issue. I'll release a new version of Ada in the next couple of days and update Node.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. url Issues and PRs related to the legacy built-in url module. whatwg-url Issues and PRs related to the WHATWG URL implementation.
Projects
None yet
3 participants