Backed out 2 changesets (bug 1818726) for causing failures on browser_caching_relations.js. CLOSED TREE

Backed out changeset 19b59c1f4a3b (bug 1818726)
Backed out changeset 0854bd8c6db1 (bug 1818726)
This commit is contained in:
Csoregi Natalia 2023-02-28 06:43:35 +02:00
parent 3219af97cc
commit 7ae06781c0
8 changed files with 70 additions and 34 deletions

View file

@ -492,7 +492,7 @@ void nsAccessibilityService::NotifyOfResolutionChange(
RefPtr<AccAttributes> fields = new AccAttributes(); RefPtr<AccAttributes> fields = new AccAttributes();
fields->SetAttribute(nsGkAtoms::resolution, aResolution); fields->SetAttribute(nsGkAtoms::resolution, aResolution);
data.AppendElement(mozilla::a11y::CacheData(0, fields)); data.AppendElement(mozilla::a11y::CacheData(0, fields));
document->IPCDoc()->SendCache(CacheUpdateType::Update, data); document->IPCDoc()->SendCache(CacheUpdateType::Update, data, false);
} }
} }
} }
@ -507,7 +507,7 @@ void nsAccessibilityService::NotifyOfDevPixelRatioChange(
fields->SetAttribute(nsGkAtoms::_moz_device_pixel_ratio, fields->SetAttribute(nsGkAtoms::_moz_device_pixel_ratio,
aAppUnitsPerDevPixel); aAppUnitsPerDevPixel);
data.AppendElement(mozilla::a11y::CacheData(0, fields)); data.AppendElement(mozilla::a11y::CacheData(0, fields));
document->IPCDoc()->SendCache(CacheUpdateType::Update, data); document->IPCDoc()->SendCache(CacheUpdateType::Update, data, false);
} }
} }
} }

View file

@ -1548,7 +1548,7 @@ void DocAccessible::ProcessQueuedCacheUpdates() {
} }
if (data.Length()) { if (data.Length()) {
IPCDoc()->SendCache(CacheUpdateType::Update, data); IPCDoc()->SendCache(CacheUpdateType::Update, data, false);
} }
} }

View file

