java_wrapper->members = NULL;
jsj_WrapJavaObject(JSContext *cx,                   JNIEnv *jEnv,                   jobject java_obj,                   jclass java_class){    JSJHashNumber hash_code;    JSClass *js_class;    JSObject *js_wrapper_obj;    JavaObjectWrapper *java_wrapper;    JavaClassDescriptor *class_descriptor;    JSJHashEntry *he, **hep;    js_wrapper_obj = NULL;    hash_code = jsj_HashJavaObject((void*)java_obj, (void*)jEnv);#ifdef JS_THREADSAFE    PR_EnterMonitor(java_obj_reflections_monitor);#endif        hep = JSJ_HashTableRawLookup(java_obj_reflections,                                 hash_code, java_obj, (void*)jEnv);    he = *hep;    if (he) {        js_wrapper_obj = (JSObject *)he->value;        if (js_wrapper_obj)            goto done;    }    /* No existing reflection found.  Construct a new one */    class_descriptor = jsj_GetJavaClassDescriptor(cx, jEnv, java_class);    if (!class_descriptor)        goto done;    if (class_descriptor->type == JAVA_SIGNATURE_ARRAY) {        js_class = &JavaArray_class;    } else {        PR_ASSERT(class_descriptor->type == JAVA_SIGNATURE_CLASS);        js_class = &JavaObject_class;    }        /* Create new JS object to reflect Java object */    js_wrapper_obj = JS_NewObject(cx, js_class, NULL, NULL);    if (!js_wrapper_obj)        goto done;    /* Create private, native portion of JavaObject */    java_wrapper =        (JavaObjectWrapper *)JS_malloc(cx, sizeof(JavaObjectWrapper));    if (!java_wrapper) {        jsj_ReleaseJavaClassDescriptor(cx, jEnv, class_descriptor);        goto done;    }    JS_SetPrivate(cx, js_wrapper_obj, java_wrapper);    java_wrapper->class_descriptor = class_descriptor;    java_wrapper->members = NULL;    java_obj = (*jEnv)->NewGlobalRef(jEnv, java_obj);    java_wrapper->java_obj = java_obj;    if (!java_obj)        goto out_of_memory;    /* Add the JavaObject to the hash table */    he = JSJ_HashTableRawAdd(java_obj_reflections, hep, hash_code,                             java_obj, js_wrapper_obj, (void*)jEnv);    if (!he) {        (*jEnv)->DeleteGlobalRef(jEnv, java_obj);        goto out_of_memory;    } done:#ifdef JS_THREADSAFE        PR_ExitMonitor(java_obj_reflections_monitor);#endif            return js_wrapper_obj;out_of_memory:    /* No need to free js_wrapper_obj, as it will be finalized by GC. */    JS_ReportOutOfMemory(cx);    js_wrapper_obj = NULL;    goto done;}