Skip to content

Commit 6a087ce

Browse files
DylanTettargos
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 PR-URL: #50433 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
1 parent 8e1a70a commit 6a087ce

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/internal/url.js

+4
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,10 @@ function installObjectURLMethods() {
11081108
}
11091109

11101110
function revokeObjectURL(url) {
1111+
if (arguments.length === 0) {
1112+
throw new ERR_MISSING_ARGS('url');
1113+
}
1114+
11111115
bindingBlob.revokeObjectURL(`${url}`);
11121116
}
11131117

+14
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)