Subj : Re: SpiderMonkey: JS_InitStandardClasses allways fails To : =?ISO-8859-1?Q?Georg_Maa=DF?= From : Brendan Eich Date : Mon May 05 2003 11:40 pm Georg Maaß wrote: > Brendan Eich wrote: > >> Yes, indeed. But as Georg didn't show his global_class hooks, we can >> only guess at what's going wrong. >> >> It is essential to provide full code, if it's not too voluminous, if >> one wants help finding bugs by inspection. >> >> /be >> > > Here it is. For my first steps I made the same as in js.c is done. Not quite. > JSBool stub_global_resolve ( > JSContext *cx > , JSObject *obj > , jsval id > , uintN flags > , JSObject **objp > ) > { > #ifdef LAZY_STANDARD_CLASSES > if ((flags & JSRESOLVE_ASSIGNING) == 0) > { > JSBool resolved; > if(!JS_ResolveStandardClass(cx, obj, id, > &resolved)) return JS_FALSE; > if(resolved) > { > *objp = obj; > return JS_TRUE; > } > } > return JS_FALSE; That return JS_FALSE is your problem. Remember, a false return indicates an error or exception. You want to return JS_TRUE here, and you can eliminate the earlier return JS_TRUE by letting control fall through. /be > > #else > return JS_TRUE; > #endif > } > JSClass global_class = { > > "global" // sogenannter Klassen-Name > , > JSCLASS_NEW_RESOLVE // > , > JS_PropertyStub // add Property > , > JS_PropertyStub // delete Property > , > JS_PropertyStub // get Property > , > JS_PropertyStub // set Property > , > stub_global_enumerate // enumerate > , (JSResolveOp) > stub_global_resolve // resolve > , > JS_ConvertStub // convert > , > JS_FinalizeStub // finalize > }; > > .