if (JSJ_callbacks->get_JSPrincipals_from_java_caller)
if (JSJ_callbacks && JSJ_callbacks->get_JSPrincipals_from_java_caller)
Java_netscape_javascript_JSObject_eval(JNIEnv *jEnv,                                       jobject java_wrapper_obj,                                       jstring eval_jstr){    const char *codebase;    JSPrincipals *principals;    JSContext *cx = NULL;    JSBool eval_succeeded;    JSObject *js_obj;    jsval js_val;    int dummy_cost;    JSBool dummy_bool;    const jchar *eval_ucs2;    jsize eval_len;    JSErrorReporter saved_reporter;    jboolean is_copy;    jobject result;    JSJavaThreadState *jsj_env;        jsj_env = jsj_enter_js(jEnv, NULL, java_wrapper_obj, &cx, &js_obj, &saved_reporter, NULL, 0, NULL);    if (!jsj_env)        return NULL;        result = NULL;    eval_ucs2 = NULL;    if (!eval_jstr) {        JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,                                                 JSJMSG_NULL_EVAL_ARG);        goto done;    }    /* Get the string to eval as raw Unicode characters */    eval_ucs2 = (*jEnv)->GetStringChars(jEnv, eval_jstr, &is_copy);    if (!eval_ucs2) {        JS_ASSERT(0);        goto done;    }    eval_len = (*jEnv)->GetStringLength(jEnv, eval_jstr);        /* Set up security stuff */    principals = NULL;    if (JSJ_callbacks->get_JSPrincipals_from_java_caller)        principals = JSJ_callbacks->get_JSPrincipals_from_java_caller(jEnv, cx, NULL, 0, NULL);    codebase = principals ? principals->codebase : NULL;    /* Have the JS engine evaluate the unicode string */    eval_succeeded = JS_EvaluateUCScriptForPrincipals(cx, js_obj, principals,                                                      eval_ucs2, eval_len,                                                      codebase, 0, &js_val);    if (!eval_succeeded)        goto done;    /* Convert result to a subclass of java.lang.Object */    jsj_ConvertJSValueToJavaObject(cx, jEnv, js_val, jsj_get_jlObject_descriptor(cx, jEnv),                                   &dummy_cost, &result, &dummy_bool);done:    if (eval_ucs2)        (*jEnv)->ReleaseStringChars(jEnv, eval_jstr, eval_ucs2);    if (!jsj_exit_js(cx, jsj_env, saved_reporter))        return NULL;        return result;}