[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
rjw
rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:19:18 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 75076e9b543cf33256d252713c87ae3c7ca8cfc0
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Dec 16 01:27:59 2003 +0000
args weren't passed to 'call' invocation. d'oh.
lock interpreter when we create instances of JS impls.
Reviewed by Maciej.
* bindings/jni_jsobject.cpp:
(Bindings::JSObject::call):
(Bindings::JSObject::eval):
(Bindings::JSObject::getMember):
(Bindings::JSObject::setMember):
(Bindings::JSObject::getSlot):
(Bindings::JSObject::convertValueToJObject):
(Bindings::JSObject::convertJObjectToValue):
(Bindings::JSObject::listFromJArray):
* bindings/jni_jsobject.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5803 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 8b7fa5b..0313234 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,23 @@
2003-12-15 Richard Williamson <rjw at apple.com>
+ args weren't passed to 'call' invocation. d'oh.
+ lock interpreter when we create instances of JS impls.
+
+ Reviewed by Maciej.
+
+ * bindings/jni_jsobject.cpp:
+ (Bindings::JSObject::call):
+ (Bindings::JSObject::eval):
+ (Bindings::JSObject::getMember):
+ (Bindings::JSObject::setMember):
+ (Bindings::JSObject::getSlot):
+ (Bindings::JSObject::convertValueToJObject):
+ (Bindings::JSObject::convertJObjectToValue):
+ (Bindings::JSObject::listFromJArray):
+ * bindings/jni_jsobject.h:
+
+2003-12-15 Richard Williamson <rjw at apple.com>
+
Last piece of LiveConnect! This checkin adds implementation
of the Java to JavaScript object conversion functions.
diff --git a/JavaScriptCore/bindings/jni_jsobject.cpp b/JavaScriptCore/bindings/jni_jsobject.cpp
index 5b86b15..562fb04 100644
--- a/JavaScriptCore/bindings/jni_jsobject.cpp
+++ b/JavaScriptCore/bindings/jni_jsobject.cpp
@@ -444,7 +444,7 @@ jobject JSObject::call(jstring methodName, jobjectArray args) const
Value result = funcImp->call (exec, thisObj, argList);
// Convert and return the result of the function call.
- return convertValueToJObject (exec, _root, result);
+ return convertValueToJObject (result);
}
jobject JSObject::eval(jstring script) const
@@ -453,9 +453,7 @@ jobject JSObject::eval(jstring script) const
Object thisObj = Object(const_cast<ObjectImp*>(_imp));
KJS::Value result = _root->interpreter()->evaluate(JavaString(script).ustring(),thisObj).value();
- ExecState *exec = _root->interpreter()->globalExec();
-
- return convertValueToJObject (exec, _root, result);
+ return convertValueToJObject (result);
}
jobject JSObject::getMember(jstring memberName) const
@@ -465,12 +463,12 @@ jobject JSObject::getMember(jstring memberName) const
ExecState *exec = _root->interpreter()->globalExec();
Value result = _imp->get (exec, Identifier (JavaString(memberName).ustring()));
- return convertValueToJObject (exec, _root, result);
+ return convertValueToJObject (result);
}
void JSObject::setMember(jstring memberName, jobject value) const
{
- JS_LOG ("memberName = %s\n", JavaString(memberName).characters());
+ JS_LOG ("memberName = %s, value = %p\n", JavaString(memberName).characters(), value);
ExecState *exec = _root->interpreter()->globalExec();
_imp->put (exec, Identifier (JavaString(memberName).ustring()), convertJObjectToValue(value));
}
@@ -492,7 +490,7 @@ jobject JSObject::getSlot(jint index) const
ExecState *exec = _root->interpreter()->globalExec();
Value result = _imp->get (exec, (unsigned)index);
- return convertValueToJObject (exec, _root, result);
+ return convertValueToJObject (result);
}
@@ -552,8 +550,9 @@ jlong JSObject::createNative(jlong nativeHandle)
return ptr_to_jlong(0);
}
-jobject JSObject::convertValueToJObject (KJS::ExecState *exec, const Bindings::RootObject *root, KJS::Value value)
+jobject JSObject::convertValueToJObject (KJS::Value value) const
{
+ ExecState *exec = _root->interpreter()->globalExec();
JNIEnv *env = getJNIEnv();
jobject result = 0;
@@ -606,7 +605,7 @@ jobject JSObject::convertValueToJObject (KJS::ExecState *exec, const Bindings::R
// Bump our 'meta' reference count for the imp. We maintain the reference
// until either finalize is called or the applet shuts down.
- addJavaReference (root, imp);
+ addJavaReference (_root, imp);
}
}
// All other types will result in an undefined object.
@@ -625,7 +624,7 @@ jobject JSObject::convertValueToJObject (KJS::ExecState *exec, const Bindings::R
return result;
}
-KJS::Value JSObject::convertJObjectToValue (jobject theObject)
+KJS::Value JSObject::convertJObjectToValue (jobject theObject) const
{
// Instances of netscape.javascript.JSObject get converted back to
// JavaScript objects. All other objects are wrapped. It's not
@@ -650,18 +649,22 @@ KJS::Value JSObject::convertJObjectToValue (jobject theObject)
return KJS::Object(const_cast<KJS::ObjectImp*>(imp));
}
- return KJS::Object(new KJS::RuntimeObjectImp(new Bindings::JavaInstance (theObject)));
+ _root->interpreter()->lock();
+ KJS::RuntimeObjectImp *newImp = new KJS::RuntimeObjectImp(new Bindings::JavaInstance (theObject));
+ _root->interpreter()->unlock();
+
+ return KJS::Object(newImp);
}
KJS::List JSObject::listFromJArray(jobjectArray jArray) const
{
JNIEnv *env = getJNIEnv();
- long i, numArgs = env->GetArrayLength (jArray);
+ long i, numObjects = jArray ? env->GetArrayLength (jArray) : 0;
KJS::List aList;
- for (i = 0; i < numArgs; i++) {
- jobject anArg = env->GetObjectArrayElement ((jobjectArray)jArray, i);
- aList.append (convertJObjectToValue(anArg));
+ for (i = 0; i < numObjects; i++) {
+ jobject anObject = env->GetObjectArrayElement ((jobjectArray)jArray, i);
+ aList.append (convertJObjectToValue(anObject));
}
return aList;
}
@@ -692,6 +695,7 @@ jobject KJS_JSObject_JSObjectCall (JNIEnv *env, jclass jsClass, jlong nativeHand
context.type = Call;
context.nativeHandle = nativeHandle;
context.string = methodName;
+ context.args = args;
return JSObject::invoke (&context).l;
}
diff --git a/JavaScriptCore/bindings/jni_jsobject.h b/JavaScriptCore/bindings/jni_jsobject.h
index fc9606e..0cfc86e 100644
--- a/JavaScriptCore/bindings/jni_jsobject.h
+++ b/JavaScriptCore/bindings/jni_jsobject.h
@@ -124,8 +124,8 @@ public:
static jvalue invoke (JSObjectCallContext *context);
- static jobject convertValueToJObject (KJS::ExecState *exec, const RootObject *root, KJS::Value value);
- static KJS::Value convertJObjectToValue (jobject theObject);
+ jobject convertValueToJObject (KJS::Value value) const;
+ KJS::Value convertJObjectToValue (jobject theObject) const;
KJS::List listFromJArray(jobjectArray jArray) const;
private:
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list