Bug 1179483 - Fix crash in mozilla::a11y::HyperTextAccessible::RelationByType. r=MarcoZ
authorFrédéric Wang <fred.wang@free.fr>
Thu, 02 Jul 2015 08:50:00 -0400
changeset 251600 d92864a3b3aebdea39ab24e0251b4e2f51919fed
parent 251599 5fc355133eba2cf0cacdd373c42da81197b2a3c5
child 251601 839d47f91f3e9e6d0d0e5756fec0c6d3b2c3b538
push id29007
push userryanvm@gmail.com
push dateTue, 07 Jul 2015 18:38:06 +0000
treeherdermozilla-central@9340658848d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ
bugs1179483
milestone42.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 1179483 - Fix crash in mozilla::a11y::HyperTextAccessible::RelationByType. r=MarcoZ
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);
         }
       }