}
js_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp){    jsval v;    JSString *str;    v = OBJECT_TO_JSVAL(obj);    switch (hint) {      case JSTYPE_STRING:        /*         * Propagate the exception if js_TryMethod finds an appropriate         * method, and calling that method returned failure.         */        if (!js_TryMethod(cx, obj, cx->runtime->atomState.toStringAtom, 0, NULL,                          &v))            return JS_FALSE;	if (!JSVAL_IS_PRIMITIVE(v)) {	    if (!OBJ_GET_CLASS(cx, obj)->convert(cx, obj, hint, &v))		return JS_FALSE;	    /*	     * JS1.2 never failed (except for malloc failure) to convert an	     * object to a string.  ECMA requires an error if both toString	     * and valueOf fail to produce a primitive value.	     */	    if (!JSVAL_IS_PRIMITIVE(v) && cx->version == JSVERSION_1_2) {		char *bytes = JS_smprintf("[object %s]",					  OBJ_GET_CLASS(cx, obj)->name);		if (!bytes)		    return JS_FALSE;		str = JS_NewString(cx, bytes, strlen(bytes));		if (!str) {		    free(bytes);		    return JS_FALSE;		}		v = STRING_TO_JSVAL(str);		goto out;	    }	}	break;      default:	if (!OBJ_GET_CLASS(cx, obj)->convert(cx, obj, hint, &v))	    return JS_FALSE;	if (!JSVAL_IS_PRIMITIVE(v)) {	    if (JS_TypeOfValue(cx, v) == hint)		goto out;	    /* Don't convert to string (source object literal) for JS1.2. */	    if (cx->version == JSVERSION_1_2 && hint == JSTYPE_BOOLEAN)		goto out;	    if (!js_TryMethod(cx, obj, cx->runtime->atomState.toStringAtom, 0,                              NULL, &v))                return JS_FALSE;	}	break;    }    if (!JSVAL_IS_PRIMITIVE(v)) {	/* Avoid recursive death through js_DecompileValueGenerator. */	if (hint == JSTYPE_STRING) {	    str = JS_InternString(cx, OBJ_GET_CLASS(cx, obj)->name);	    if (!str)		return JS_FALSE;	} else {	    str = NULL;	}	*vp = OBJECT_TO_JSVAL(obj);	str = js_DecompileValueGenerator(cx, v, str);	if (str) {	    JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,				 JSMSG_CANT_CONVERT_TO,				 JS_GetStringBytes(str),				 (hint == JSTYPE_VOID)				 ? "primitive type"				 : js_type_str[hint]);	}	return JS_FALSE;    }out:    *vp = v;    return JS_TRUE;}