Bug 1422201: Only handle remote ids passed to IAccessible::accChild on the root accessible. r?MarcoZ
Previously, we could return remote accessibles which weren't actually descendants of the accessible on which accChild was called.
For example, calling accChild on a local document with the id of a remote document would happily return the remote accessible.
This confused clients such as NVDA which use accChild to check whether something is a descendant of a document.
MozReview-Commit-ID: 8mJ4m6RC3r2
--- a/accessible/windows/msaa/AccessibleWrap.cpp
+++ b/accessible/windows/msaa/AccessibleWrap.cpp
@@ -1476,16 +1476,23 @@ AccessibleWrap::GetIAccessibleFor(const
}
// If the MSAA ID is not a chrome id then we already know that we won't
// find it here and should look remotely instead. This handles the case when
// accessible is part of the chrome process and is part of the xul browser
// window and the child id points in the content documents. Thus we need to
// make sure that it is never called on proxies.
if (XRE_IsParentProcess() && !IsProxy() && !sIDGen.IsChromeID(varChild.lVal)) {
+ if (!IsRoot()) {
+ // Bug 1422201: accChild with a remote id is only valid on the root accessible.
+ // Otherwise, we might return remote accessibles which aren't descendants
+ // of this accessible. This would confuse clients which use accChild to
+ // check whether something is a descendant of a document.
+ return nullptr;
+ }
return GetRemoteIAccessibleFor(varChild);
}
if (varChild.lVal > 0) {
// Gecko child indices are 0-based in contrast to indices used in MSAA.
MOZ_ASSERT(!IsProxy());
Accessible* xpAcc = GetChildAt(varChild.lVal - 1);
if (!xpAcc) {