1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

fix(core): throw on invalid callConsole args (#12973)

Instead of panicking via asserts, since JS-callable code (even Deno.core ...) should not cause process crashes/panics
This commit is contained in:
Aaron O'Mullan 2021-12-03 11:55:14 +01:00 committed by GitHub
parent 14f4102ece
commit f6d4a63c7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -794,10 +794,12 @@ fn call_console(
args: v8::FunctionCallbackArguments, args: v8::FunctionCallbackArguments,
_rv: v8::ReturnValue, _rv: v8::ReturnValue,
) { ) {
assert!(args.length() >= 2); if args.length() < 2
|| !args.get(0).is_function()
assert!(args.get(0).is_function()); || !args.get(1).is_function()
assert!(args.get(1).is_function()); {
return throw_type_error(scope, "Invalid arguments");
}
let mut call_args = vec![]; let mut call_args = vec![];
for i in 2..args.length() { for i in 2..args.length() {