if (!js_SetClassPrototype(cx, fun->object, proto, 0)) {
if (!js_SetClassPrototype(cx, obj, proto, 0)) {
fun_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,	    JSObject **objp){    JSFunction *fun;    JSString *str;    JSAtom *prototypeAtom;    if (!JSVAL_IS_STRING(id))	return JS_TRUE;    /* No valid function object should lack private data, but check anyway. */    fun = JS_GetPrivate(cx, obj);    if (!fun || !fun->object)	return JS_TRUE;    /* No need to reflect fun.prototype in 'fun.prototype = ...'. */    flags &= JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING;    if (flags == (JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING))	return JS_TRUE;    /* Hide prototype if fun->object is proxying for a Call object. */    if (!(flags & JSRESOLVE_QUALIFIED)) {	if (cx->fp && cx->fp->fun == fun && !cx->fp->callobj)	    return JS_TRUE;    }    str = JSVAL_TO_STRING(id);    prototypeAtom = cx->runtime->atomState.classPrototypeAtom;    if (str == ATOM_TO_STRING(prototypeAtom)) {	JSObject *proto;	jsval pval;	proto = NULL;	if (fun->object != obj) {	    /*	     * Clone of a function: make its prototype property value have the	     * same class as the clone-parent's prototype.	     */	    if (!OBJ_GET_PROPERTY(cx, fun->object, (jsid)prototypeAtom, &pval))		return JS_FALSE;	    if (JSVAL_IS_OBJECT(pval))		proto = JSVAL_TO_OBJECT(pval);	}	/* If resolving "prototype" in a clone, clone the parent's prototype. */	if (proto)	    proto = js_NewObject(cx, OBJ_GET_CLASS(cx, proto), proto, NULL);	else	    proto = js_NewObject(cx, &js_ObjectClass, NULL, NULL);	if (!proto)	    return JS_FALSE;	/*	 * ECMA says that constructor.prototype is DontEnum for user-defined	 * functions, but DontEnum | ReadOnly | DontDelete for native "system"	 * constructors such as Object or Function.  So lazily set the former	 * here in fun_resolve, but eagerly define the latter in JS_InitClass,	 * with the right attributes.	 */	if (!js_SetClassPrototype(cx, fun->object, proto, 0)) {	    cx->newborn[GCX_OBJECT] = NULL;	    return JS_FALSE;	}	*objp = obj;    }    return JS_TRUE;}