diff --git a/lib/internal/url.js b/lib/internal/url.js index 0bd7e44155973b..61657df26305d2 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1100,6 +1100,10 @@ function installObjectURLMethods() { } function revokeObjectURL(url) { + if (arguments.length === 0) { + throw new ERR_MISSING_ARGS('url'); + } + bindingBlob.revokeObjectURL(`${url}`); } diff --git a/test/parallel/test-url-revokeobjecturl.js b/test/parallel/test-url-revokeobjecturl.js new file mode 100644 index 00000000000000..dae980c4d0074c --- /dev/null +++ b/test/parallel/test-url-revokeobjecturl.js @@ -0,0 +1,14 @@ +'use strict'; + +require('../common'); + +// Test ensures that the function receives the url argument. + +const assert = require('node:assert'); + +assert.throws(() => { + URL.revokeObjectURL(); +}, { + code: 'ERR_MISSING_ARGS', + name: 'TypeError', +});