Bug 1179483 - Fix crash in mozilla::a11y::HyperTextAccessible::RelationByType. r=MarcoZ, a=ritu
authorFrédéric Wang <fred.wang@free.fr>
Thu, 02 Jul 2015 08:50:00 -0400
changeset 270233 69c605d160431eeddbea94ad691e5ee51810422f
parent 270232 643f2b026cbab62d7defc423ed699217fef538b0
child 270234 01cb22fe59d45e02d1c559a21cd913701c0bf7fd
push id8193
push userryanvm@gmail.com
push dateMon, 13 Jul 2015 13:51:14 +0000
treeherdermozilla-aurora@ea81274ad510 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ, ritu
bugs1179483
milestone41.0a2
Bug 1179483 - Fix crash in mozilla::a11y::HyperTextAccessible::RelationByType. r=MarcoZ, a=ritu
accessible/generic/HyperTextAccessible.cpp
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -1757,29 +1757,30 @@ HyperTextAccessible::RemoveChild(Accessi
 
 Relation
 HyperTextAccessible::RelationByType(RelationType aType)
 {
   Relation rel = Accessible::RelationByType(aType);
 
   switch (aType) {
     case RelationType::NODE_CHILD_OF:
-      if (mContent->IsMathMLElement()) {
+      if (HasOwnContent() && mContent->IsMathMLElement()) {
         Accessible* parent = Parent();
         if (parent) {
           nsIContent* parentContent = parent->GetContent();
-          if (parentContent->IsMathMLElement(nsGkAtoms::mroot_)) {
+          if (parentContent &&
+              parentContent->IsMathMLElement(nsGkAtoms::mroot_)) {
             // Add a relation pointing to the parent <mroot>.
             rel.AppendTarget(parent);
           }
         }
       }
       break;
     case RelationType::NODE_PARENT_OF:
-      if (mContent->IsMathMLElement(nsGkAtoms::mroot_)) {
+      if (HasOwnContent() && mContent->IsMathMLElement(nsGkAtoms::mroot_)) {
         Accessible* base = GetChildAt(0);
         Accessible* index = GetChildAt(1);
         if (base && index) {
           // Append the <mroot> children in the order index, base.
           rel.AppendTarget(index);
           rel.AppendTarget(base);
         }
       }