summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDj <43033058+DjDeveloperr@users.noreply.github.com>2023-06-21 13:11:58 +0530
committerGitHub <noreply@github.com>2023-06-21 13:11:58 +0530
commit6729e9c97736b8a394bae020f7be6ea8fa8305a2 (patch)
tree67dcfabac2b71df73665dc579f487edd03e02c72
parent544878cd2b7121ac80a4d22c04a3840d705a2a87 (diff)
fix(cli/napi): `napi_get_buffer_info` accepts `ArrayBufferView` … (#19551)
... not just `Uint8Array`. This PR aligns behavior with Node.js Node-API implementation.
-rw-r--r--cli/napi/js_native_api.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/cli/napi/js_native_api.rs b/cli/napi/js_native_api.rs
index 900a50f40..04121f0dc 100644
--- a/cli/napi/js_native_api.rs
+++ b/cli/napi/js_native_api.rs
@@ -1739,7 +1739,7 @@ fn napi_get_buffer_info(
check_env!(env);
let env = unsafe { &mut *env };
let value = napi_value_unchecked(value);
- let buf = v8::Local::<v8::Uint8Array>::try_from(value).unwrap();
+ let buf = v8::Local::<v8::ArrayBufferView>::try_from(value).unwrap();
let buffer_name = v8::String::new(&mut env.scope(), "buffer").unwrap();
let abuf = v8::Local::<v8::ArrayBuffer>::try_from(
buf.get(&mut env.scope(), buffer_name.into()).unwrap(),