virtual void execute(JNIEnv* env) { jobject jresult = NULL; nsresult result = theLiveConnectManager->Eval(env, mObject, mScript, mLength, NULL, 0, NULL, &jresult); if (result == NS_OK && jresult != NULL) *mJavaResult = ToGlobalRef(env, jresult); } };
virtual void execute(JNIEnv* env) { jobject jresult = NULL; MRJSecurityContext* securityContext = getSecurityContext(mPluginInstance); nsILiveconnect* connection = securityContext->getConnection(); nsresult result = connection->Eval(env, mObject, mScript, mLength, NULL, 0, securityContext, &jresult); if (result == NS_OK && jresult != NULL) *mJavaResult = ToGlobalRef(env, jresult); } };
Java_netscape_javascript_JSObject_eval(JNIEnv* env,                                       jobject java_wrapper_obj,                                       jstring script_jstr){	/* Get the Unicode string for the JS function name */	if (script_jstr == NULL) {		env->ThrowNew(env->FindClass("java/lang/NullPointerException"), "illegal null script string");		return NULL;	}	jboolean is_copy;	const jchar* script_ucs2 = env->GetStringChars(script_jstr, &is_copy);	jsize script_len = env->GetStringLength(script_jstr);	/* unwrap the JS object from the Java object. */	jsobject js_obj = Unwrap_JSObject(env, java_wrapper_obj);	jobject jresult = NULL;	#ifdef MRJPLUGIN_4X	nsresult status = theLiveConnectManager->Eval(env, js_obj, script_ucs2, script_len, NULL, 0, NULL, &jresult);#else	class EvalMessage : public JavaMessage {		JNIEnv* mEnv;		jsobject mObject;		const jchar* mScript;		jsize mLength;		jobject* mJavaResult;	public:		EvalMessage(jsobject obj, const jchar* script, jsize length, jobject* javaResult)			:	mObject(obj), mScript(script), mLength(length), mJavaResult(javaResult)		{		}		virtual void execute(JNIEnv* env)		{			jobject jresult = NULL;			nsresult result = theLiveConnectManager->Eval(env, mObject, mScript, mLength, NULL, 0, NULL, &jresult);			if (result == NS_OK && jresult != NULL)				*mJavaResult = ToGlobalRef(env, jresult);		}	};	/* determine the plugin instance so we can obtain its codebase. */	// beard: should file a bug with Apple that JMJNIToAWTContext doesn't work.	// MRJPluginInstance* pluginInstance = theJVMPlugin->getPluginInstance(env);	MRJPluginInstance* pluginInstance = GetCurrentInstance(env);	if (pluginInstance == NULL) {		env->ThrowNew(env->FindClass("java/lang/NullPointerException"), "illegal JNIEnv (can't find plugin)");		return NULL;	}	EvalMessage msg(js_obj, script_ucs2, script_len, &jresult);	sendMessage(env, &msg);		if (jresult != NULL)		jresult = ToLocalRef(env, jresult);	#endif	env->ReleaseStringChars(script_jstr, script_ucs2);	return jresult;}