diff --git a/graal-nodejs/lib/internal/url.js b/graal-nodejs/lib/internal/url.js index 9c11377aef1..1cb733e1ae2 100644 --- a/graal-nodejs/lib/internal/url.js +++ b/graal-nodejs/lib/internal/url.js @@ -964,6 +964,10 @@ class URL { } static canParse(url, base = undefined) { + if (arguments.length === 0) { + throw new ERR_MISSING_ARGS('url'); + } + url = `${url}`; if (base !== undefined) { diff --git a/graal-nodejs/test/parallel/test-url-canParse-whatwg.js b/graal-nodejs/test/parallel/test-url-canParse-whatwg.js new file mode 100644 index 00000000000..997c90c343c --- /dev/null +++ b/graal-nodejs/test/parallel/test-url-canParse-whatwg.js @@ -0,0 +1,12 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +// One argument is required +assert.throws(() => { + URL.canParse(); +}, { + code: 'ERR_MISSING_ARGS', + name: 'TypeError' +});