mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-22 04:40:01 +00:00
chore: Update use of deprecated APIs (#1481)
This commit updates APIs related to named and indexed property handlers to not use deprecated V8 APIs. Main change is the change of return value in callbacks that now requires to return v8::Intercepted enum. Towards #1478
This commit is contained in:
parent
f9043140a3
commit
cf3f19c512
@ -1218,25 +1218,26 @@ void v8__ObjectTemplate__SetInternalFieldCount(const v8::ObjectTemplate& self,
|
|||||||
ptr_to_local(&self)->SetInternalFieldCount(value);
|
ptr_to_local(&self)->SetInternalFieldCount(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void v8__ObjectTemplate__SetAccessor(const v8::ObjectTemplate& self,
|
void v8__ObjectTemplate__SetNativeDataProperty(
|
||||||
|
const v8::ObjectTemplate& self,
|
||||||
const v8::Name& key,
|
const v8::Name& key,
|
||||||
v8::AccessorNameGetterCallback getter,
|
v8::AccessorNameGetterCallback getter,
|
||||||
v8::AccessorNameSetterCallback setter,
|
v8::AccessorNameSetterCallback setter,
|
||||||
const v8::Value* data_or_null,
|
const v8::Value* data_or_null,
|
||||||
v8::PropertyAttribute attr) {
|
v8::PropertyAttribute attr) {
|
||||||
ptr_to_local(&self)->SetAccessor(ptr_to_local(&key), getter, setter,
|
ptr_to_local(&self)->SetNativeDataProperty(ptr_to_local(&key),
|
||||||
ptr_to_local(data_or_null), attr);
|
getter, setter, ptr_to_local(data_or_null), attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void v8__ObjectTemplate__SetNamedPropertyHandler(
|
void v8__ObjectTemplate__SetNamedPropertyHandler(
|
||||||
const v8::ObjectTemplate& self,
|
const v8::ObjectTemplate& self,
|
||||||
v8::GenericNamedPropertyGetterCallback getter,
|
v8::NamedPropertyGetterCallback getter,
|
||||||
v8::GenericNamedPropertySetterCallback setter,
|
v8::NamedPropertySetterCallback setter,
|
||||||
v8::GenericNamedPropertyQueryCallback query,
|
v8::NamedPropertyQueryCallback query,
|
||||||
v8::GenericNamedPropertyDeleterCallback deleter,
|
v8::NamedPropertyDeleterCallback deleter,
|
||||||
v8::GenericNamedPropertyEnumeratorCallback enumerator,
|
v8::NamedPropertyEnumeratorCallback enumerator,
|
||||||
v8::GenericNamedPropertyDefinerCallback definer,
|
v8::NamedPropertyDefinerCallback definer,
|
||||||
v8::GenericNamedPropertyDescriptorCallback descriptor,
|
v8::NamedPropertyDescriptorCallback descriptor,
|
||||||
const v8::Value* data_or_null, v8::PropertyHandlerFlags flags) {
|
const v8::Value* data_or_null, v8::PropertyHandlerFlags flags) {
|
||||||
ptr_to_local(&self)->SetHandler(v8::NamedPropertyHandlerConfiguration(
|
ptr_to_local(&self)->SetHandler(v8::NamedPropertyHandlerConfiguration(
|
||||||
getter, setter, query, deleter, enumerator, definer, descriptor,
|
getter, setter, query, deleter, enumerator, definer, descriptor,
|
||||||
@ -1244,13 +1245,13 @@ void v8__ObjectTemplate__SetNamedPropertyHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void v8__ObjectTemplate__SetIndexedPropertyHandler(
|
void v8__ObjectTemplate__SetIndexedPropertyHandler(
|
||||||
const v8::ObjectTemplate& self, v8::IndexedPropertyGetterCallback getter,
|
const v8::ObjectTemplate& self, v8::IndexedPropertyGetterCallbackV2 getter,
|
||||||
v8::IndexedPropertySetterCallback setter,
|
v8::IndexedPropertySetterCallbackV2 setter,
|
||||||
v8::IndexedPropertyQueryCallback query,
|
v8::IndexedPropertyQueryCallbackV2 query,
|
||||||
v8::IndexedPropertyDeleterCallback deleter,
|
v8::IndexedPropertyDeleterCallbackV2 deleter,
|
||||||
v8::IndexedPropertyEnumeratorCallback enumerator,
|
v8::IndexedPropertyEnumeratorCallback enumerator,
|
||||||
v8::IndexedPropertyDefinerCallback definer,
|
v8::IndexedPropertyDefinerCallbackV2 definer,
|
||||||
v8::IndexedPropertyDescriptorCallback descriptor,
|
v8::IndexedPropertyDescriptorCallbackV2 descriptor,
|
||||||
const v8::Value* data_or_null, v8::PropertyHandlerFlags flags) {
|
const v8::Value* data_or_null, v8::PropertyHandlerFlags flags) {
|
||||||
ptr_to_local(&self)->SetHandler(v8::IndexedPropertyHandlerConfiguration(
|
ptr_to_local(&self)->SetHandler(v8::IndexedPropertyHandlerConfiguration(
|
||||||
getter, setter, query, deleter, enumerator, definer, descriptor,
|
getter, setter, query, deleter, enumerator, definer, descriptor,
|
||||||
|
@ -10,6 +10,7 @@ use crate::support::MapFnTo;
|
|||||||
use crate::support::ToCFn;
|
use crate::support::ToCFn;
|
||||||
use crate::support::UnitType;
|
use crate::support::UnitType;
|
||||||
use crate::support::{int, Opaque};
|
use crate::support::{int, Opaque};
|
||||||
|
use crate::template::Intercepted;
|
||||||
use crate::Context;
|
use crate::Context;
|
||||||
use crate::Function;
|
use crate::Function;
|
||||||
use crate::HandleScope;
|
use crate::HandleScope;
|
||||||
@ -543,10 +544,10 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) type NamedGetterCallback<'s> =
|
pub(crate) type NamedGetterCallbackForAccessor<'s> =
|
||||||
extern "C" fn(Local<'s, Name>, *const PropertyCallbackInfo);
|
extern "C" fn(Local<'s, Name>, *const PropertyCallbackInfo);
|
||||||
|
|
||||||
impl<F> MapFnFrom<F> for NamedGetterCallback<'_>
|
impl<F> MapFnFrom<F> for NamedGetterCallbackForAccessor<'_>
|
||||||
where
|
where
|
||||||
F: UnitType
|
F: UnitType
|
||||||
+ for<'s> Fn(
|
+ for<'s> Fn(
|
||||||
@ -568,10 +569,35 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) type NamedSetterCallback<'s> =
|
pub(crate) type NamedGetterCallback<'s> =
|
||||||
|
extern "C" fn(Local<'s, Name>, *const PropertyCallbackInfo) -> Intercepted;
|
||||||
|
|
||||||
|
impl<F> MapFnFrom<F> for NamedGetterCallback<'_>
|
||||||
|
where
|
||||||
|
F: UnitType
|
||||||
|
+ for<'s> Fn(
|
||||||
|
&mut HandleScope<'s>,
|
||||||
|
Local<'s, Name>,
|
||||||
|
PropertyCallbackArguments<'s>,
|
||||||
|
ReturnValue,
|
||||||
|
) -> Intercepted,
|
||||||
|
{
|
||||||
|
fn mapping() -> Self {
|
||||||
|
let f = |key: Local<Name>, info: *const PropertyCallbackInfo| {
|
||||||
|
let info = unsafe { &*info };
|
||||||
|
let scope = &mut unsafe { CallbackScope::new(info) };
|
||||||
|
let args = PropertyCallbackArguments::from_property_callback_info(info);
|
||||||
|
let rv = ReturnValue::from_property_callback_info(info);
|
||||||
|
(F::get())(scope, key, args, rv)
|
||||||
|
};
|
||||||
|
f.to_c_fn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) type NamedSetterCallbackForAccessor<'s> =
|
||||||
extern "C" fn(Local<'s, Name>, Local<'s, Value>, *const PropertyCallbackInfo);
|
extern "C" fn(Local<'s, Name>, Local<'s, Value>, *const PropertyCallbackInfo);
|
||||||
|
|
||||||
impl<F> MapFnFrom<F> for NamedSetterCallback<'_>
|
impl<F> MapFnFrom<F> for NamedSetterCallbackForAccessor<'_>
|
||||||
where
|
where
|
||||||
F: UnitType
|
F: UnitType
|
||||||
+ for<'s> Fn(
|
+ for<'s> Fn(
|
||||||
@ -596,6 +622,37 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) type NamedSetterCallback<'s> = extern "C" fn(
|
||||||
|
Local<'s, Name>,
|
||||||
|
Local<'s, Value>,
|
||||||
|
*const PropertyCallbackInfo,
|
||||||
|
) -> Intercepted;
|
||||||
|
|
||||||
|
impl<F> MapFnFrom<F> for NamedSetterCallback<'_>
|
||||||
|
where
|
||||||
|
F: UnitType
|
||||||
|
+ for<'s> Fn(
|
||||||
|
&mut HandleScope<'s>,
|
||||||
|
Local<'s, Name>,
|
||||||
|
Local<'s, Value>,
|
||||||
|
PropertyCallbackArguments<'s>,
|
||||||
|
ReturnValue,
|
||||||
|
) -> Intercepted,
|
||||||
|
{
|
||||||
|
fn mapping() -> Self {
|
||||||
|
let f = |key: Local<Name>,
|
||||||
|
value: Local<Value>,
|
||||||
|
info: *const PropertyCallbackInfo| {
|
||||||
|
let info = unsafe { &*info };
|
||||||
|
let scope = &mut unsafe { CallbackScope::new(info) };
|
||||||
|
let args = PropertyCallbackArguments::from_property_callback_info(info);
|
||||||
|
let rv = ReturnValue::from_property_callback_info(info);
|
||||||
|
(F::get())(scope, key, value, args, rv)
|
||||||
|
};
|
||||||
|
f.to_c_fn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Should return an Array in Return Value
|
// Should return an Array in Return Value
|
||||||
pub(crate) type PropertyEnumeratorCallback<'s> =
|
pub(crate) type PropertyEnumeratorCallback<'s> =
|
||||||
extern "C" fn(*const PropertyCallbackInfo);
|
extern "C" fn(*const PropertyCallbackInfo);
|
||||||
@ -621,7 +678,7 @@ pub(crate) type NamedDefinerCallback<'s> = extern "C" fn(
|
|||||||
Local<'s, Name>,
|
Local<'s, Name>,
|
||||||
*const PropertyDescriptor,
|
*const PropertyDescriptor,
|
||||||
*const PropertyCallbackInfo,
|
*const PropertyCallbackInfo,
|
||||||
);
|
) -> Intercepted;
|
||||||
|
|
||||||
impl<F> MapFnFrom<F> for NamedDefinerCallback<'_>
|
impl<F> MapFnFrom<F> for NamedDefinerCallback<'_>
|
||||||
where
|
where
|
||||||
@ -632,7 +689,7 @@ where
|
|||||||
&PropertyDescriptor,
|
&PropertyDescriptor,
|
||||||
PropertyCallbackArguments<'s>,
|
PropertyCallbackArguments<'s>,
|
||||||
ReturnValue,
|
ReturnValue,
|
||||||
),
|
) -> Intercepted,
|
||||||
{
|
{
|
||||||
fn mapping() -> Self {
|
fn mapping() -> Self {
|
||||||
let f = |key: Local<Name>,
|
let f = |key: Local<Name>,
|
||||||
@ -643,14 +700,14 @@ where
|
|||||||
let args = PropertyCallbackArguments::from_property_callback_info(info);
|
let args = PropertyCallbackArguments::from_property_callback_info(info);
|
||||||
let desc = unsafe { &*desc };
|
let desc = unsafe { &*desc };
|
||||||
let rv = ReturnValue::from_property_callback_info(info);
|
let rv = ReturnValue::from_property_callback_info(info);
|
||||||
(F::get())(scope, key, desc, args, rv);
|
(F::get())(scope, key, desc, args, rv)
|
||||||
};
|
};
|
||||||
f.to_c_fn()
|
f.to_c_fn()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) type IndexedGetterCallback<'s> =
|
pub(crate) type IndexedGetterCallback<'s> =
|
||||||
extern "C" fn(u32, *const PropertyCallbackInfo);
|
extern "C" fn(u32, *const PropertyCallbackInfo) -> Intercepted;
|
||||||
|
|
||||||
impl<F> MapFnFrom<F> for IndexedGetterCallback<'_>
|
impl<F> MapFnFrom<F> for IndexedGetterCallback<'_>
|
||||||
where
|
where
|
||||||
@ -660,7 +717,7 @@ where
|
|||||||
u32,
|
u32,
|
||||||
PropertyCallbackArguments<'s>,
|
PropertyCallbackArguments<'s>,
|
||||||
ReturnValue,
|
ReturnValue,
|
||||||
),
|
) -> Intercepted,
|
||||||
{
|
{
|
||||||
fn mapping() -> Self {
|
fn mapping() -> Self {
|
||||||
let f = |index: u32, info: *const PropertyCallbackInfo| {
|
let f = |index: u32, info: *const PropertyCallbackInfo| {
|
||||||
@ -668,14 +725,17 @@ where
|
|||||||
let scope = &mut unsafe { CallbackScope::new(info) };
|
let scope = &mut unsafe { CallbackScope::new(info) };
|
||||||
let args = PropertyCallbackArguments::from_property_callback_info(info);
|
let args = PropertyCallbackArguments::from_property_callback_info(info);
|
||||||
let rv = ReturnValue::from_property_callback_info(info);
|
let rv = ReturnValue::from_property_callback_info(info);
|
||||||
(F::get())(scope, index, args, rv);
|
(F::get())(scope, index, args, rv)
|
||||||
};
|
};
|
||||||
f.to_c_fn()
|
f.to_c_fn()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) type IndexedSetterCallback<'s> =
|
pub(crate) type IndexedSetterCallback<'s> = extern "C" fn(
|
||||||
extern "C" fn(u32, Local<'s, Value>, *const PropertyCallbackInfo);
|
u32,
|
||||||
|
Local<'s, Value>,
|
||||||
|
*const PropertyCallbackInfo,
|
||||||
|
) -> Intercepted;
|
||||||
|
|
||||||
impl<F> MapFnFrom<F> for IndexedSetterCallback<'_>
|
impl<F> MapFnFrom<F> for IndexedSetterCallback<'_>
|
||||||
where
|
where
|
||||||
@ -686,7 +746,7 @@ where
|
|||||||
Local<'s, Value>,
|
Local<'s, Value>,
|
||||||
PropertyCallbackArguments<'s>,
|
PropertyCallbackArguments<'s>,
|
||||||
ReturnValue,
|
ReturnValue,
|
||||||
),
|
) -> Intercepted,
|
||||||
{
|
{
|
||||||
fn mapping() -> Self {
|
fn mapping() -> Self {
|
||||||
let f =
|
let f =
|
||||||
@ -695,14 +755,17 @@ where
|
|||||||
let scope = &mut unsafe { CallbackScope::new(info) };
|
let scope = &mut unsafe { CallbackScope::new(info) };
|
||||||
let args = PropertyCallbackArguments::from_property_callback_info(info);
|
let args = PropertyCallbackArguments::from_property_callback_info(info);
|
||||||
let rv = ReturnValue::from_property_callback_info(info);
|
let rv = ReturnValue::from_property_callback_info(info);
|
||||||
(F::get())(scope, index, value, args, rv);
|
(F::get())(scope, index, value, args, rv)
|
||||||
};
|
};
|
||||||
f.to_c_fn()
|
f.to_c_fn()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) type IndexedDefinerCallback<'s> =
|
pub(crate) type IndexedDefinerCallback<'s> = extern "C" fn(
|
||||||
extern "C" fn(u32, *const PropertyDescriptor, *const PropertyCallbackInfo);
|
u32,
|
||||||
|
*const PropertyDescriptor,
|
||||||
|
*const PropertyCallbackInfo,
|
||||||
|
) -> Intercepted;
|
||||||
|
|
||||||
impl<F> MapFnFrom<F> for IndexedDefinerCallback<'_>
|
impl<F> MapFnFrom<F> for IndexedDefinerCallback<'_>
|
||||||
where
|
where
|
||||||
@ -713,7 +776,7 @@ where
|
|||||||
&PropertyDescriptor,
|
&PropertyDescriptor,
|
||||||
PropertyCallbackArguments<'s>,
|
PropertyCallbackArguments<'s>,
|
||||||
ReturnValue,
|
ReturnValue,
|
||||||
),
|
) -> Intercepted,
|
||||||
{
|
{
|
||||||
fn mapping() -> Self {
|
fn mapping() -> Self {
|
||||||
let f = |index: u32,
|
let f = |index: u32,
|
||||||
@ -724,7 +787,7 @@ where
|
|||||||
let args = PropertyCallbackArguments::from_property_callback_info(info);
|
let args = PropertyCallbackArguments::from_property_callback_info(info);
|
||||||
let rv = ReturnValue::from_property_callback_info(info);
|
let rv = ReturnValue::from_property_callback_info(info);
|
||||||
let desc = unsafe { &*desc };
|
let desc = unsafe { &*desc };
|
||||||
(F::get())(scope, index, desc, args, rv);
|
(F::get())(scope, index, desc, args, rv)
|
||||||
};
|
};
|
||||||
f.to_c_fn()
|
f.to_c_fn()
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,9 @@ use crate::IndexedSetterCallback;
|
|||||||
use crate::Local;
|
use crate::Local;
|
||||||
use crate::NamedDefinerCallback;
|
use crate::NamedDefinerCallback;
|
||||||
use crate::NamedGetterCallback;
|
use crate::NamedGetterCallback;
|
||||||
|
use crate::NamedGetterCallbackForAccessor;
|
||||||
use crate::NamedSetterCallback;
|
use crate::NamedSetterCallback;
|
||||||
|
use crate::NamedSetterCallbackForAccessor;
|
||||||
use crate::Object;
|
use crate::Object;
|
||||||
use crate::PropertyAttribute;
|
use crate::PropertyAttribute;
|
||||||
use crate::PropertyEnumeratorCallback;
|
use crate::PropertyEnumeratorCallback;
|
||||||
@ -94,7 +96,7 @@ extern "C" {
|
|||||||
value: int,
|
value: int,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn v8__ObjectTemplate__SetAccessor(
|
fn v8__ObjectTemplate__SetNativeDataProperty(
|
||||||
this: *const ObjectTemplate,
|
this: *const ObjectTemplate,
|
||||||
key: *const Name,
|
key: *const Name,
|
||||||
getter: AccessorNameGetterCallback,
|
getter: AccessorNameGetterCallback,
|
||||||
@ -112,13 +114,13 @@ extern "C" {
|
|||||||
|
|
||||||
fn v8__ObjectTemplate__SetNamedPropertyHandler(
|
fn v8__ObjectTemplate__SetNamedPropertyHandler(
|
||||||
this: *const ObjectTemplate,
|
this: *const ObjectTemplate,
|
||||||
getter: Option<GenericNamedPropertyGetterCallback>,
|
getter: Option<NamedPropertyGetterCallback>,
|
||||||
setter: Option<GenericNamedPropertySetterCallback>,
|
setter: Option<NamedPropertySetterCallback>,
|
||||||
query: Option<GenericNamedPropertyQueryCallback>,
|
query: Option<NamedPropertyQueryCallback>,
|
||||||
deleter: Option<GenericNamedPropertyDeleterCallback>,
|
deleter: Option<NamedPropertyDeleterCallback>,
|
||||||
enumerator: Option<GenericNamedPropertyEnumeratorCallback>,
|
enumerator: Option<NamedPropertyEnumeratorCallback>,
|
||||||
definer: Option<GenericNamedPropertyDefinerCallback>,
|
definer: Option<NamedPropertyDefinerCallback>,
|
||||||
descriptor: Option<GenericNamedPropertyDescriptorCallback>,
|
descriptor: Option<NamedPropertyDescriptorCallback>,
|
||||||
data_or_null: *const Value,
|
data_or_null: *const Value,
|
||||||
flags: PropertyHandlerFlags,
|
flags: PropertyHandlerFlags,
|
||||||
);
|
);
|
||||||
@ -138,10 +140,18 @@ extern "C" {
|
|||||||
fn v8__ObjectTemplate__SetImmutableProto(this: *const ObjectTemplate);
|
fn v8__ObjectTemplate__SetImmutableProto(this: *const ObjectTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type AccessorNameGetterCallback<'s> = NamedGetterCallback<'s>;
|
/// Interceptor callbacks use this value to indicate whether the request was
|
||||||
|
/// intercepted or not.
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum Intercepted {
|
||||||
|
No,
|
||||||
|
Yes,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type AccessorNameGetterCallback<'s> = NamedGetterCallbackForAccessor<'s>;
|
||||||
|
|
||||||
/// Note: [ReturnValue] is ignored for accessors.
|
/// Note: [ReturnValue] is ignored for accessors.
|
||||||
pub type AccessorNameSetterCallback<'s> = NamedSetterCallback<'s>;
|
pub type AccessorNameSetterCallback<'s> = NamedSetterCallbackForAccessor<'s>;
|
||||||
|
|
||||||
/// Interceptor for get requests on an object.
|
/// Interceptor for get requests on an object.
|
||||||
///
|
///
|
||||||
@ -150,7 +160,7 @@ pub type AccessorNameSetterCallback<'s> = NamedSetterCallback<'s>;
|
|||||||
/// not produce side effects.
|
/// not produce side effects.
|
||||||
///
|
///
|
||||||
/// See also [ObjectTemplate::set_handler].
|
/// See also [ObjectTemplate::set_handler].
|
||||||
pub type GenericNamedPropertyGetterCallback<'s> = NamedGetterCallback<'s>;
|
pub type NamedPropertyGetterCallback<'s> = NamedGetterCallback<'s>;
|
||||||
|
|
||||||
/// Interceptor for set requests on an object.
|
/// Interceptor for set requests on an object.
|
||||||
///
|
///
|
||||||
@ -162,7 +172,7 @@ pub type GenericNamedPropertyGetterCallback<'s> = NamedGetterCallback<'s>;
|
|||||||
/// effects.
|
/// effects.
|
||||||
///
|
///
|
||||||
/// See also [ObjectTemplate::set_named_property_handler].
|
/// See also [ObjectTemplate::set_named_property_handler].
|
||||||
pub type GenericNamedPropertySetterCallback<'s> = NamedSetterCallback<'s>;
|
pub type NamedPropertySetterCallback<'s> = NamedSetterCallback<'s>;
|
||||||
|
|
||||||
/// Intercepts all requests that query the attributes of the property, e.g.,
|
/// Intercepts all requests that query the attributes of the property, e.g.,
|
||||||
/// getOwnPropertyDescriptor(), propertyIsEnumerable(), and defineProperty().
|
/// getOwnPropertyDescriptor(), propertyIsEnumerable(), and defineProperty().
|
||||||
@ -176,7 +186,7 @@ pub type GenericNamedPropertySetterCallback<'s> = NamedSetterCallback<'s>;
|
|||||||
/// this interceptor depending on the state of the object.
|
/// this interceptor depending on the state of the object.
|
||||||
///
|
///
|
||||||
/// See also [ObjectTemplate::set_named_property_handler].
|
/// See also [ObjectTemplate::set_named_property_handler].
|
||||||
pub type GenericNamedPropertyQueryCallback<'s> = NamedGetterCallback<'s>;
|
pub type NamedPropertyQueryCallback<'s> = NamedGetterCallback<'s>;
|
||||||
|
|
||||||
/// Interceptor for delete requests on an object.
|
/// Interceptor for delete requests on an object.
|
||||||
///
|
///
|
||||||
@ -193,15 +203,14 @@ pub type GenericNamedPropertyQueryCallback<'s> = NamedGetterCallback<'s>;
|
|||||||
/// in strict mode.
|
/// in strict mode.
|
||||||
///
|
///
|
||||||
/// See also [ObjectTemplate::set_named_property_handler].
|
/// See also [ObjectTemplate::set_named_property_handler].
|
||||||
pub type GenericNamedPropertyDeleterCallback<'s> = NamedGetterCallback<'s>;
|
pub type NamedPropertyDeleterCallback<'s> = NamedGetterCallback<'s>;
|
||||||
|
|
||||||
/// Returns an array containing the names of the properties the named property getter intercepts.
|
/// Returns an array containing the names of the properties the named property getter intercepts.
|
||||||
///
|
///
|
||||||
/// Note: The values in the array must be of type v8::Name.
|
/// Note: The values in the array must be of type v8::Name.
|
||||||
///
|
///
|
||||||
/// See also [ObjectTemplate::set_named_property_handler].
|
/// See also [ObjectTemplate::set_named_property_handler].
|
||||||
pub type GenericNamedPropertyEnumeratorCallback<'s> =
|
pub type NamedPropertyEnumeratorCallback<'s> = PropertyEnumeratorCallback<'s>;
|
||||||
PropertyEnumeratorCallback<'s>;
|
|
||||||
|
|
||||||
/// Interceptor for defineProperty requests on an object.
|
/// Interceptor for defineProperty requests on an object.
|
||||||
///
|
///
|
||||||
@ -213,7 +222,7 @@ pub type GenericNamedPropertyEnumeratorCallback<'s> =
|
|||||||
/// effects.
|
/// effects.
|
||||||
///
|
///
|
||||||
/// See also [ObjectTemplate::set_named_property_handler].
|
/// See also [ObjectTemplate::set_named_property_handler].
|
||||||
pub type GenericNamedPropertyDefinerCallback<'s> = NamedDefinerCallback<'s>;
|
pub type NamedPropertyDefinerCallback<'s> = NamedDefinerCallback<'s>;
|
||||||
|
|
||||||
/// Interceptor for getOwnPropertyDescriptor requests on an object.
|
/// Interceptor for getOwnPropertyDescriptor requests on an object.
|
||||||
///
|
///
|
||||||
@ -226,7 +235,7 @@ pub type GenericNamedPropertyDefinerCallback<'s> = NamedDefinerCallback<'s>;
|
|||||||
/// true, i.e., indicate that the property was found.
|
/// true, i.e., indicate that the property was found.
|
||||||
///
|
///
|
||||||
/// See also [ObjectTemplate::set_named_property_handler].
|
/// See also [ObjectTemplate::set_named_property_handler].
|
||||||
pub type GenericNamedPropertyDescriptorCallback<'s> = NamedGetterCallback<'s>;
|
pub type NamedPropertyDescriptorCallback<'s> = NamedGetterCallback<'s>;
|
||||||
|
|
||||||
/// See [GenericNamedPropertyGetterCallback].
|
/// See [GenericNamedPropertyGetterCallback].
|
||||||
pub type IndexedPropertyGetterCallback<'s> = IndexedGetterCallback<'s>;
|
pub type IndexedPropertyGetterCallback<'s> = IndexedGetterCallback<'s>;
|
||||||
@ -291,13 +300,13 @@ impl<'s> AccessorConfiguration<'s> {
|
|||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct NamedPropertyHandlerConfiguration<'s> {
|
pub struct NamedPropertyHandlerConfiguration<'s> {
|
||||||
pub(crate) getter: Option<GenericNamedPropertyGetterCallback<'s>>,
|
pub(crate) getter: Option<NamedPropertyGetterCallback<'s>>,
|
||||||
pub(crate) setter: Option<GenericNamedPropertySetterCallback<'s>>,
|
pub(crate) setter: Option<NamedPropertySetterCallback<'s>>,
|
||||||
pub(crate) query: Option<GenericNamedPropertyQueryCallback<'s>>,
|
pub(crate) query: Option<NamedPropertyQueryCallback<'s>>,
|
||||||
pub(crate) deleter: Option<GenericNamedPropertyDeleterCallback<'s>>,
|
pub(crate) deleter: Option<NamedPropertyDeleterCallback<'s>>,
|
||||||
pub(crate) enumerator: Option<GenericNamedPropertyEnumeratorCallback<'s>>,
|
pub(crate) enumerator: Option<NamedPropertyEnumeratorCallback<'s>>,
|
||||||
pub(crate) definer: Option<GenericNamedPropertyDefinerCallback<'s>>,
|
pub(crate) definer: Option<NamedPropertyDefinerCallback<'s>>,
|
||||||
pub(crate) descriptor: Option<GenericNamedPropertyDescriptorCallback<'s>>,
|
pub(crate) descriptor: Option<NamedPropertyDescriptorCallback<'s>>,
|
||||||
pub(crate) data: Option<Local<'s, Value>>,
|
pub(crate) data: Option<Local<'s, Value>>,
|
||||||
pub(crate) flags: PropertyHandlerFlags,
|
pub(crate) flags: PropertyHandlerFlags,
|
||||||
}
|
}
|
||||||
@ -330,55 +339,46 @@ impl<'s> NamedPropertyHandlerConfiguration<'s> {
|
|||||||
|
|
||||||
pub fn getter(
|
pub fn getter(
|
||||||
mut self,
|
mut self,
|
||||||
getter: impl MapFnTo<GenericNamedPropertyGetterCallback<'s>>,
|
getter: impl MapFnTo<NamedPropertyGetterCallback<'s>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.getter = Some(getter.map_fn_to());
|
self.getter = Some(getter.map_fn_to());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getter_raw(
|
pub fn getter_raw(mut self, getter: NamedPropertyGetterCallback<'s>) -> Self {
|
||||||
mut self,
|
|
||||||
getter: GenericNamedPropertyGetterCallback<'s>,
|
|
||||||
) -> Self {
|
|
||||||
self.getter = Some(getter);
|
self.getter = Some(getter);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setter(
|
pub fn setter(
|
||||||
mut self,
|
mut self,
|
||||||
setter: impl MapFnTo<GenericNamedPropertySetterCallback<'s>>,
|
setter: impl MapFnTo<NamedPropertySetterCallback<'s>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.setter = Some(setter.map_fn_to());
|
self.setter = Some(setter.map_fn_to());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setter_raw(
|
pub fn setter_raw(mut self, setter: NamedPropertySetterCallback<'s>) -> Self {
|
||||||
mut self,
|
|
||||||
setter: GenericNamedPropertySetterCallback<'s>,
|
|
||||||
) -> Self {
|
|
||||||
self.setter = Some(setter);
|
self.setter = Some(setter);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn query(
|
pub fn query(
|
||||||
mut self,
|
mut self,
|
||||||
query: impl MapFnTo<GenericNamedPropertyQueryCallback<'s>>,
|
query: impl MapFnTo<NamedPropertyQueryCallback<'s>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.query = Some(query.map_fn_to());
|
self.query = Some(query.map_fn_to());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn query_raw(
|
pub fn query_raw(mut self, query: NamedPropertyQueryCallback<'s>) -> Self {
|
||||||
mut self,
|
|
||||||
query: GenericNamedPropertyQueryCallback<'s>,
|
|
||||||
) -> Self {
|
|
||||||
self.query = Some(query);
|
self.query = Some(query);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deleter(
|
pub fn deleter(
|
||||||
mut self,
|
mut self,
|
||||||
deleter: impl MapFnTo<GenericNamedPropertyDeleterCallback<'s>>,
|
deleter: impl MapFnTo<NamedPropertyDeleterCallback<'s>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.deleter = Some(deleter.map_fn_to());
|
self.deleter = Some(deleter.map_fn_to());
|
||||||
self
|
self
|
||||||
@ -386,7 +386,7 @@ impl<'s> NamedPropertyHandlerConfiguration<'s> {
|
|||||||
|
|
||||||
pub fn deleter_raw(
|
pub fn deleter_raw(
|
||||||
mut self,
|
mut self,
|
||||||
deleter: GenericNamedPropertyDeleterCallback<'s>,
|
deleter: NamedPropertyDeleterCallback<'s>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.deleter = Some(deleter);
|
self.deleter = Some(deleter);
|
||||||
self
|
self
|
||||||
@ -394,7 +394,7 @@ impl<'s> NamedPropertyHandlerConfiguration<'s> {
|
|||||||
|
|
||||||
pub fn enumerator(
|
pub fn enumerator(
|
||||||
mut self,
|
mut self,
|
||||||
enumerator: impl MapFnTo<GenericNamedPropertyEnumeratorCallback<'s>>,
|
enumerator: impl MapFnTo<NamedPropertyEnumeratorCallback<'s>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.enumerator = Some(enumerator.map_fn_to());
|
self.enumerator = Some(enumerator.map_fn_to());
|
||||||
self
|
self
|
||||||
@ -402,7 +402,7 @@ impl<'s> NamedPropertyHandlerConfiguration<'s> {
|
|||||||
|
|
||||||
pub fn enumerator_raw(
|
pub fn enumerator_raw(
|
||||||
mut self,
|
mut self,
|
||||||
enumerator: GenericNamedPropertyEnumeratorCallback<'s>,
|
enumerator: NamedPropertyEnumeratorCallback<'s>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.enumerator = Some(enumerator);
|
self.enumerator = Some(enumerator);
|
||||||
self
|
self
|
||||||
@ -410,7 +410,7 @@ impl<'s> NamedPropertyHandlerConfiguration<'s> {
|
|||||||
|
|
||||||
pub fn definer(
|
pub fn definer(
|
||||||
mut self,
|
mut self,
|
||||||
definer: impl MapFnTo<GenericNamedPropertyDefinerCallback<'s>>,
|
definer: impl MapFnTo<NamedPropertyDefinerCallback<'s>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.definer = Some(definer.map_fn_to());
|
self.definer = Some(definer.map_fn_to());
|
||||||
self
|
self
|
||||||
@ -418,7 +418,7 @@ impl<'s> NamedPropertyHandlerConfiguration<'s> {
|
|||||||
|
|
||||||
pub fn definer_raw(
|
pub fn definer_raw(
|
||||||
mut self,
|
mut self,
|
||||||
definer: GenericNamedPropertyDefinerCallback<'s>,
|
definer: NamedPropertyDefinerCallback<'s>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.definer = Some(definer);
|
self.definer = Some(definer);
|
||||||
self
|
self
|
||||||
@ -426,7 +426,7 @@ impl<'s> NamedPropertyHandlerConfiguration<'s> {
|
|||||||
|
|
||||||
pub fn descriptor(
|
pub fn descriptor(
|
||||||
mut self,
|
mut self,
|
||||||
descriptor: impl MapFnTo<GenericNamedPropertyDescriptorCallback<'s>>,
|
descriptor: impl MapFnTo<NamedPropertyDescriptorCallback<'s>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.descriptor = Some(descriptor.map_fn_to());
|
self.descriptor = Some(descriptor.map_fn_to());
|
||||||
self
|
self
|
||||||
@ -434,7 +434,7 @@ impl<'s> NamedPropertyHandlerConfiguration<'s> {
|
|||||||
|
|
||||||
pub fn descriptor_raw(
|
pub fn descriptor_raw(
|
||||||
mut self,
|
mut self,
|
||||||
descriptor: GenericNamedPropertyDescriptorCallback<'s>,
|
descriptor: NamedPropertyDescriptorCallback<'s>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.descriptor = Some(descriptor);
|
self.descriptor = Some(descriptor);
|
||||||
self
|
self
|
||||||
@ -950,7 +950,7 @@ impl ObjectTemplate {
|
|||||||
configuration: AccessorConfiguration,
|
configuration: AccessorConfiguration,
|
||||||
) {
|
) {
|
||||||
unsafe {
|
unsafe {
|
||||||
v8__ObjectTemplate__SetAccessor(
|
v8__ObjectTemplate__SetNativeDataProperty(
|
||||||
self,
|
self,
|
||||||
&*key,
|
&*key,
|
||||||
configuration.getter,
|
configuration.getter,
|
||||||
|
@ -2117,7 +2117,7 @@ fn object_template_set_named_property_handler() {
|
|||||||
mut rv: v8::ReturnValue| {
|
mut rv: v8::ReturnValue| {
|
||||||
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
||||||
if key.strict_equals(fallthrough_key.into()) {
|
if key.strict_equals(fallthrough_key.into()) {
|
||||||
return;
|
return v8::Intercepted::No;
|
||||||
}
|
}
|
||||||
|
|
||||||
let this = args.this();
|
let this = args.this();
|
||||||
@ -2135,6 +2135,7 @@ fn object_template_set_named_property_handler() {
|
|||||||
.try_into()
|
.try_into()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
rv.set(internal_field);
|
rv.set(internal_field);
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let setter = |scope: &mut v8::HandleScope,
|
let setter = |scope: &mut v8::HandleScope,
|
||||||
@ -2144,12 +2145,12 @@ fn object_template_set_named_property_handler() {
|
|||||||
mut rv: v8::ReturnValue| {
|
mut rv: v8::ReturnValue| {
|
||||||
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
||||||
if key.strict_equals(fallthrough_key.into()) {
|
if key.strict_equals(fallthrough_key.into()) {
|
||||||
return;
|
return v8::Intercepted::No;
|
||||||
}
|
}
|
||||||
|
|
||||||
let panic_on_get = v8::String::new(scope, "panicOnGet").unwrap();
|
let panic_on_get = v8::String::new(scope, "panicOnGet").unwrap();
|
||||||
if key.strict_equals(panic_on_get.into()) {
|
if key.strict_equals(panic_on_get.into()) {
|
||||||
return;
|
return v8::Intercepted::No;
|
||||||
}
|
}
|
||||||
|
|
||||||
let this = args.this();
|
let this = args.this();
|
||||||
@ -2165,6 +2166,7 @@ fn object_template_set_named_property_handler() {
|
|||||||
assert!(this.set_internal_field(0, value.into()));
|
assert!(this.set_internal_field(0, value.into()));
|
||||||
|
|
||||||
rv.set_undefined();
|
rv.set_undefined();
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let query = |scope: &mut v8::HandleScope,
|
let query = |scope: &mut v8::HandleScope,
|
||||||
@ -2173,12 +2175,12 @@ fn object_template_set_named_property_handler() {
|
|||||||
mut rv: v8::ReturnValue| {
|
mut rv: v8::ReturnValue| {
|
||||||
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
||||||
if key.strict_equals(fallthrough_key.into()) {
|
if key.strict_equals(fallthrough_key.into()) {
|
||||||
return;
|
return v8::Intercepted::No;
|
||||||
}
|
}
|
||||||
|
|
||||||
let panic_on_get = v8::String::new(scope, "panicOnGet").unwrap();
|
let panic_on_get = v8::String::new(scope, "panicOnGet").unwrap();
|
||||||
if key.strict_equals(panic_on_get.into()) {
|
if key.strict_equals(panic_on_get.into()) {
|
||||||
return;
|
return v8::Intercepted::No;
|
||||||
}
|
}
|
||||||
|
|
||||||
let this = args.this();
|
let this = args.this();
|
||||||
@ -2198,6 +2200,7 @@ fn object_template_set_named_property_handler() {
|
|||||||
.try_into()
|
.try_into()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(internal_field.strict_equals(expected_value.into()));
|
assert!(internal_field.strict_equals(expected_value.into()));
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let deleter = |scope: &mut v8::HandleScope,
|
let deleter = |scope: &mut v8::HandleScope,
|
||||||
@ -2206,7 +2209,7 @@ fn object_template_set_named_property_handler() {
|
|||||||
mut rv: v8::ReturnValue| {
|
mut rv: v8::ReturnValue| {
|
||||||
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
||||||
if key.strict_equals(fallthrough_key.into()) {
|
if key.strict_equals(fallthrough_key.into()) {
|
||||||
return;
|
return v8::Intercepted::No;
|
||||||
}
|
}
|
||||||
|
|
||||||
let this = args.this();
|
let this = args.this();
|
||||||
@ -2217,6 +2220,7 @@ fn object_template_set_named_property_handler() {
|
|||||||
assert!(this.set_internal_field(0, v8::undefined(scope).into()));
|
assert!(this.set_internal_field(0, v8::undefined(scope).into()));
|
||||||
|
|
||||||
rv.set_bool(true);
|
rv.set_bool(true);
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let enumerator = |scope: &mut v8::HandleScope,
|
let enumerator = |scope: &mut v8::HandleScope,
|
||||||
@ -2250,7 +2254,7 @@ fn object_template_set_named_property_handler() {
|
|||||||
mut rv: v8::ReturnValue| {
|
mut rv: v8::ReturnValue| {
|
||||||
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
||||||
if key.strict_equals(fallthrough_key.into()) {
|
if key.strict_equals(fallthrough_key.into()) {
|
||||||
return;
|
return v8::Intercepted::No;
|
||||||
}
|
}
|
||||||
|
|
||||||
let this = args.this();
|
let this = args.this();
|
||||||
@ -2275,6 +2279,7 @@ fn object_template_set_named_property_handler() {
|
|||||||
assert!(this.set_internal_field(0, value.into()));
|
assert!(this.set_internal_field(0, value.into()));
|
||||||
|
|
||||||
rv.set_undefined();
|
rv.set_undefined();
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let descriptor = |scope: &mut v8::HandleScope,
|
let descriptor = |scope: &mut v8::HandleScope,
|
||||||
@ -2283,7 +2288,7 @@ fn object_template_set_named_property_handler() {
|
|||||||
mut rv: v8::ReturnValue| {
|
mut rv: v8::ReturnValue| {
|
||||||
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
let fallthrough_key = v8::String::new(scope, "fallthrough").unwrap();
|
||||||
if key.strict_equals(fallthrough_key.into()) {
|
if key.strict_equals(fallthrough_key.into()) {
|
||||||
return;
|
return v8::Intercepted::No;
|
||||||
}
|
}
|
||||||
|
|
||||||
let this = args.this();
|
let this = args.this();
|
||||||
@ -2307,6 +2312,7 @@ fn object_template_set_named_property_handler() {
|
|||||||
descriptor.set(scope, writable_key.into(), writable.into());
|
descriptor.set(scope, writable_key.into(), writable.into());
|
||||||
|
|
||||||
rv.set(descriptor.into());
|
rv.set(descriptor.into());
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let name = v8::String::new(scope, "obj").unwrap();
|
let name = v8::String::new(scope, "obj").unwrap();
|
||||||
@ -2598,6 +2604,7 @@ fn object_template_set_indexed_property_handler() {
|
|||||||
.try_into()
|
.try_into()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
rv.set(internal_field);
|
rv.set(internal_field);
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let setter = |_scope: &mut v8::HandleScope,
|
let setter = |_scope: &mut v8::HandleScope,
|
||||||
@ -2617,6 +2624,7 @@ fn object_template_set_indexed_property_handler() {
|
|||||||
assert!(this.set_internal_field(0, value.into()));
|
assert!(this.set_internal_field(0, value.into()));
|
||||||
|
|
||||||
rv.set_undefined();
|
rv.set_undefined();
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let query = |_scope: &mut v8::HandleScope,
|
let query = |_scope: &mut v8::HandleScope,
|
||||||
@ -2624,13 +2632,14 @@ fn object_template_set_indexed_property_handler() {
|
|||||||
_args: v8::PropertyCallbackArguments,
|
_args: v8::PropertyCallbackArguments,
|
||||||
mut rv: v8::ReturnValue| {
|
mut rv: v8::ReturnValue| {
|
||||||
if index == 12 {
|
if index == 12 {
|
||||||
return;
|
return v8::Intercepted::No;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(index, 37);
|
assert_eq!(index, 37);
|
||||||
|
|
||||||
// PropertyAttribute::READ_ONLY
|
// PropertyAttribute::READ_ONLY
|
||||||
rv.set_int32(1);
|
rv.set_int32(1);
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let deleter = |_scope: &mut v8::HandleScope,
|
let deleter = |_scope: &mut v8::HandleScope,
|
||||||
@ -2640,6 +2649,7 @@ fn object_template_set_indexed_property_handler() {
|
|||||||
assert_eq!(index, 37);
|
assert_eq!(index, 37);
|
||||||
|
|
||||||
rv.set_bool(false);
|
rv.set_bool(false);
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let enumerator = |scope: &mut v8::HandleScope,
|
let enumerator = |scope: &mut v8::HandleScope,
|
||||||
@ -2685,6 +2695,7 @@ fn object_template_set_indexed_property_handler() {
|
|||||||
this.set_internal_field(0, value.into());
|
this.set_internal_field(0, value.into());
|
||||||
|
|
||||||
rv.set_undefined();
|
rv.set_undefined();
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let descriptor = |scope: &mut v8::HandleScope,
|
let descriptor = |scope: &mut v8::HandleScope,
|
||||||
@ -2711,6 +2722,7 @@ fn object_template_set_indexed_property_handler() {
|
|||||||
descriptor.set(scope, writable_key.into(), writable.into());
|
descriptor.set(scope, writable_key.into(), writable.into());
|
||||||
|
|
||||||
rv.set(descriptor.into());
|
rv.set(descriptor.into());
|
||||||
|
v8::Intercepted::Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
let name = v8::String::new(scope, "obj").unwrap();
|
let name = v8::String::new(scope, "obj").unwrap();
|
||||||
@ -4493,6 +4505,9 @@ fn security_token() {
|
|||||||
let obj = v8::Local::<v8::Object>::try_from(args.data()).unwrap();
|
let obj = v8::Local::<v8::Object>::try_from(args.data()).unwrap();
|
||||||
if let Some(val) = obj.get(scope, key.into()) {
|
if let Some(val) = obj.get(scope, key.into()) {
|
||||||
rv.set(val);
|
rv.set(val);
|
||||||
|
v8::Intercepted::Yes
|
||||||
|
} else {
|
||||||
|
v8::Intercepted::No
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -4541,10 +4556,11 @@ fn context_with_object_template() {
|
|||||||
_descriptor: &v8::PropertyDescriptor,
|
_descriptor: &v8::PropertyDescriptor,
|
||||||
_args: v8::PropertyCallbackArguments<'s>,
|
_args: v8::PropertyCallbackArguments<'s>,
|
||||||
_rv: v8::ReturnValue,
|
_rv: v8::ReturnValue,
|
||||||
) {
|
) -> v8::Intercepted {
|
||||||
unsafe {
|
unsafe {
|
||||||
CALLS.push("definer".to_string());
|
CALLS.push("definer".to_string());
|
||||||
}
|
}
|
||||||
|
v8::Intercepted::No
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setter<'s>(
|
pub fn setter<'s>(
|
||||||
@ -4553,10 +4569,11 @@ fn context_with_object_template() {
|
|||||||
_value: v8::Local<'s, v8::Value>,
|
_value: v8::Local<'s, v8::Value>,
|
||||||
_args: v8::PropertyCallbackArguments<'s>,
|
_args: v8::PropertyCallbackArguments<'s>,
|
||||||
_rv: v8::ReturnValue,
|
_rv: v8::ReturnValue,
|
||||||
) {
|
) -> v8::Intercepted {
|
||||||
unsafe {
|
unsafe {
|
||||||
CALLS.push("setter".to_string());
|
CALLS.push("setter".to_string());
|
||||||
}
|
}
|
||||||
|
v8::Intercepted::No
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user