summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-06-22 07:34:47 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-22 07:34:47 +0000
commit3309f879d231914ce1709f7fb1379f02c30e467d (patch)
treec9d5a9ea9197925af98fe2cafd3b13c0228dc366
parent1e7bb36fb71c3eb0a90b8d5fed470a9037ccf2fc (diff)
parent296e4676e6286ba1f2296f6e778f78e8b4d27bea (diff)
downloadwebview-3309f879d231914ce1709f7fb1379f02c30e467d.tar.gz
release-request-36fe639f-9404-4c33-86fb-47bc4ab2221f-for-git_oc-mr1-release-4124666 snap-temp-L64200000076596327
Change-Id: Idc740f9c920c62fc29be5e1afba7adb91cdb4ee7
-rw-r--r--chromium/loader/loader.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/chromium/loader/loader.cpp b/chromium/loader/loader.cpp
index 91c0a21..565c6b0 100644
--- a/chromium/loader/loader.cpp
+++ b/chromium/loader/loader.cpp
@@ -191,7 +191,9 @@ jint LoadWithRelroFile(JNIEnv* env, jclass, jstring lib32, jstring lib64,
return ret;
}
-const char kClassName[] = "android/webkit/WebViewFactory";
+const char kWebViewFactoryClassName[] = "android/webkit/WebViewFactory";
+const char kWebViewLibraryLoaderClassName[] =
+ "android/webkit/WebViewLibraryLoader";
const JNINativeMethod kJniMethods[] = {
{ "nativeReserveAddressSpace", "(J)Z",
reinterpret_cast<void*>(ReserveAddressSpace) },
@@ -208,10 +210,8 @@ const JNINativeMethod kJniMethods[] = {
void RegisterWebViewFactory(JNIEnv* env) {
// If either of these fail, it will set an exception that will be thrown on
// return, so no need to handle errors here.
- jclass clazz = env->FindClass(kClassName);
+ jclass clazz = env->FindClass(kWebViewFactoryClassName);
if (clazz) {
- env->RegisterNatives(clazz, kJniMethods, NELEM(kJniMethods));
-
LIBLOAD_SUCCESS = env->GetStaticIntField(
clazz,
env->GetStaticFieldID(clazz, "LIBLOAD_SUCCESS", "I"));
@@ -234,6 +234,15 @@ void RegisterWebViewFactory(JNIEnv* env) {
}
}
+void RegisterWebViewLibraryLoader(JNIEnv* env) {
+ // If either of these fail, it will set an exception that will be thrown on
+ // return, so no need to handle errors here.
+ jclass clazz = env->FindClass(kWebViewLibraryLoaderClassName);
+ if (clazz) {
+ env->RegisterNatives(clazz, kJniMethods, NELEM(kJniMethods));
+ }
+}
+
} // namespace android
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
@@ -243,5 +252,10 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
return JNI_ERR;
}
android::RegisterWebViewFactory(env);
+ // Ensure there isn't a pending Java exception before registering methods from
+ // WebViewLibraryLoader
+ if (!env->ExceptionCheck()) {
+ android::RegisterWebViewLibraryLoader(env);
+ }
return JNI_VERSION_1_6;
}