Bug 1422201: Only handle remote ids passed to IAccessible::accChild on the root accessible. r?MarcoZ draft
authorJames Teh <jteh@mozilla.com>
Mon, 04 Dec 2017 15:32:56 +1000
changeset 706740 4274dbfca989c2ea80840b5c68447ab0d210fa3b
parent 705442 38f49346a200cc25492236c7b3c536fc835fe031
child 742749 88c708caf48c5db4f60b5dcb15c19bb7719ce4ac
push id91904
push userbmo:jteh@mozilla.com
push dateMon, 04 Dec 2017 05:37:37 +0000
reviewersMarcoZ
bugs1422201
milestone59.0a1
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
accessible/windows/msaa/AccessibleWrap.cpp
--- 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) {