diff options
author | Chengzhong Wu <legendecas@gmail.com> | 2023-01-07 05:37:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-06 22:37:42 +0100 |
commit | 82e930726ee5dbac8e6eae0962c07c72daf9843c (patch) | |
tree | aba0c34052254e46de873f1c8226d4f88bccc91e /core/bindings.rs | |
parent | d1cdf65b106e1bcb3a2b324c013f908c12d6368f (diff) |
fix(core): get v8 console from context extra bindings (#17243)
Explicitly get `console` object from V8 instead of relying on `console`
defined on the global object.
Diffstat (limited to 'core/bindings.rs')
-rw-r--r-- | core/bindings.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/bindings.rs b/core/bindings.rs index 07ad136ac..b9285a402 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -133,6 +133,12 @@ pub fn initialize_context<'s>( // Bind functions to Deno.core.* set_func(scope, core_obj, "callConsole", call_console); + // Bind v8 console object to Deno.core.console + let extra_binding_obj = context.get_extras_binding_object(scope); + let console_str = v8::String::new(scope, "console").unwrap(); + let console_obj = extra_binding_obj.get(scope, console_str.into()).unwrap(); + core_obj.set(scope, console_str.into(), console_obj); + // Bind functions to Deno.core.ops.* let ops_obj = v8::Object::new(scope); let ops_str = v8::String::new(scope, "ops").unwrap(); |