mirror of
https://github.com/denoland/deno.git
synced 2025-07-23 13:15:16 +00:00
fix(napi): return node globalThis from napi_get_global (#17613)
Fixes https://github.com/denoland/deno/issues/17587
This commit is contained in:
parent
1b46b2f0e4
commit
524bccdf6a
7 changed files with 68 additions and 6 deletions
|
@ -1718,12 +1718,12 @@ fn napi_get_element(
|
|||
#[napi_sym::napi_sym]
|
||||
fn napi_get_global(env: *mut Env, result: *mut napi_value) -> Result {
|
||||
check_env!(env);
|
||||
let env = unsafe { &mut *env };
|
||||
check_arg!(env, result);
|
||||
|
||||
let context = &mut env.scope().get_current_context();
|
||||
let global = context.global(&mut env.scope());
|
||||
let value: v8::Local<v8::Value> = global.into();
|
||||
let value: v8::Local<v8::Value> =
|
||||
transmute::<NonNull<v8::Value>, v8::Local<v8::Value>>((*env).global);
|
||||
*result = value.into();
|
||||
napi_clear_last_error(env);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue