On Thu, May 10, 2018 at 8:42 AM, Anoop R. S. <anoop....@gmail.com> wrote: > Ok. I figured out that if v8::IndexedPropertyHandlerConfiguration is set, > and IndexedPropertyEnumeratorCallback is implemented, I can configure what > is displayed on mouse over action (Debugger.evaluateOnCallFrame is passed > from devtools on doing that operation.) > > The implementation is provided below. > void IndexedPropertyEnumeratorCallbackFunction( > const v8::PropertyCallbackInfo<v8::Array>& p_callbackInfo) > { > v8::Local<v8::Array> IndexArray = > v8::Array::New(p_callbackInfo.GetIsolate(), 2); > IndexArray->Set( > v8::Integer::New(p_callbackInfo.GetIsolate(), 0), > v8::String::NewFromUtf8(p_callbackInfo.GetIsolate(), u8"x")); > IndexArray->Set( > v8::Integer::New(p_callbackInfo.GetIsolate(), 1), > v8::String::NewFromUtf8(p_callbackInfo.GetIsolate(), u8"y")); > p_callbackInfo.GetReturnValue().Set(IndexArray); > } > > From reading the embedder's guide, my understanding is that >> >> indexed property interceptors - called when accessing indexed properties. >> An example of this, in a browser environment, is document.forms.elements[0]. > > > Why is it called on evaluateOnCallFrame action? Also, I tried with other > callback s of v8::IndexedPropertyHandlerConfiguration, but they are not > called. Can I know why? Also, since the signature of callback is as below : > > void (*IndexedPropertyEnumeratorCallback)( const > PropertyCallbackInfo<Array>& info); > > I can set only arrays into the result and nothing else. > I am not an expert in v8, hence these questions. Please let me know about > it/ point me to some documentation regarding this. > > regards, > Anoop R. S.
IndexedPropertyEnumeratorCallback - is called for Object.keys()-like operations; i.e., to list the enumerable properties of the object but not non-enumerable or prototype properties. The 'Indexed' refers to the fact that it's intended for numeric keys, i.e., array-like objects. Instead of v8::IndexedPropertyHandlerConfiguration, you may want to use v8::NamedPropertyHandlerConfiguration. evaluateOnCallFrame - V8 cannot know whether your callback has any side effects (it could create objects, call into JS code, etc.), hence it evaluates it as if it were a snippet of regular JS code. Newer versions of V8 let you register callbacks with kHasNoSideEffect but as far as I know that has no effect (hah!) on whether or not evaluateOnCallFrame is used. Maybe in the future. -- -- 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.