Bug 934514 - Don't access non-existant field on Android 4.4 r=blassey a=lsblakk
authorJames Willcox <jwillcox@mozilla.com>
Mon, 04 Nov 2013 12:14:23 -0600
changeset 167329 60c78f0a347427aa3bce8ebad6d25dfec9628a7c
parent 167328 362d4f9fe2d54c54aa616fe32b818c3eb2c29e0e
child 167330 2d77f338c43b4b2fb30c7b0aa5f46e4b38506927
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, lsblakk
bugs934514
milestone27.0a2
Bug 934514 - Don't access non-existant field on Android 4.4 r=blassey a=lsblakk
widget/android/AndroidBridge.cpp
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -188,24 +188,21 @@ AndroidBridge::Init(JNIEnv *jEnv)
 
     if (!GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &mAPIVersion, jEnv)) {
         ALOG_BRIDGE("Failed to find API version");
     }
 
     jSurfaceClass = getClassGlobalRef("android/view/Surface");
     if (mAPIVersion <= 8 /* Froyo */) {
         jSurfacePointerField = getField("mSurface", "I");
-    } else {
+    } else if (mAPIVersion > 8 && mAPIVersion < 19 /* KitKat */) {
         jSurfacePointerField = getField("mNativeSurface", "I");
-
-        // Apparently mNativeSurface doesn't exist in Key Lime Pie, so just clear the
-        // exception if we have one and move on.
-        if (jEnv->ExceptionCheck()) {
-            jEnv->ExceptionClear();
-        }
+    } else {
+        // We don't know how to get this, just set it to 0
+        jSurfacePointerField = 0;
     }
 
     jclass eglClass = getClassGlobalRef("com/google/android/gles_jni/EGLSurfaceImpl");
     if (eglClass) {
         jEGLSurfacePointerField = getField("mEGLSurface", "I");
     } else {
         jEGLSurfacePointerField = 0;
     }