summaryrefslogtreecommitdiff
path: root/ext/node/global.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-06-07 18:47:15 +0100
committerGitHub <noreply@github.com>2024-06-07 17:47:15 +0000
commit9dc0e33e67d331c7d95b95d5a6eb380d4b9c732e (patch)
treec16afd340b086fb2db79c0968557e75841839aa6 /ext/node/global.rs
parent3735a1a54225a058914f4356c2d271bb12fab6a7 (diff)
fix: upgrade deno_core (#24128)
Includes https://github.com/denoland/deno_core/pull/770 necessary for https://github.com/denoland/deno/pull/24101. Also includes https://github.com/denoland/deno_core/pull/769 that fixes https://github.com/denoland/deno/issues/24098 and https://github.com/denoland/deno/issues/24069 and https://github.com/denoland/deno/issues/24089.
Diffstat (limited to 'ext/node/global.rs')
-rw-r--r--ext/node/global.rs66
1 files changed, 35 insertions, 31 deletions
diff --git a/ext/node/global.rs b/ext/node/global.rs
index d2fe7a1e5..5c95b2f8f 100644
--- a/ext/node/global.rs
+++ b/ext/node/global.rs
@@ -15,13 +15,13 @@ use crate::resolution::NodeResolverRc;
// these mapped functions per-thread. We should revisit it in the future and
// ideally remove altogether.
thread_local! {
- pub static GETTER_MAP_FN: v8::GenericNamedPropertyGetterCallback<'static> = getter.map_fn_to();
- pub static SETTER_MAP_FN: v8::GenericNamedPropertySetterCallback<'static> = setter.map_fn_to();
- pub static QUERY_MAP_FN: v8::GenericNamedPropertyGetterCallback<'static> = query.map_fn_to();
- pub static DELETER_MAP_FN: v8::GenericNamedPropertyGetterCallback<'static> = deleter.map_fn_to();
- pub static ENUMERATOR_MAP_FN: v8::GenericNamedPropertyEnumeratorCallback<'static> = enumerator.map_fn_to();
- pub static DEFINER_MAP_FN: v8::GenericNamedPropertyDefinerCallback<'static> = definer.map_fn_to();
- pub static DESCRIPTOR_MAP_FN: v8::GenericNamedPropertyGetterCallback<'static> = descriptor.map_fn_to();
+ pub static GETTER_MAP_FN: v8::NamedPropertyGetterCallback<'static> = getter.map_fn_to();
+ pub static SETTER_MAP_FN: v8::NamedPropertySetterCallback<'static> = setter.map_fn_to();
+ pub static QUERY_MAP_FN: v8::NamedPropertyGetterCallback<'static> = query.map_fn_to();
+ pub static DELETER_MAP_FN: v8::NamedPropertyGetterCallback<'static> = deleter.map_fn_to();
+ pub static ENUMERATOR_MAP_FN: v8::NamedPropertyEnumeratorCallback<'static> = enumerator.map_fn_to();
+ pub static DEFINER_MAP_FN: v8::NamedPropertyDefinerCallback<'static> = definer.map_fn_to();
+ pub static DESCRIPTOR_MAP_FN: v8::NamedPropertyGetterCallback<'static> = descriptor.map_fn_to();
}
/// Convert an ASCII string to a UTF-16 byte encoding of the string.
@@ -287,9 +287,9 @@ pub fn getter<'s>(
key: v8::Local<'s, v8::Name>,
args: v8::PropertyCallbackArguments<'s>,
mut rv: v8::ReturnValue,
-) {
+) -> v8::Intercepted {
if !is_managed_key(scope, key) {
- return;
+ return v8::Intercepted::No;
};
let this = args.this();
@@ -311,10 +311,11 @@ pub fn getter<'s>(
undefined.into(),
&[inner.into(), key.into(), this.into()],
) else {
- return;
+ return v8::Intercepted::No;
};
rv.set(value);
+ v8::Intercepted::Yes
}
pub fn setter<'s>(
@@ -323,9 +324,9 @@ pub fn setter<'s>(
value: v8::Local<'s, v8::Value>,
args: v8::PropertyCallbackArguments<'s>,
mut rv: v8::ReturnValue,
-) {
+) -> v8::Intercepted {
if !is_managed_key(scope, key) {
- return;
+ return v8::Intercepted::No;
};
let this = args.this();
@@ -348,10 +349,11 @@ pub fn setter<'s>(
undefined.into(),
&[inner.into(), key.into(), value, this.into()],
) else {
- return;
+ return v8::Intercepted::No;
};
rv.set(success);
+ v8::Intercepted::Yes
}
pub fn query<'s>(
@@ -359,9 +361,9 @@ pub fn query<'s>(
key: v8::Local<'s, v8::Name>,
_args: v8::PropertyCallbackArguments<'s>,
mut rv: v8::ReturnValue,
-) {
+) -> v8::Intercepted {
if !is_managed_key(scope, key) {
- return;
+ return v8::Intercepted::No;
};
let mode = current_mode(scope);
@@ -373,15 +375,16 @@ pub fn query<'s>(
let inner = v8::Local::new(scope, inner);
let Some(true) = inner.has_own_property(scope, key) else {
- return;
+ return v8::Intercepted::No;
};
let Some(attributes) = inner.get_property_attributes(scope, key.into())
else {
- return;
+ return v8::Intercepted::No;
};
rv.set_uint32(attributes.as_u32());
+ v8::Intercepted::Yes
}
pub fn deleter<'s>(
@@ -389,9 +392,9 @@ pub fn deleter<'s>(
key: v8::Local<'s, v8::Name>,
args: v8::PropertyCallbackArguments<'s>,
mut rv: v8::ReturnValue,
-) {
+) -> v8::Intercepted {
if !is_managed_key(scope, key) {
- return;
+ return v8::Intercepted::No;
};
let mode = current_mode(scope);
@@ -404,17 +407,18 @@ pub fn deleter<'s>(
let inner = v8::Local::new(scope, inner);
let Some(success) = inner.delete(scope, key.into()) else {
- return;
+ return v8::Intercepted::No;
};
if args.should_throw_on_error() && !success {
let message = v8::String::new(scope, "Cannot delete property").unwrap();
let exception = v8::Exception::type_error(scope, message);
scope.throw_exception(exception);
- return;
+ return v8::Intercepted::Yes;
}
rv.set_bool(success);
+ v8::Intercepted::Yes
}
pub fn enumerator<'s>(
@@ -450,10 +454,10 @@ pub fn definer<'s>(
key: v8::Local<'s, v8::Name>,
descriptor: &v8::PropertyDescriptor,
args: v8::PropertyCallbackArguments<'s>,
- mut rv: v8::ReturnValue,
-) {
+ _rv: v8::ReturnValue,
+) -> v8::Intercepted {
if !is_managed_key(scope, key) {
- return;
+ return v8::Intercepted::No;
};
let mode = current_mode(scope);
@@ -466,17 +470,16 @@ pub fn definer<'s>(
let inner = v8::Local::new(scope, inner);
let Some(success) = inner.define_property(scope, key, descriptor) else {
- return;
+ return v8::Intercepted::No;
};
if args.should_throw_on_error() && !success {
let message = v8::String::new(scope, "Cannot define property").unwrap();
let exception = v8::Exception::type_error(scope, message);
scope.throw_exception(exception);
- return;
}
- rv.set_bool(success);
+ v8::Intercepted::Yes
}
pub fn descriptor<'s>(
@@ -484,9 +487,9 @@ pub fn descriptor<'s>(
key: v8::Local<'s, v8::Name>,
_args: v8::PropertyCallbackArguments<'s>,
mut rv: v8::ReturnValue,
-) {
+) -> v8::Intercepted {
if !is_managed_key(scope, key) {
- return;
+ return v8::Intercepted::No;
};
let mode = current_mode(scope);
@@ -502,12 +505,13 @@ pub fn descriptor<'s>(
let Some(descriptor) = inner.get_own_property_descriptor(scope, key) else {
scope.rethrow().expect("to have caught an exception");
- return;
+ return v8::Intercepted::Yes;
};
if descriptor.is_undefined() {
- return;
+ return v8::Intercepted::No;
}
rv.set(descriptor);
+ v8::Intercepted::Yes
}