[whatwg/url] Inconsistency between Chrome vs Node.js parsing (Issue #677)

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:

```js
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.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/677

Received on Tuesday, 14 December 2021 16:34:41 UTC