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

Inconsistency between Chrome vs Node.js parsing #677

Closed
char0n opened this issue Dec 14, 2021 · 3 comments
Closed

Inconsistency between Chrome vs Node.js parsing #677

char0n opened this issue Dec 14, 2021 · 3 comments

Comments

@char0n
Copy link

char0n commented Dec 14, 2021

Hello all,

I'm not sure this is the right place to report this, but I found an inconsistent behavior of URL constructor in different environments.

Given following construction:

new URL('', 'resolve://')

Here is what happens in different environments I tested:

Env Behavior
Google Chrome 96.0.4664.110 Throws VM2548:1 Uncaught TypeError: Failed to construct 'URL': Invalid URL
Firefox 95.0 (64-bit) parses successfully
Node.js >= 12.20.x parses successfully

Node.js actually has a documentation section where it gives guide lines how to port url.resolve into WHATWG URL. This example is using resolve:// protocol. I do have an isomorphic needs (running the same code in browser and Node.js) and this inconsistency is causing very nasty bugs in Chrome. Not sure what other browsers are affected.

@domenic
Copy link
Member

domenic commented Dec 14, 2021

Yep, this is a known Chrome bug. https://jsdom.github.io/whatwg-url/#url=&base=cmVzb2x2ZTovLw== shows how the spec expects this to resolve.

You can follow the general project of aligning Chrome with the URL Standard at https://bugs.chromium.org/p/chromium/issues/detail?id=660384 ; I suspect this issue is https://bugs.chromium.org/p/chromium/issues/detail?id=869291

I'll close this since the correct place to discuss implementation bugs is the Chromium issue tracker.

@domenic domenic closed this as completed Dec 14, 2021
@domenic
Copy link
Member

domenic commented Dec 14, 2021

https://jsdom.github.io/whatwg-url/#url=&base=cmVzb2x2ZTovLw== shows how the spec expects this to resolve.

Hmm, I think live URL viewer doesn't like empty strings for #url, so that link won't work. But you can input your values into https://jsdom.github.io/whatwg-url/ manually to see the results.

@char0n
Copy link
Author

char0n commented Dec 15, 2021

THanks for all the links!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants