diff --git a/graal-nodejs/lib/internal/url.js b/graal-nodejs/lib/internal/url.js index 1cb733e1ae2..9e26e42b27a 100644 --- a/graal-nodejs/lib/internal/url.js +++ b/graal-nodejs/lib/internal/url.js @@ -623,6 +623,10 @@ function isURL(self) { class URL { constructor(input, base = undefined) { + if (arguments.length === 0) { + throw new ERR_MISSING_ARGS('url'); + } + // toUSVString is not needed. input = `${input}`; this[context] = new URLContext(); diff --git a/graal-nodejs/test/parallel/test-url-canParse-whatwg.js b/graal-nodejs/test/parallel/test-url-canParse-whatwg.js index 997c90c343c..7f7d5d40aa7 100644 --- a/graal-nodejs/test/parallel/test-url-canParse-whatwg.js +++ b/graal-nodejs/test/parallel/test-url-canParse-whatwg.js @@ -1,12 +1,12 @@ -'use strict'; - -require('../common'); -const assert = require('assert'); - -// One argument is required -assert.throws(() => { - URL.canParse(); -}, { - code: 'ERR_MISSING_ARGS', - name: 'TypeError' -}); +'use strict'; + +require('../common'); +const assert = require('assert'); + +// One argument is required +assert.throws(() => { + URL.canParse(); +}, { + code: 'ERR_MISSING_ARGS', + name: 'TypeError', +}); diff --git a/graal-nodejs/test/parallel/test-whatwg-url-custom-parsing.js b/graal-nodejs/test/parallel/test-whatwg-url-custom-parsing.js index a3532374ca6..905028fee38 100644 --- a/graal-nodejs/test/parallel/test-whatwg-url-custom-parsing.js +++ b/graal-nodejs/test/parallel/test-whatwg-url-custom-parsing.js @@ -78,3 +78,10 @@ for (const test of additional_tests) { if (test.search) assert.strictEqual(url.search, test.search); if (test.hash) assert.strictEqual(url.hash, test.hash); } + +assert.throws(() => { + new URL(); +}, { + name: 'TypeError', + code: 'ERR_MISSING_ARGS', +});