зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1801879: Don't cross document boundaries in nsAccUtils::GetSelectableContainer. r=eeejay,geckoview-reviewers,owlish
Trying to access a local OuterDocAccessible from the Android UI thread was causing a crash. We shouldn't be crossing document boundaries anyway. Differential Revision: https://phabricator.services.mozilla.com/D163067
This commit is contained in:
Родитель
b8327d4af3
Коммит
5508057e9f
|
@ -194,10 +194,13 @@ Accessible* nsAccUtils::GetSelectableContainer(const Accessible* aAccessible,
|
|||
if (!aAccessible) return nullptr;
|
||||
|
||||
if (!(aState & states::SELECTABLE)) return nullptr;
|
||||
MOZ_ASSERT(!aAccessible->IsDoc());
|
||||
|
||||
const Accessible* parent = aAccessible;
|
||||
while ((parent = parent->Parent()) && !parent->IsSelect()) {
|
||||
if (parent->Role() == roles::PANE) return nullptr;
|
||||
if (parent->IsDoc() || parent->Role() == roles::PANE) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return const_cast<Accessible*>(parent);
|
||||
}
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
this.getAttribute('aria-selected') == 'true' ? 'false' : 'true')">1</li>
|
||||
<li role="option" aria-selected="false">2</li>
|
||||
</ul>
|
||||
<li id="outsideSelectable" role="option" tabindex="0">outside selectable</li>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1056,6 +1056,18 @@ class AccessibilityTest : BaseSessionTest() {
|
|||
|
||||
provider.performAction(nodeId, AccessibilityNodeInfo.ACTION_SELECT, null)
|
||||
waitUntilSelect(false)
|
||||
|
||||
// Ensure that querying an option outside of a selectable container
|
||||
// doesn't crash (bug 1801879).
|
||||
mainSession.evaluateJS("document.getElementById('outsideSelectable').focus()")
|
||||
sessionRule.waitUntilCalled(object : EventDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onFocused(event: AccessibilityEvent) {
|
||||
nodeId = getSourceId(event)
|
||||
val node = createNodeInfo(nodeId)
|
||||
assertThat("Focused outsideSelectable", node.text.toString(), equalTo("outside selectable"))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@Test fun testMutation() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче