diff options
author | Steve Block <steveblock@google.com> | 2011-08-10 10:04:48 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-10 10:04:48 -0700 |
commit | 9213a929b6c1bbea6d5342de2bd3115877e7e1aa (patch) | |
tree | 6bb46006dcc4df0d31838c581ef489aafb840f05 /Source/WebCore/bridge/jni | |
parent | fe1799574525deb3c8b300d8854a9d1fd2ff3639 (diff) | |
parent | 0369e2a086aa1cfe29f34e8042eef36a00a7f26b (diff) | |
download | external_webkit-9213a929b6c1bbea6d5342de2bd3115877e7e1aa.zip external_webkit-9213a929b6c1bbea6d5342de2bd3115877e7e1aa.tar.gz external_webkit-9213a929b6c1bbea6d5342de2bd3115877e7e1aa.tar.bz2 |
Merge "Fix property access in the Java bridge"
Diffstat (limited to 'Source/WebCore/bridge/jni')
-rw-r--r-- | Source/WebCore/bridge/jni/v8/JavaInstanceJobjectV8.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/WebCore/bridge/jni/v8/JavaInstanceJobjectV8.cpp b/Source/WebCore/bridge/jni/v8/JavaInstanceJobjectV8.cpp index 8221eff..f2dd1d2 100644 --- a/Source/WebCore/bridge/jni/v8/JavaInstanceJobjectV8.cpp +++ b/Source/WebCore/bridge/jni/v8/JavaInstanceJobjectV8.cpp @@ -37,6 +37,7 @@ #include <wtf/OwnArrayPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/text/CString.h> +#include <wtf/text/StringBuilder.h> using namespace JSC::Bindings; @@ -75,10 +76,30 @@ JavaValue JavaInstanceJobject::invokeMethod(const JavaMethod* method, JavaValue* return jvalueToJavaValue(result, method->returnType()); } +static void appendClassName(StringBuilder& builder, const char* className) +{ + char* c = fastStrDup(className); + char* result = c; + while (*c) { + if (*c == '.') + *c = '/'; + c++; + } + builder.append(result); + fastFree(result); +} + JavaValue JavaInstanceJobject::getField(const JavaField* field) { ASSERT(getClass()->fieldNamed(field->name().utf8().data()) == field); - return jvalueToJavaValue(getJNIField(javaInstance(), field->type(), field->name().utf8().data(), field->typeClassName()), field->type()); + + StringBuilder signature; + signature.append(signatureFromJavaType(field->type())); + if (field->type() == JavaTypeObject || field->type() == JavaTypeString) { + appendClassName(signature, field->typeClassName()); + signature.append(';'); + } + return jvalueToJavaValue(getJNIField(javaInstance(), field->type(), field->name().utf8().data(), signature.toString().utf8().data()), field->type()); } #endif // ENABLE(JAVA_BRIDGE) |