On Thu, May 10, 2018 at 11:18 AM, Anoop R. S. <anoop....@gmail.com> wrote:
> Thank you for the reply, Ben.
>>
>> Instead of v8::IndexedPropertyHandlerConfiguration, you may
>> want to use v8::NamedPropertyHandlerConfiguration.
>
> I am already using it. What I noticed is that, when I run the code without
> devtools debugging, only the callback GenericNamedPropertyGetterCallback,
> (of NamedPropertyHandlerConfiguration) is invoked.
> IndexedPropertyHandlerConfiguration callbacks are not called even though
> they are implemented. But when I run the code through the debugger, I can
> see the IndexedPropertyHandlerConfiguration callback is called and whatever
> I am populating inside it, is visible in the debugger. After that,
> GenericNamedPropertyGetterCallback, (of NamedPropertyHandlerConfiguration)
> is called, for resolving the names which I am putting into the array in
> GenericNamedPropertyGetterCallback implementation.

Just to make sure we're on the same page:
IndexedPropertyHandlerConfiguration is for number-as-key operations,
i.e., obj[42]; obj.x and obj['x'] on the other hand are named property
operations.

What the debugger does is (mostly) equivalent to `Object.keys(obj)`
and `Object.getOwnPropertyNames(obj)`, operations that include
enumerable element indices _and_ enumerable named properties in their
output.  That's why you observe your IndexedPropertyEnumeratorCallback
getting invoked.  It's asked to list the object's enumerable element
indices.

Interceptor callbacks need to conform to some fairly strict semantics
(that isn't always explained well in v8.h), otherwise you can get
unintuitive behavior.  If unsure, take a look at
test/cctest/test-api-interceptors.cc.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to