Bug 1511398 - Check if the retrieved accessible child is actually valid when filling the bundle's data, r=yzen
authorEitan Isaacson <eitan@monotonous.org>
Thu, 06 Dec 2018 15:43:23 +0000
changeset 508771 ec828a3edf1b280ff79d6e4ea58afc37896935b9
parent 508770 770eedbd66ab5b3980aeae5f4adc72d73a444939
child 508772 07ce5163f3dac2e65ca2524a1f20c2c9d48805ac
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs1511398
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 1511398 - Check if the retrieved accessible child is actually valid when filling the bundle's data, r=yzen Differential Revision: https://phabricator.services.mozilla.com/D13611
accessible/android/SessionAccessibility.cpp
--- a/accessible/android/SessionAccessibility.cpp
+++ b/accessible/android/SessionAccessibility.cpp
@@ -366,19 +366,25 @@ void SessionAccessibility::ReplaceFocusP
 }
 
 void SessionAccessibility::UpdateCachedBounds(
     const nsTArray<AccessibleWrap*>& aAccessibles,
     const nsTArray<BatchData>& aData) {
   auto infos = jni::ObjectArray::New<java::GeckoBundle>(aAccessibles.Length());
   for (size_t i = 0; i < aAccessibles.Length(); i++) {
     AccessibleWrap* acc = aAccessibles.ElementAt(i);
+    if (!acc) {
+      MOZ_ASSERT_UNREACHABLE("Updated accessible is gone.");
+      continue;
+    }
+
     if (aData.Length() == aAccessibles.Length()) {
       const BatchData& data = aData.ElementAt(i);
-      auto bundle = acc->ToSmallBundle(data.State(), data.Bounds(), data.ActionCount());
+      auto bundle =
+          acc->ToSmallBundle(data.State(), data.Bounds(), data.ActionCount());
       infos->SetElement(i, bundle);
     } else {
       infos->SetElement(i, acc->ToSmallBundle());
     }
   }
 
   mSessionAccessibility->UpdateCachedBounds(infos);
 }