Skip to content

Commit 2acbcbd

Browse files
DylanTetrichardlau
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 450163c commit 2acbcbd

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
@@ -1100,6 +1100,10 @@ function installObjectURLMethods() {
11001100
}
11011101

11021102
function revokeObjectURL(url) {
1103+
if (arguments.length === 0) {
1104+
throw new ERR_MISSING_ARGS('url');
1105+
}
1106+
11031107
bindingBlob.revokeObjectURL(`${url}`);
11041108
}
11051109

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