diff options
author | Benjamin Gruenbaum <benji@peer5.com> | 2018-03-12 15:40:00 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-04-10 00:27:09 +0200 |
commit | cc6abc6e84b96fd5f1c4123066eba93ddb637e60 (patch) | |
tree | 433420e2df329143ab051e266e225b207cf5fb18 /lib/internal/url.js | |
parent | b80da63b99dc27fcf9b15b65d7166d427a563b3d (diff) | |
download | android-node-v8-cc6abc6e84b96fd5f1c4123066eba93ddb637e60.tar.gz android-node-v8-cc6abc6e84b96fd5f1c4123066eba93ddb637e60.tar.bz2 android-node-v8-cc6abc6e84b96fd5f1c4123066eba93ddb637e60.zip |
url: fix error type
Currently whatwg URLs fail with an incorrect error when null is
passed as the base. Adding a check before accessing a symbol
for the URL makes the URL error correctly. Add test for it.
PR-URL: https://github.com/nodejs/node/pull/19299
Fixes: https://github.com/nodejs/node/issues/19254
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/url.js')
-rw-r--r-- | lib/internal/url.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/internal/url.js b/lib/internal/url.js index 21c7c734b5..8c83ca86c3 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -319,8 +319,7 @@ class URL { constructor(input, base) { // toUSVString is not needed. input = `${input}`; - if (base !== undefined && - (!base[searchParams] || !base[searchParams][searchParams])) { + if (base !== undefined) { base = new URL(base); } parse(this, input, base); |