Subj : Re: Getting function name with generic function call hook To : netscape.public.mozilla.jseng From : "Sterling Bates" Date : Tue Oct 28 2003 11:43 am "Brendan Eich" wrote in message news:bnm8u8$mi4@ripley.netscape.com... > It's not a function object, so JS_GetPrivate will return something other > than a JSFunction*. If you build the engine with DEBUG defined, it will > assert if the CBridgeMethod class lacks the JSCLASS_HAS_PRIVATE flag. > If that class has private data per object, though, it won't be of the > type (JSFunction) you want. > > Why did you expect the callee (argv[-2]) to be a function object? In > what code is this pascal you've been showing run? After some searching I think I'm clueing in on what the private attribute is. If I understand it right, instead of setting a property (say "__addr") of a JSObject pointing to a memory address, I could simply JS_SetPrivate(cx,obj,Pointer(self)), and whenever I see a JSObject*, I can use JS_GetPrivate to retrieve a pointer to the Delphi class instance. That would also be why JS_GetPrivate returns nil for my generic method call hook -- it isn't set :-) Would it make sense to, for each "method" JSClass instance, JS_SetPrivate a pointer to the native method that it refers to? (Hope that made sense.) Thanks, Sterling .