Bug 1531346 - Check for cyclical relationship with aria-activedescendant. r=MarcoZ a=lizzard
authorEitan Isaacson <eitan@monotonous.org>
Fri, 08 Mar 2019 07:55:13 +0000
changeset 516367 586f46c17c45
parent 516366 38edbc4fa662
child 516368 2c906ef692e7
push id1963
push userarchaeopteryx@coole-files.de
push dateWed, 13 Mar 2019 15:32:59 +0000
treeherdermozilla-release@791061efa636 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ, lizzard
bugs1531346
milestone66.0
Bug 1531346 - Check for cyclical relationship with aria-activedescendant. r=MarcoZ a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D22633
accessible/generic/Accessible.cpp
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -2395,16 +2395,22 @@ Accessible* Accessible::CurrentItem() co
   // with the aria-activedescendant attribute.
   nsAutoString id;
   if (HasOwnContent() && mContent->IsElement() &&
       mContent->AsElement()->GetAttr(kNameSpaceID_None,
                                      nsGkAtoms::aria_activedescendant, id)) {
     dom::Document* DOMDoc = mContent->OwnerDoc();
     dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
     if (activeDescendantElm) {
+      if (nsContentUtils::ContentIsDescendantOf(mContent,
+                                                activeDescendantElm)) {
+        // Don't want a cyclical descendant relationship. That would be bad.
+        return nullptr;
+      }
+
       DocAccessible* document = Document();
       if (document) return document->GetAccessible(activeDescendantElm);
     }
   }
   return nullptr;
 }
 
 void Accessible::SetCurrentItem(const Accessible* aItem) {