diff options
author | Steve Block <steveblock@google.com> | 2011-10-12 09:53:09 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-10-12 09:53:09 +0100 |
commit | 6cf7e07ab895af6265850c3df2da05a09977e9a0 (patch) | |
tree | 6e7b3f823720dfbe4dc87faef424dff4e7fd4579 /Source | |
parent | 8242049005e7219ea9846eff8eff3cead8e2461e (diff) | |
download | external_webkit-6cf7e07ab895af6265850c3df2da05a09977e9a0.zip external_webkit-6cf7e07ab895af6265850c3df2da05a09977e9a0.tar.gz external_webkit-6cf7e07ab895af6265850c3df2da05a09977e9a0.tar.bz2 |
Modify BrowserFrame.requestClientCert() to take the host and port as a String
Currently we get the host and port from Chromium as a std::string, convert to a
jbyte array to pass over JNI, then convert to String. It's simpler to convert
directly to jstring and to pass that over JNI.
This also fixes the fact that WebFrame::requestClientCert() fails to call
ReleaseByteArrayElements().
Requires https://android-git.corp.google.com/g/141238
in frameworks/base.
Bug: 5442710
Change-Id: If81fdef338ecdf2debeece0ebb9926bd261ae219
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebKit/android/jni/WebCoreFrameBridge.cpp | 13 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebCoreFrameBridge.h | 2 |
2 files changed, 6 insertions, 9 deletions
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp index 46499b1..4350eb6 100644 --- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -289,7 +289,7 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page* mJavaFrame->mDidReceiveAuthenticationChallenge = env->GetMethodID(clazz, "didReceiveAuthenticationChallenge", "(ILjava/lang/String;Ljava/lang/String;ZZ)V"); mJavaFrame->mReportSslCertError = env->GetMethodID(clazz, "reportSslCertError", "(II[BLjava/lang/String;)V"); - mJavaFrame->mRequestClientCert = env->GetMethodID(clazz, "requestClientCert", "(I[B)V"); + mJavaFrame->mRequestClientCert = env->GetMethodID(clazz, "requestClientCert", "(ILjava/lang/String;)V"); mJavaFrame->mDownloadStart = env->GetMethodID(clazz, "downloadStart", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;J)V"); mJavaFrame->mDidReceiveData = env->GetMethodID(clazz, "didReceiveData", "([BI)V"); @@ -1009,7 +1009,7 @@ WebFrame::reportSslCertError(WebUrlLoaderClient* client, int cert_error, const s } void -WebFrame::requestClientCert(WebUrlLoaderClient* client, const std::string& host_and_port) +WebFrame::requestClientCert(WebUrlLoaderClient* client, const std::string& hostAndPort) { #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); @@ -1017,13 +1017,10 @@ WebFrame::requestClientCert(WebUrlLoaderClient* client, const std::string& host_ JNIEnv* env = getJNIEnv(); int jHandle = reinterpret_cast<int>(client); - int len = host_and_port.length(); - jbyteArray jHostAndPort = env->NewByteArray(len); - jbyte* bytes = env->GetByteArrayElements(jHostAndPort, NULL); - host_and_port.copy(reinterpret_cast<char*>(bytes), len); + int len = hostAndPort.length(); + ScopedLocalRef<jstring> jHostAndPort(env, stdStringToJstring(env, hostAndPort, true)); - env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mRequestClientCert, jHandle, jHostAndPort); - env->DeleteLocalRef(jHostAndPort); + env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mRequestClientCert, jHandle, jHostAndPort.get()); checkException(env); } diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.h b/Source/WebKit/android/jni/WebCoreFrameBridge.h index e49bf35..2b3f5bd 100644 --- a/Source/WebKit/android/jni/WebCoreFrameBridge.h +++ b/Source/WebKit/android/jni/WebCoreFrameBridge.h @@ -121,7 +121,7 @@ class WebFrame : public WebCoreRefObject { void reportSslCertError(WebUrlLoaderClient* client, int cert_error, const std::string& cert, const std::string& url); - void requestClientCert(WebUrlLoaderClient* client, const std::string& host_and_port); + void requestClientCert(WebUrlLoaderClient* client, const std::string& hostAndPort); void downloadStart(const std::string& url, const std::string& userAgent, const std::string& contentDisposition, const std::string& mimetype, long long contentLength); |