Bug 1230522 - Don't send events to C++ APZ if gecko isn't up yet. r=rbarker
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 10 Dec 2015 17:23:18 -0500
changeset 276167 2bf33b959e6db43963636a187f872f25a895d272
parent 276166 6fb0e753c32b66c279093dfe04cc5e16fc729c03
child 276168 84e011be4e35292d7e378e17a36857395e63594c
push id29784
push usercbook@mozilla.com
push dateFri, 11 Dec 2015 10:38:27 +0000
treeherdermozilla-central@754b4805a65c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrbarker
bugs1230522
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1230522 - Don't send events to C++ APZ if gecko isn't up yet. r=rbarker
mobile/android/base/java/org/mozilla/gecko/gfx/LayerView.java
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/LayerView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/LayerView.java
@@ -232,16 +232,21 @@ public class LayerView extends ScrollVie
         if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
             requestFocus();
         }
         event.offsetLocation(0, -mSurfaceTranslation);
 
         if (mToolbarAnimator != null && mToolbarAnimator.onInterceptTouchEvent(event)) {
             return true;
         }
+        if (AppConstants.MOZ_ANDROID_APZ && !mGeckoIsReady) {
+            // If gecko isn't loaded yet, don't try sending events to the
+            // native code because it's just going to crash
+            return true;
+        }
         if (mPanZoomController != null && mPanZoomController.onTouchEvent(event)) {
             return true;
         }
         return sendEventToGecko(event);
     }
 
     @Override
     public boolean onHoverEvent(MotionEvent event) {
@@ -259,16 +264,21 @@ public class LayerView extends ScrollVie
         return sendEventToGecko(event);
     }
 
     @Override
     public boolean onGenericMotionEvent(MotionEvent event) {
         if (AndroidGamepadManager.handleMotionEvent(event)) {
             return true;
         }
+        if (AppConstants.MOZ_ANDROID_APZ && !mGeckoIsReady) {
+            // If gecko isn't loaded yet, don't try sending events to the
+            // native code because it's just going to crash
+            return true;
+        }
         if (mPanZoomController != null && mPanZoomController.onMotionEvent(event)) {
             return true;
         }
         return false;
     }
 
     @Override
     protected void onAttachedToWindow() {
@@ -365,16 +375,21 @@ public class LayerView extends ScrollVie
     }
 
     public void setIsRTL(boolean aIsRTL) {
         mLayerClient.setIsRTL(aIsRTL);
     }
 
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
+        if (AppConstants.MOZ_ANDROID_APZ && !mGeckoIsReady) {
+            // If gecko isn't loaded yet, don't try sending events to the
+            // native code because it's just going to crash
+            return true;
+        }
         if (mPanZoomController != null && mPanZoomController.onKeyEvent(event)) {
             return true;
         }
         return false;
     }
 
     public void requestRender() {
         if (mListener != null) {