[whatwg/url] Allow `//` when base exists (#553)

As `new URL('http://localhost:3000//')` is allowed, `new URL('//', 'http://localhost:3000')` should work to have the same beheivour.

Steps to reproduce:
```js
new URL('http://localhost:3000//').pathname
// => '//'

new URL('//', 'http://localhost:3000').pathname
/home/daijiro/Developments/url/whatwg-url/dist/URL-impl.js:21
      throw new TypeError(`Invalid URL: ${url}`);
      ^

TypeError: Invalid URL: //
    at new URLImpl (/home/daijiro/Developments/url/whatwg-url/dist/URL-impl.js:21:13)
    at Object.exports.setup (/home/daijiro/Developments/url/whatwg-url/dist/URL.js:54:12)
    at new URL (/home/daijiro/Developments/url/whatwg-url/dist/URL.js:107:22)
    at Object.<anonymous> (/home/daijiro/Developments/url/whatwg-url/test.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
    at internal/main/run_main_module.js:17:11
```

-- 
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/553

Received on Saturday, 10 October 2020 04:44:45 UTC