firefox - How does getProperty work in SpiderMonkey? -


i'm looking @ source code of spidermonkey , trying understand how customize function 'getproperty'. it's hard track proper place 'getproperty' set property return value. can show 'proper place' in code?

currently, i'm @ nativeobject.h that:

inline bool js::getproperty(jscontext* cx, handleobject obj, handleobject receiver, handleid id, mutablehandlevalue vp) {     if (getpropertyop op = obj->getops()->getproperty)         return op(cx, obj, receiver, id, vp);     return nativegetproperty(cx, obj.as<nativeobject>(), receiver, id, vp); } 

what op(cx, obj, receiver, id, vp) do?

thanks.

i believe can provide object custom behavior script implementing jsclass (out of date documentation warning). or these days might easier js land proxy.

what code responsible returning property depends on kind of object , property. i'm not sure why you're looking @ nativeobject. jsobj.h more common implementation.

you might want ask in irc or 1 of other channels listed @ spidermonkey mdn page.


Comments