diff --git a/core/bindings.rs b/core/bindings.rs index 7b3abc60243440..cf4fd07f693738 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -180,6 +180,7 @@ pub fn set_func( let key = v8::String::new(scope, name).unwrap(); let tmpl = v8::FunctionTemplate::new(scope, callback); let val = tmpl.get_function(scope).unwrap(); + val.set_name(key); obj.set(scope, key.into(), val.into()); } diff --git a/core/runtime.rs b/core/runtime.rs index e4fe8cd6c59728..1150746f35ce75 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -2303,4 +2303,18 @@ assertEquals(1, notify_return_value); let all_true = v8::Local::::new(&mut scope, &all_true); assert!(all_true.is_true()); } + + #[test] + fn test_binding_names() { + let mut runtime = JsRuntime::new(RuntimeOptions::default()); + let all_true: v8::Global = runtime + .execute_script( + "binding_names.js", + "Deno.core.encode.toString() === 'function encode() { [native code] }'", + ) + .unwrap(); + let mut scope = runtime.handle_scope(); + let all_true = v8::Local::::new(&mut scope, &all_true); + assert!(all_true.is_true()); + } }