Bug 1321384 - attempt to fix a wrong index issue on accessible child removal, r=eeejay a=gchang
authorAlexander Surkov <surkov.alexander@gmail.com>
Sat, 11 Feb 2017 13:19:36 -0500
changeset 378447 9f8949f5a4d72d3a4d1d3bb805f621ffa099fb39
parent 378446 1b6df84a2353c86d95bf470e65ce17642770bbdb
child 378448 795d6097a2de64dc19938e3a2d0b22e2e6cb9cbb
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay, gchang
bugs1321384
milestone53.0a2
Bug 1321384 - attempt to fix a wrong index issue on accessible child removal, r=eeejay a=gchang
accessible/generic/Accessible.cpp
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -2136,18 +2136,24 @@ Accessible::RemoveChild(Accessible* aChi
 
   if (aChild->mParent != this || aChild->mIndexInParent == -1)
     return false;
 
   MOZ_ASSERT((mStateFlags & eKidsMutating) || aChild->IsDefunct() || aChild->IsDoc(),
              "Illicit children change");
 
   int32_t index = static_cast<uint32_t>(aChild->mIndexInParent);
-  MOZ_ASSERT(mChildren.SafeElementAt(index) == aChild,
-             "A wrong child index");
+  if (mChildren.SafeElementAt(index) != aChild) {
+    MOZ_ASSERT_UNREACHABLE("A wrong child index");
+    index = mChildren.IndexOf(aChild);
+    if (index == -1) {
+      MOZ_ASSERT_UNREACHABLE("No child was found");
+      return false;
+    }
+  }
 
   aChild->UnbindFromParent();
   mChildren.RemoveElementAt(index);
 
   for (uint32_t idx = index; idx < mChildren.Length(); idx++) {
     mChildren[idx]->mIndexInParent = idx;
   }