Bug 1505515 - Null check nodeInfo bundle before retrieving class name. r=snorp a=jcristau
authorEitan Isaacson <eitan@monotonous.org>
Fri, 09 Nov 2018 14:24:34 +0000
changeset 501346 60b4eadd89fc24f010404fc3c542fa60b60e191a
parent 501345 26a874969a1e6efe27fbdc617f791bfdf141730d
child 501347 2da43796c5bd9154f75673dc1ad64e2f0a5d5094
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, jcristau
bugs1505515
milestone64.0
Bug 1505515 - Null check nodeInfo bundle before retrieving class name. r=snorp a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D11210
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
@@ -135,26 +135,28 @@ public class SessionAccessibility {
                     if (virtualViewId == View.NO_ID) {
                         sendEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED, View.NO_ID, CLASSNAME_WEBVIEW, null);
                     } else {
                         final GeckoBundle nodeInfo = nativeProvider.getNodeInfo(virtualViewId);
                         final int flags = nodeInfo != null ? nodeInfo.getInt("flags") : 0;
                         if ((flags & FLAG_FOCUSED) != 0) {
                             mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityCursorToFocused", null);
                         } else {
-                            sendEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED, virtualViewId, nodeInfo.getInt("className"), null);
+                            final int className = nodeInfo != null ? nodeInfo.getInt("className") : CLASSNAME_VIEW;
+                            sendEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED, virtualViewId, className, null);
                         }
                     }
                 return true;
             case AccessibilityNodeInfo.ACTION_CLICK:
                 mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityActivate", null);
                 GeckoBundle nodeInfo = nativeProvider.getNodeInfo(virtualViewId);
                 final int flags = nodeInfo != null ? nodeInfo.getInt("flags") : 0;
                 if ((flags & (FLAG_SELECTABLE | FLAG_CHECKABLE)) == 0) {
-                    sendEvent(AccessibilityEvent.TYPE_VIEW_CLICKED, virtualViewId, nodeInfo.getInt("className"), null);
+                    final int className = nodeInfo != null ? nodeInfo.getInt("className") : CLASSNAME_VIEW;
+                    sendEvent(AccessibilityEvent.TYPE_VIEW_CLICKED, virtualViewId, className, null);
                 }
                 return true;
             case AccessibilityNodeInfo.ACTION_LONG_CLICK:
                 mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityLongPress", null);
                 return true;
             case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD:
                 mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityScrollForward", null);
                 return true;