Skip to content

Commit fe65184

Browse files
DylanTetdeokjinkim
authored andcommitted
url: throw error if argument length of revokeObjectURL is 0
Added a check to see if url wasn't included as an argument which will then throw an error. Fixes: #50432
1 parent 69866bf commit fe65184

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/internal/url.js

+4
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,10 @@ function installObjectURLMethods() {
11041104
}
11051105

11061106
function revokeObjectURL(url) {
1107+
if (arguments.length === 0) {
1108+
throw new ERR_MISSING_ARGS('url');
1109+
}
1110+
11071111
bindingBlob.revokeObjectURL(`${url}`);
11081112
}
11091113

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
// Test ensures that the function receives the url argument.
4+
5+
const assert = require('node:assert');
6+
require('../common');
7+
8+
assert.throws(() => {
9+
URL.revokeObjectURL();
10+
}, {
11+
code: 'ERR_MISSING_ARGS',
12+
name: 'TypeError',
13+
});

0 commit comments

Comments
 (0)