@ -3143,7 +3143,7 @@ void LocalAccessible::SendCache(uint64_t aCacheDomain,
} }
nsTArray<CacheData> data; nsTArray<CacheData> data;
data.AppendElement(CacheData(ID(), fields)); data.AppendElement(CacheData(ID(), fields));
ipcDoc->SendCache(aUpdateType, data); ipcDoc->SendCache(aUpdateType, data, false);
if (profiler_thread_is_being_profiled_for_markers()) { if (profiler_thread_is_being_profiled_for_markers()) {
nsAutoCString updateTypeStr; nsAutoCString updateTypeStr;

View file

@ -66,28 +66,14 @@ void DocAccessibleChildBase::SerializeTree(nsTArray<LocalAccessible*>& aTree,
genericTypes |= eActionable; genericTypes |= eActionable;
} }
RefPtr<AccAttributes> fields;
// Even though we send moves as a hide and a show, we don't want to
// push the cache again for moves.
if (StaticPrefs::accessibility_cache_enabled_AtStartup() &&
!acc->Document()->IsAccessibleBeingMoved(acc)) {
fields =
acc->BundleFieldsForCache(CacheDomain::All, CacheUpdateType::Initial);
if (fields->Count() == 0) {
fields = nullptr;
}
}
#if defined(XP_WIN) #if defined(XP_WIN)
aData.AppendElement(AccessibleData( aData.AppendElement(AccessibleData(
id, msaaId, role, childCount, static_cast<AccType>(acc->mType), id, msaaId, role, childCount, static_cast<AccType>(acc->mType),
static_cast<AccGenericType>(genericTypes), acc->mRoleMapEntryIndex, static_cast<AccGenericType>(genericTypes), acc->mRoleMapEntryIndex));
fields));
#else #else
aData.AppendElement( aData.AppendElement(AccessibleData(
AccessibleData(id, role, childCount, static_cast<AccType>(acc->mType), id, role, childCount, static_cast<AccType>(acc->mType),
static_cast<AccGenericType>(genericTypes), static_cast<AccGenericType>(genericTypes), acc->mRoleMapEntryIndex));
acc->mRoleMapEntryIndex, fields));
#endif #endif
} }
} }
@ -102,12 +88,34 @@ void DocAccessibleChildBase::InsertIntoIpcTree(LocalAccessible* aParent,
FlattenTree(aChild, shownTree); FlattenTree(aChild, shownTree);
ShowEventData data(parentID, aIdxInParent, ShowEventData data(parentID, aIdxInParent,
nsTArray<AccessibleData>(shownTree.Length()), nsTArray<AccessibleData>(shownTree.Length()),
aSuppressShowEvent); aSuppressShowEvent ||
StaticPrefs::accessibility_cache_enabled_AtStartup());
SerializeTree(shownTree, data.NewTree()); SerializeTree(shownTree, data.NewTree());
if (ipc::ProcessChild::ExpectingShutdown()) { if (ipc::ProcessChild::ExpectingShutdown()) {
return; return;
} }
MaybeSendShowEvent(data, false); MaybeSendShowEvent(data, false);
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
nsTArray<CacheData> cache(shownTree.Length());
for (LocalAccessible* acc : shownTree) {
if (mDoc->IsAccessibleBeingMoved(acc)) {
// Even though we send moves as a hide and a show, we don't want to
// push the cache again for moves.
continue;
}
RefPtr<AccAttributes> fields =
acc->BundleFieldsForCache(CacheDomain::All, CacheUpdateType::Initial);
if (fields->Count()) {
uint64_t id = reinterpret_cast<uint64_t>(acc->UniqueID());
cache.AppendElement(CacheData(id, fields));
}
}
// 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);
}
}
} }
void DocAccessibleChildBase::ShowEvent(AccShowEvent* aShowEvent) { void DocAccessibleChildBase::ShowEvent(AccShowEvent* aShowEvent) {

View file

@ -196,11 +196,6 @@ uint32_t DocAccessibleParent::AddSubtree(
mAccessibles.PutEntry(newChild.ID())->mProxy = newProxy; mAccessibles.PutEntry(newChild.ID())->mProxy = newProxy;
ProxyCreated(newProxy); ProxyCreated(newProxy);
if (RefPtr<AccAttributes> fields = newChild.CacheFields()) {
MOZ_ASSERT(StaticPrefs::accessibility_cache_enabled_AtStartup());
newProxy->ApplyCache(CacheUpdateType::Initial, fields);
}
#if defined(XP_WIN) #if defined(XP_WIN)
if (!StaticPrefs::accessibility_cache_enabled_AtStartup()) { if (!StaticPrefs::accessibility_cache_enabled_AtStartup()) {
MsaaAccessible::GetFrom(newProxy)->SetID(newChild.MsaaID()); MsaaAccessible::GetFrom(newProxy)->SetID(newChild.MsaaID());
@ -632,7 +627,7 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvScrollingEvent(
mozilla::ipc::IPCResult DocAccessibleParent::RecvCache( mozilla::ipc::IPCResult DocAccessibleParent::RecvCache(
const mozilla::a11y::CacheUpdateType& aUpdateType, const mozilla::a11y::CacheUpdateType& aUpdateType,
nsTArray<CacheData>&& aData) { nsTArray<CacheData>&& aData, const bool& aDispatchShowEvent) {
ACQUIRE_ANDROID_LOCK ACQUIRE_ANDROID_LOCK
if (mShutdown) { if (mShutdown) {
return IPC_OK(); return IPC_OK();
@ -648,6 +643,35 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvCache(
remote->ApplyCache(aUpdateType, entry.Fields()); remote->ApplyCache(aUpdateType, entry.Fields());
} }
if (aDispatchShowEvent && !aData.IsEmpty()) {
// We might need to dispatch a show event for an initial cache push. We
// should never dispatch a show event for a (non-initial) cache update.
MOZ_ASSERT(aUpdateType == CacheUpdateType::Initial);
RemoteAccessible* target = GetAccessible(aData.ElementAt(0).ID());
if (!target) {
MOZ_ASSERT_UNREACHABLE("No remote found for initial cache push!");
return IPC_OK();
}
// We never dispatch a show event for the doc itself.
MOZ_ASSERT(!target->IsDoc() && target->RemoteParent());
ProxyShowHideEvent(target, target->RemoteParent(), true, false);
if (nsCoreUtils::AccEventObserversExist()) {
xpcAccessibleGeneric* xpcAcc = GetXPCAccessible(target);
xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
nsINode* node = nullptr;
RefPtr<xpcAccEvent> event = new xpcAccEvent(
nsIAccessibleEvent::EVENT_SHOW, xpcAcc, doc, node, false);
nsCoreUtils::DispatchAccEvent(std::move(event));
}
}
if (nsCOMPtr<nsIObserverService> obsService =
services::GetObserverService()) {
obsService->NotifyObservers(nullptr, NS_ACCESSIBLE_CACHE_TOPIC, nullptr);
}
return IPC_OK(); return IPC_OK();
} }

View file

@ -151,7 +151,7 @@ class DocAccessibleParent : public RemoteAccessible,
virtual mozilla::ipc::IPCResult RecvCache( virtual mozilla::ipc::IPCResult RecvCache(
const mozilla::a11y::CacheUpdateType& aUpdateType, const mozilla::a11y::CacheUpdateType& aUpdateType,
nsTArray<CacheData>&& aData) override; nsTArray<CacheData>&& aData, const bool& aDispatchShowEvent) override;
virtual mozilla::ipc::IPCResult RecvSelectedAccessiblesChanged( virtual mozilla::ipc::IPCResult RecvSelectedAccessiblesChanged(
nsTArray<uint64_t>&& aSelectedIDs, nsTArray<uint64_t>&& aSelectedIDs,

View file

@ -32,7 +32,6 @@ struct AccessibleData
AccType Type; AccType Type;
AccGenericType GenericTypes; AccGenericType GenericTypes;
uint8_t RoleMapEntryIndex; uint8_t RoleMapEntryIndex;
AccAttributes CacheFields;
}; };
union OriginDocument union OriginDocument
@ -131,8 +130,11 @@ parent:
/* /*
* Cache The World * Cache The World
* aDispatchShowEvent is true when a show event with the first accessible in
* the cache list as the target should be dispatched after the cache is
* populated. The show event will have a from-user flag value of false.
*/ */
async Cache(CacheUpdateType aUpdateType, CacheData[] aData); async Cache(CacheUpdateType aUpdateType, CacheData[] aData, bool aDispatchShowEvent);
/* /*
* Lists of accessibles that either gained or lost a selected state. * Lists of accessibles that either gained or lost a selected state.

View file

@ -33,7 +33,6 @@ struct AccessibleData
AccType Type; AccType Type;
AccGenericType GenericTypes; AccGenericType GenericTypes;
uint8_t RoleMapEntryIndex; uint8_t RoleMapEntryIndex;
AccAttributes CacheFields;
}; };
struct ShowEventData struct ShowEventData
@ -98,8 +97,11 @@ parent:
/* /*
* Cache The World * Cache The World
* aDispatchShowEvent is true when a show event with the first accessible in
* the cache list as the target should be dispatched after the cache is
* populated. The show event will have a from-user flag value of false.
*/ */
async Cache(CacheUpdateType aUpdateType, CacheData[] aData); async Cache(CacheUpdateType aUpdateType, CacheData[] aData, bool aDispatchShowEvent);
/* /*
* Lists of accessibles that either gained or lost a selected state. * Lists of accessibles that either gained or lost a selected state.