(property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval)))) {
(property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) != NULL) {
lookup_member_by_id(JSContext *cx, JNIEnv *jEnv, JSObject *obj,                    JavaObjectWrapper **java_wrapperp,                    jsid id, JavaMemberVal **memberp,                    JavaMemberDescriptor **member_descriptorp){    jsval idval;    JavaMemberVal *member, **prev_memberp;    JavaObjectWrapper *java_wrapper;    JavaMemberDescriptor *member_descriptor;    const char *member_name, *property_name;    JavaClassDescriptor *class_descriptor;    java_wrapper = JS_GetPrivate(cx, obj);    if (!java_wrapper) {        if (JS_IdToValue(cx, id, &idval) && JSVAL_IS_STRING(idval) &&            (property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval)))) {            if (!strcmp(property_name, "constructor")) {                *java_wrapperp = NULL;                *member_descriptorp = NULL;                return JS_TRUE;            }        }        JS_ReportError(cx, "illegal operation on JavaObject prototype object");        return JS_FALSE;    }    class_descriptor = java_wrapper->class_descriptor;    PR_ASSERT(class_descriptor->type == JAVA_SIGNATURE_CLASS ||              class_descriptor->type == JAVA_SIGNATURE_ARRAY);    /* THREADSAFETY - not thread-safe */    prev_memberp = &java_wrapper->members;    for (member = *prev_memberp; member; member = member->next) {        member_descriptor = member->descriptor;        if (member_descriptor->id == id) {            *prev_memberp = member->next;            member->next = java_wrapper->members;            break;        }    }    if (!member) {        JSFunction *function;        JSObject *function_obj;        member_descriptor = jsj_LookupJavaMemberDescriptorById(cx, jEnv, class_descriptor, id);        if (member_descriptor && member_descriptor->methods) {            member = (JavaMemberVal*)JS_malloc(cx, sizeof(JavaMemberVal));            if (!member)                return JS_FALSE;            JS_IdToValue(cx, id, &idval);            member_name = JS_GetStringBytes(JSVAL_TO_STRING(idval));                        /* printf("Adding %s\n", member_name); */            /* TODO - eliminate JSFUN_BOUND_METHOD */            /* TODO - Use JS_CloneFunction() to save memory */            function = JS_NewFunction(cx, jsj_JavaInstanceMethodWrapper, 0,                                      JSFUN_BOUND_METHOD, obj, member_name);            if (!function) {                JS_free(cx, member);                return JS_FALSE;            }            function_obj = JS_GetFunctionObject(function);                    member->invoke_method_func_val = OBJECT_TO_JSVAL(function_obj);            member->descriptor = member_descriptor;            member->next = NULL;            JS_AddRoot(cx, &member->invoke_method_func_val);        }    }    /* Place member at head of list of members for faster access next time */    if (member) {        member->next = java_wrapper->members;        java_wrapper->members = member;    }    if (!member_descriptor) {        JS_IdToValue(cx, id, &idval);        if (!JSVAL_IS_STRING(idval)) {            JS_ReportError(cx, "invalid JavaObject property expression. "                "(methods and field properties of a JavaObject object can only be strings)");            return JS_FALSE;        }        member_name = JS_GetStringBytes(JSVAL_TO_STRING(idval));        JS_ReportError(cx, "Java class %s has no public instance field or "                           "method named \"%s\"",                       class_descriptor->name, member_name);        return JS_FALSE;    }    /* Success.  Handle the multiple return values */    if (java_wrapperp)        *java_wrapperp = java_wrapper;    if (memberp)        *memberp = member;    if (member_descriptorp)        *member_descriptorp = member_descriptor;    return JS_TRUE;}