Skip to content

Commit 5f66408

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 5f66408

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/internal/url.js

Lines changed: 4 additions & 0 deletions
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

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

0 commit comments

Comments
 (0)