Subj : Default property call of object To : netscape.public.mozilla.jseng From : Damian Slee Date : Thu Sep 09 2004 02:10 pm Hi, I have modified the 'its' example in js.c to understand this better. I have the problem when the JSClass.call hook is invoked for an object, that the global object is passed into the handler, not the object that is being worked upon. Any ideas for a solution? Added TestCall method to this example static JSClass its_class = { "It", 0, its_addProperty, its_delProperty, its_getProperty, its_setProperty, its_enumerate, its_resolve, its_convert, its_finalize, NULL, // getObjectOps NULL, // checkAccess TestCall, // call NULL, // construct NULL, // xdrObject NULL, // hasInstance }; It("color") method/property doesn't work cause obj is global object. + can't get private data for this object, you would get private data for global. static JSBool TestCall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { printf("testcall() object %lu arc %d\n", obj, argc); *rval = OBJECT_TO_JSVAL(obj); if (argc != 0) JS_SetCallReturnValue2(cx, argv[0]); return JS_TRUE; } it.item("color") method/property works static JSBool its_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { printf("item() object %lu %d\n",obj,argc); *rval = OBJECT_TO_JSVAL(obj); if (argc != 0) JS_SetCallReturnValue2(cx, argv[0]); return JS_TRUE; } --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.756 / Virus Database: 506 - Release Date: 8/09/2004 .