Bug 1544541 - Check that accessible in batch exists in SessionAccessibility. r=yzen
authorEitan Isaacson <eitan@monotonous.org>
Tue, 16 Apr 2019 02:38:17 +0000
changeset 469803 37185c0ae520
parent 469802 32cef42080b1
child 469804 486ef552fa32
child 470032 7bd43da7830c
push id35882
push usercbrindusan@mozilla.com
push dateWed, 17 Apr 2019 15:54:01 +0000
treeherdermozilla-central@37185c0ae520 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs1544541
milestone68.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 1544541 - Check that accessible in batch exists in SessionAccessibility. r=yzen Differential Revision: https://phabricator.services.mozilla.com/D27569
accessible/android/SessionAccessibility.cpp
--- a/accessible/android/SessionAccessibility.cpp
+++ b/accessible/android/SessionAccessibility.cpp
@@ -337,16 +337,21 @@ void SessionAccessibility::SendAnnouncem
 }
 
 void SessionAccessibility::ReplaceViewportCache(
     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->ToBundle(
           data.State(), data.Bounds(), data.ActionCount(), data.Name(),
           data.TextValue(), data.DOMNodeID(), data.Description());
       infos->SetElement(i, bundle);
     } else {
       infos->SetElement(i, acc->ToBundle(true));
@@ -358,16 +363,21 @@ void SessionAccessibility::ReplaceViewpo
 }
 
 void SessionAccessibility::ReplaceFocusPathCache(
     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);
       nsCOMPtr<nsIPersistentProperties> props =
           AccessibleWrap::AttributeArrayToProperties(data.Attributes());
       auto bundle =
           acc->ToBundle(data.State(), data.Bounds(), data.ActionCount(),
                         data.Name(), data.TextValue(), data.DOMNodeID(),
                         data.Description(), data.CurValue(), data.MinValue(),