Bug 1802866: Don't send a11y cache pushes containing no data. r=nlapre

This can happen if we're pushing the tree for only moved (no new) Accessibles, since we don't send cache pushes for those.
It can also happen if an Accessible generates no cache data, which is rare but probably not impossible.
Making IPDL calls with no data is wasteful, so don't do it.

Differential Revision: https://phabricator.services.mozilla.com/D163203
This commit is contained in:
James Teh 2022-11-29 07:01:25 +00:00
parent e536e5292a
commit 4e85ff0fe9
2 changed files with 8 additions and 1 deletions

View File

@ -3086,6 +3086,9 @@ void LocalAccessible::SendCache(uint64_t aCacheDomain,
RefPtr<AccAttributes> fields = RefPtr<AccAttributes> fields =
BundleFieldsForCache(aCacheDomain, aUpdateType); BundleFieldsForCache(aCacheDomain, aUpdateType);
if (!fields->Count()) {
return;
}
nsTArray<CacheData> data; nsTArray<CacheData> data;
data.AppendElement(CacheData(ID(), fields)); data.AppendElement(CacheData(ID(), fields));
ipcDoc->SendCache(aUpdateType, data, false); ipcDoc->SendCache(aUpdateType, data, false);

View File

@ -109,7 +109,11 @@ void DocAccessibleChildBase::InsertIntoIpcTree(LocalAccessible* aParent,
cache.AppendElement(CacheData(id, fields)); cache.AppendElement(CacheData(id, fields));
} }
} }
Unused << SendCache(CacheUpdateType::Initial, cache, !aSuppressShowEvent); // The cache array might be empty if there were only moved Accessibles or if
// no Accessibles generated any cache data.
if (!cache.IsEmpty()) {
Unused << SendCache(CacheUpdateType::Initial, cache, !aSuppressShowEvent);
}
} }
} }