if (!OBJ_DEFINE_PROPERTY(xdr->cx, xdr->cx->globalObject, (jsid)fun->atom, OBJECT_TO_JSVAL(*objp), NULL, NULL, JSPROP_ENUMERATE, (JSProperty **)&sprop)) return JS_FALSE;
fun_xdrObject(JSXDRState *xdr, JSObject **objp){    JSFunction *fun;    JSString *atomstr;    char *propname;    JSScopeProperty *sprop;    JSBool magic;    uintN i;    uint32 type;#ifdef DEBUG    uintN nvars = 0, nargs = 0;#endif    if (xdr->mode == JSXDR_ENCODE) {	/*	 * No valid function object should lack private data, but fail soft	 * (return true, no error report) in case one does due to API pilot	 * or internal error.	 */	fun = JS_GetPrivate(xdr->cx, *objp);	if (!fun)	    return JS_TRUE;	atomstr = fun->atom ? ATOM_TO_STRING(fun->atom) : NULL;    } else {	fun = js_NewFunction(xdr->cx, NULL, NULL, 0, 0, NULL, NULL);	if (!fun)	    return JS_FALSE;    }    if (!JS_XDRStringOrNull(xdr, &atomstr) ||	!JS_XDRUint8(xdr, &fun->nargs) ||	!JS_XDRUint8(xdr, &fun->flags) ||	!JS_XDRUint16(xdr, &fun->extra) ||	!JS_XDRUint16(xdr, &fun->nvars))	return JS_FALSE;    /* do arguments and local vars */    if (fun->object) {	if (xdr->mode == JSXDR_ENCODE) {	    JSScope *scope = (JSScope *) fun->object->map;	    for (sprop = scope->props; sprop; sprop = sprop->next) {		if (sprop->getter == js_GetArgument) {		    type = JSXDR_FUNARG;		    PR_ASSERT(nargs++ <= fun->nargs);		} else if (sprop->getter == js_GetLocalVariable) {		    type = JSXDR_FUNVAR;		    PR_ASSERT(nvars++ <= fun->nvars);		} else {		    continue;		}		propname = ATOM_BYTES(sym_atom(sprop->symbols));		if (!JS_XDRUint32(xdr, &type) ||		    !JS_XDRCString(xdr, &propname))		    return JS_FALSE;	    }	} else {	    JSPropertyOp getter, setter;	    i = fun->nvars + fun->nargs;	    while (i--) {		if (!JS_XDRUint32(xdr, &type) ||		    !JS_XDRCString(xdr, &propname))		    return JS_FALSE;		PR_ASSERT(type == JSXDR_FUNARG || type == JSXDR_FUNVAR);		if (type == JSXDR_FUNARG) {		    getter = js_GetArgument;		    setter = js_SetArgument;		    PR_ASSERT(nargs++ <= fun->nargs);		} else if (type == JSXDR_FUNVAR) {		    getter = js_GetLocalVariable;		    setter = js_SetLocalVariable;		    PR_ASSERT(nvars++ <= fun->nvars);		}		if (!JS_DefineProperty(xdr->cx, fun->object, propname,				       JSVAL_VOID, getter, setter,				       JSPROP_ENUMERATE | JSPROP_PERMANENT)) {		    JS_free(xdr->cx, propname);		    return JS_FALSE;		}		JS_free(xdr->cx, propname);	    }	}    }    if (!js_XDRScript(xdr, &fun->script, &magic) ||	!magic)	return JS_FALSE;    if (xdr->mode == JSXDR_DECODE) {	if (atomstr) {	    fun->atom = js_AtomizeString(xdr->cx, atomstr, 0);	    if (!fun->atom)		return JS_FALSE;	}	*objp = fun->object;    }    return JS_TRUE;}