Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index b500ef41fb16036a63982b6c0f46c25f19f861ab..865472c30cc40a49e077786a964c310e8801ed42 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -1502,12 +1502,17 @@ void ObjectTemplate::SetAccessor(v8::Local<Name> name, |
signature, i::FLAG_disable_old_api_accessors); |
} |
-template <typename Getter, typename Setter, typename Query, typename Deleter, |
- typename Enumerator, typename Definer> |
+template <typename Getter, typename Setter, typename Query, typename Descriptor, |
+ typename Deleter, typename Enumerator, typename Definer> |
static i::Handle<i::InterceptorInfo> CreateInterceptorInfo( |
i::Isolate* isolate, Getter getter, Setter setter, Query query, |
- Deleter remover, Enumerator enumerator, Definer definer, Local<Value> data, |
- PropertyHandlerFlags flags) { |
+ Descriptor descriptor, Deleter remover, Enumerator enumerator, |
+ Definer definer, Local<Value> data, PropertyHandlerFlags flags) { |
+ DCHECK(query == nullptr || |
+ descriptor == nullptr); // Either intercept attributes or descriptor. |
+ DCHECK(query == nullptr || |
+ definer == |
+ nullptr); // Only use descriptor callback with definer callback. |
auto obj = i::Handle<i::InterceptorInfo>::cast( |
isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE)); |
obj->set_flags(0); |
@@ -1515,6 +1520,7 @@ static i::Handle<i::InterceptorInfo> CreateInterceptorInfo( |
if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); |
if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); |
if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); |
+ if (descriptor != 0) SET_FIELD_WRAPPED(obj, set_descriptor, descriptor); |
if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); |
if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); |
if (definer != 0) SET_FIELD_WRAPPED(obj, set_definer, definer); |
@@ -1533,19 +1539,19 @@ static i::Handle<i::InterceptorInfo> CreateInterceptorInfo( |
return obj; |
} |
-template <typename Getter, typename Setter, typename Query, typename Deleter, |
- typename Enumerator, typename Definer> |
+template <typename Getter, typename Setter, typename Query, typename Descriptor, |
+ typename Deleter, typename Enumerator, typename Definer> |
static void ObjectTemplateSetNamedPropertyHandler( |
ObjectTemplate* templ, Getter getter, Setter setter, Query query, |
- Deleter remover, Enumerator enumerator, Definer definer, Local<Value> data, |
- PropertyHandlerFlags flags) { |
+ Descriptor descriptor, Deleter remover, Enumerator enumerator, |
+ Definer definer, Local<Value> data, PropertyHandlerFlags flags) { |
i::Isolate* isolate = Utils::OpenHandle(templ)->GetIsolate(); |
ENTER_V8(isolate); |
i::HandleScope scope(isolate); |
auto cons = EnsureConstructor(isolate, templ); |
EnsureNotInstantiated(cons, "ObjectTemplateSetNamedPropertyHandler"); |
- auto obj = CreateInterceptorInfo(isolate, getter, setter, query, remover, |
- enumerator, definer, data, flags); |
+ auto obj = CreateInterceptorInfo(isolate, getter, setter, query, descriptor, |
+ remover, enumerator, definer, data, flags); |
cons->set_named_property_handler(*obj); |
} |
@@ -1554,15 +1560,16 @@ void ObjectTemplate::SetNamedPropertyHandler( |
NamedPropertyQueryCallback query, NamedPropertyDeleterCallback remover, |
NamedPropertyEnumeratorCallback enumerator, Local<Value> data) { |
ObjectTemplateSetNamedPropertyHandler( |
- this, getter, setter, query, remover, enumerator, nullptr, data, |
+ this, getter, setter, query, nullptr, remover, enumerator, nullptr, data, |
PropertyHandlerFlags::kOnlyInterceptStrings); |
} |
void ObjectTemplate::SetHandler( |
const NamedPropertyHandlerConfiguration& config) { |
ObjectTemplateSetNamedPropertyHandler( |
- this, config.getter, config.setter, config.query, config.deleter, |
- config.enumerator, config.definer, config.data, config.flags); |
+ this, config.getter, config.setter, config.query, config.descriptor, |
+ config.deleter, config.enumerator, config.definer, config.data, |
+ config.flags); |
} |
@@ -1622,14 +1629,14 @@ void ObjectTemplate::SetAccessCheckCallbackAndHandler( |
SET_FIELD_WRAPPED(info, set_callback, callback); |
auto named_interceptor = CreateInterceptorInfo( |
isolate, named_handler.getter, named_handler.setter, named_handler.query, |
- named_handler.deleter, named_handler.enumerator, named_handler.definer, |
- named_handler.data, named_handler.flags); |
+ named_handler.descriptor, named_handler.deleter, named_handler.enumerator, |
+ named_handler.definer, named_handler.data, named_handler.flags); |
info->set_named_interceptor(*named_interceptor); |
auto indexed_interceptor = CreateInterceptorInfo( |
isolate, indexed_handler.getter, indexed_handler.setter, |
- indexed_handler.query, indexed_handler.deleter, |
- indexed_handler.enumerator, indexed_handler.definer, indexed_handler.data, |
- indexed_handler.flags); |
+ indexed_handler.query, indexed_handler.descriptor, |
+ indexed_handler.deleter, indexed_handler.enumerator, |
+ indexed_handler.definer, indexed_handler.data, indexed_handler.flags); |
info->set_indexed_interceptor(*indexed_interceptor); |
if (data.IsEmpty()) { |
@@ -1648,9 +1655,10 @@ void ObjectTemplate::SetHandler( |
i::HandleScope scope(isolate); |
auto cons = EnsureConstructor(isolate, this); |
EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetHandler"); |
- auto obj = CreateInterceptorInfo( |
- isolate, config.getter, config.setter, config.query, config.deleter, |
- config.enumerator, config.definer, config.data, config.flags); |
+ auto obj = CreateInterceptorInfo(isolate, config.getter, config.setter, |
+ config.query, config.descriptor, |
+ config.deleter, config.enumerator, |
+ config.definer, config.data, config.flags); |
cons->set_indexed_property_handler(*obj); |
} |