Bug 1507913 - Return root a11y node when failing to retrieve virtual child. r=snorp
authorEitan Isaacson <eitan@monotonous.org>
Mon, 19 Nov 2018 19:55:59 +0000
changeset 503486 6b5790baa26c1ecbe6d38f6a1404ee399c51678b
parent 503485 6a9f15fb809da3bed50ede05e663537c44075778
child 503487 aa84fe3c5853a519f1d3de60cdbb195d9d88f5c4
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1507913
milestone65.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 1507913 - Return root a11y node when failing to retrieve virtual child. r=snorp Differential Revision: https://phabricator.services.mozilla.com/D12338
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
@@ -106,26 +106,30 @@ public class SessionAccessibility {
 
         Log.e(LOGTAG, "Index " + index + " our of CLASSNAME bounds.");
         return "android.view.View"; // Fallback class is View
     }
 
     /* package */ final class NodeProvider extends AccessibilityNodeProvider {
         @Override
         public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualDescendantId) {
-            AccessibilityNodeInfo node;
+            AccessibilityNodeInfo node = null;
             if (mAttached) {
                 node = mSession.getSettings().getBoolean(GeckoSessionSettings.FULL_ACCESSIBILITY_TREE) ?
                         getNodeFromGecko(virtualDescendantId) : getNodeFromCache(virtualDescendantId);
                 if (node != null) {
                     node.setAccessibilityFocused(mAccessibilityFocusedNode == virtualDescendantId);
                     node.setFocused(mFocusedNode == virtualDescendantId);
                 }
-            } else {
-                node = AccessibilityNodeInfo.obtain(mView, virtualDescendantId);
+            }
+
+            if (node == null) {
+                Log.w(LOGTAG, "Failed to retrieve accessible node virtualDescendantId=" +
+                        virtualDescendantId + " mAttached=" + mAttached);
+                node = AccessibilityNodeInfo.obtain(mView, View.NO_ID);
                 if (Build.VERSION.SDK_INT < 17 || mView.getDisplay() != null) {
                     // When running junit tests we don't have a display
                     mView.onInitializeAccessibilityNodeInfo(node);
                 }
                 node.setClassName("android.webkit.WebView");
             }
 
             return node;