mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
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.
This commit is contained in:
parent
ab07129ee7
commit
f7613eac84
2 changed files with 8 additions and 2 deletions
|
@ -133,6 +133,12 @@ pub fn initialize_context<'s>(
|
||||||
// Bind functions to Deno.core.*
|
// Bind functions to Deno.core.*
|
||||||
set_func(scope, core_obj, "callConsole", call_console);
|
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.*
|
// Bind functions to Deno.core.ops.*
|
||||||
let ops_obj = v8::Object::new(scope);
|
let ops_obj = v8::Object::new(scope);
|
||||||
let ops_str = v8::String::new(scope, "ops").unwrap();
|
let ops_str = v8::String::new(scope, "ops").unwrap();
|
||||||
|
|
|
@ -399,7 +399,7 @@ delete Intl.v8BreakIterator;
|
||||||
performance.setTimeOrigin(DateNow());
|
performance.setTimeOrigin(DateNow());
|
||||||
net.setup(runtimeOptions.unstableFlag);
|
net.setup(runtimeOptions.unstableFlag);
|
||||||
|
|
||||||
const consoleFromV8 = window.console;
|
const consoleFromV8 = window.Deno.core.console;
|
||||||
const wrapConsole = window.__bootstrap.console.wrapConsole;
|
const wrapConsole = window.__bootstrap.console.wrapConsole;
|
||||||
|
|
||||||
// Remove bootstrapping data from the global scope
|
// Remove bootstrapping data from the global scope
|
||||||
|
@ -544,7 +544,7 @@ delete Intl.v8BreakIterator;
|
||||||
performance.setTimeOrigin(DateNow());
|
performance.setTimeOrigin(DateNow());
|
||||||
net.setup(runtimeOptions.unstableFlag);
|
net.setup(runtimeOptions.unstableFlag);
|
||||||
|
|
||||||
const consoleFromV8 = window.console;
|
const consoleFromV8 = window.Deno.core.console;
|
||||||
const wrapConsole = window.__bootstrap.console.wrapConsole;
|
const wrapConsole = window.__bootstrap.console.wrapConsole;
|
||||||
|
|
||||||
// Remove bootstrapping data from the global scope
|
// Remove bootstrapping data from the global scope
|
||||||
|
|
Loading…
Reference in a new issue