Bug 970005 - infinite long loop in a11y:FocusManager::ProcessFocusEvent, r=tbsaunde

This commit is contained in:
Alexander Surkov 2014-02-10 17:18:43 -05:00
parent 4f72039672
commit aa24ebde03
2 changed files with 17 additions and 0 deletions

View File

@ -297,6 +297,7 @@ FocusManager::ProcessFocusEvent(AccEvent* aEvent)
// Fire menu start/end events for ARIA menus.
if (target->IsARIARole(nsGkAtoms::menuitem)) {
// The focus was moved into menu.
bool tryOwnsParent = true;
Accessible* ARIAMenubar = nullptr;
Accessible* child = target;
Accessible* parent = child->Parent();
@ -312,14 +313,19 @@ FocusManager::ProcessFocusEvent(AccEvent* aEvent)
if (roleMap->Is(nsGkAtoms::menuitem) || roleMap->Is(nsGkAtoms::menu)) {
child = parent;
parent = child->Parent();
tryOwnsParent = true;
continue;
}
}
// If no required context role then check aria-owns relation.
if (!tryOwnsParent)
break;
RelatedAccIterator iter(child->Document(), child->GetContent(),
nsGkAtoms::aria_owns);
parent = iter.Next();
tryOwnsParent = false;
}
if (ARIAMenubar != mActiveARIAMenubar) {

View File

@ -170,6 +170,8 @@
gQueue.push(new focusMenu("menubar4", "mb4-item1"));
gQueue.push(new focusMenu("menubar5", "mb5-mi"));
gQueue.push(new synthFocus("mi6"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -210,6 +212,11 @@
title="menustart/end events may be missed when top level menuitem is focused">
Bug 934460
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=970005"
title="infinite long loop in a11y:FocusManager::ProcessFocusEvent">
Bug 970005
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -265,6 +272,10 @@
</div>
</div>
<!-- other aria-owns relations -->
<div id="mi6" tabindex="0" role="menuitem">aria-owned item</div>
<div aria-owns="mi6">Obla</div>
<div id="eventdump"></div>
</body>