Backed out changeset 4d44c5b706db (bug 1729061) for causing bustages in DocAccessibleChildBase.cpp. CLOSED TREE

This commit is contained in:
criss 2021-09-28 00:45:56 +03:00
parent c036c2f5c2
commit dfdc70739c
9 changed files with 11 additions and 109 deletions

View file

@ -63,8 +63,7 @@ static ModuleRep sModuleMap[] = {{"docload", logging::eDocLoad},
{"notifications", logging::eNotifications},
{"stack", logging::eStack},
{"verbose", logging::eVerbose},
{"cache", logging::eCache}};
{"verbose", logging::eVerbose}};
static void EnableLogging(const char* aModulesStr) {
sModules = 0;

View file

@ -52,8 +52,7 @@ enum EModules {
// extras
eStack = 1 << 12,
eVerbose = 1 << 13,
eCache = 1 << 14,
eVerbose = 1 << 13
};
/**

View file

@ -10,9 +10,6 @@
#include "mozilla/StaticPrefs_accessibility.h"
#include "LocalAccessible-inl.h"
#ifdef A11Y_LOG
# include "Logging.h"
#endif
namespace mozilla {
namespace a11y {
@ -100,70 +97,5 @@ void DocAccessibleChildBase::ShowEvent(AccShowEvent* aShowEvent) {
false);
}
mozilla::ipc::IPCResult DocAccessibleChildBase::RecvVerifyCache(
const uint64_t& aID, const uint64_t& aCacheDomain, AccAttributes* aFields) {
#ifdef A11Y_LOG
LocalAccessible* acc = IdToAccessible(aID);
if (!acc) {
return IPC_OK();
}
RefPtr<AccAttributes> localFields =
acc->BundleFieldsForCache(aCacheDomain, CacheUpdateType::Update);
bool mismatches = false;
for (auto prop : *localFields) {
if (prop.Value<DeleteEntry>()) {
if (aFields->HasAttribute(prop.Name())) {
if (!mismatches) {
logging::MsgBegin("Mismatch!", "Local and remote values differ");
logging::AccessibleInfo("", acc);
mismatches = true;
}
nsAutoCString propName;
prop.Name()->ToUTF8String(propName);
nsAutoString val;
aFields->GetAttribute(prop.Name(), val);
logging::MsgEntry(
"Remote value for %s should be empty, but instead it is '%s'",
propName.get(), NS_ConvertUTF16toUTF8(val).get());
}
continue;
}
nsAutoString localVal;
prop.ValueAsString(localVal);
nsAutoString remoteVal;
aFields->GetAttribute(prop.Name(), remoteVal);
if (!localVal.Equals(remoteVal)) {
if (!mismatches) {
logging::MsgBegin("Mismatch!", "");
logging::AccessibleInfo("", acc);
mismatches = true;
}
nsAutoCString propName;
prop.Name()->ToUTF8String(propName);
logging::MsgEntry("Fields differ: %s '%s' != '%s'", propName.get(),
NS_ConvertUTF16toUTF8(remoteVal).get(),
NS_ConvertUTF16toUTF8(localVal).get());
}
}
if (mismatches) {
logging::MsgEnd();
}
#endif // A11Y_LOG
return IPC_OK();
}
LocalAccessible* DocAccessibleChildBase::IdToAccessible(
const uint64_t& aID) const {
if (!aID) return mDoc;
if (!mDoc) return nullptr;
return mDoc->GetAccessibleByUniqueID(reinterpret_cast<void*>(aID));
}
} // namespace a11y
} // namespace mozilla

View file

@ -57,10 +57,6 @@ class DocAccessibleChildBase : public PDocAccessibleChild {
mDoc = nullptr;
}
virtual mozilla::ipc::IPCResult RecvVerifyCache(
const uint64_t& aID, const uint64_t& aCacheDomain,
AccAttributes* aFields) override;
protected:
static void FlattenTree(LocalAccessible* aRoot,
nsTArray<LocalAccessible*>& aTree);
@ -82,8 +78,6 @@ class DocAccessibleChildBase : public PDocAccessibleChild {
bool IsConstructedInParentProcess() const { return mIsRemoteConstructed; }
void SetConstructedInParentProcess() { mIsRemoteConstructed = true; }
LocalAccessible* IdToAccessible(const uint64_t& aID) const;
DocAccessible* mDoc;
bool mIsRemoteConstructed;

View file

@ -17,19 +17,6 @@
#include "RelationType.h"
#include "xpcAccessibleDocument.h"
#ifdef A11Y_LOG
# include "Logging.h"
# define VERIFY_CACHE(domain) \
if (logging::IsEnabled(logging::eCache)) { \
Unused << mDoc->SendVerifyCache(mID, domain, mCachedFields); \
}
#else
# define VERIFY_CACHE(domain) \
do { \
} while (0)
#endif
namespace mozilla {
namespace a11y {
@ -182,7 +169,6 @@ ENameValueFlag RemoteAccessibleBase<Derived>::Name(nsString& aName) const {
if (mCachedFields && mCachedFields->GetAttribute(nsGkAtoms::name, aName)) {
auto nameFlag =
mCachedFields->GetAttribute<int32_t>(nsGkAtoms::explicit_name);
VERIFY_CACHE(CacheDomain::NameAndDescription);
return nameFlag ? static_cast<ENameValueFlag>(*nameFlag) : eNameOK;
}
@ -193,14 +179,12 @@ template <class Derived>
void RemoteAccessibleBase<Derived>::Description(nsString& aDescription) const {
if (mCachedFields) {
mCachedFields->GetAttribute(nsGkAtoms::description, aDescription);
VERIFY_CACHE(CacheDomain::NameAndDescription);
}
}
template <class Derived>
double RemoteAccessibleBase<Derived>::CurValue() const {
if (auto value = mCachedFields->GetAttribute<double>(nsGkAtoms::value)) {
VERIFY_CACHE(CacheDomain::Value);
return *value;
}
@ -210,7 +194,6 @@ double RemoteAccessibleBase<Derived>::CurValue() const {
template <class Derived>
double RemoteAccessibleBase<Derived>::MinValue() const {
if (auto min = mCachedFields->GetAttribute<double>(nsGkAtoms::min)) {
VERIFY_CACHE(CacheDomain::Value);
return *min;
}
@ -220,7 +203,6 @@ double RemoteAccessibleBase<Derived>::MinValue() const {
template <class Derived>
double RemoteAccessibleBase<Derived>::MaxValue() const {
if (auto max = mCachedFields->GetAttribute<double>(nsGkAtoms::max)) {
VERIFY_CACHE(CacheDomain::Value);
return *max;
}
@ -230,7 +212,6 @@ double RemoteAccessibleBase<Derived>::MaxValue() const {
template <class Derived>
double RemoteAccessibleBase<Derived>::Step() const {
if (auto step = mCachedFields->GetAttribute<double>(nsGkAtoms::step)) {
VERIFY_CACHE(CacheDomain::Value);
return *step;
}

View file

@ -27,6 +27,14 @@
namespace mozilla {
namespace a11y {
LocalAccessible* DocAccessibleChild::IdToAccessible(const uint64_t& aID) const {
if (!aID) return mDoc;
if (!mDoc) return nullptr;
return mDoc->GetAccessibleByUniqueID(reinterpret_cast<void*>(aID));
}
LocalAccessible* DocAccessibleChild::IdToAccessibleLink(
const uint64_t& aID) const {
LocalAccessible* acc = IdToAccessible(aID);

View file

@ -485,6 +485,7 @@ class DocAccessibleChild : public DocAccessibleChildBase {
DocAccessiblePlatformExtChild* GetPlatformExtension();
private:
LocalAccessible* IdToAccessible(const uint64_t& aID) const;
LocalAccessible* IdToAccessibleLink(const uint64_t& aID) const;
LocalAccessible* IdToAccessibleSelect(const uint64_t& aID) const;
HyperTextAccessible* IdToHyperTextAccessible(const uint64_t& aID) const;

View file

@ -336,12 +336,6 @@ child:
[Nested=inside_sync] sync ExtentsInCSSPixels(uint64_t aID)
returns(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight);
[Nested=inside_sync] sync DOMNodeID(uint64_t aID) returns(nsString aDOMNodeID);
/*
* Verify the cache. Used for testing purposes.
*/
async VerifyCache(uint64_t aID, uint64_t aCacheDomain, AccAttributes aFields);
};
}

View file

@ -17,7 +17,6 @@ using mozilla::a11y::IDispatchHolder from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::AccType from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::AccGenericType from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::CacheUpdateType from "mozilla/a11y/IPCTypes.h";
[RefCounted] using mozilla::a11y::AccAttributes from "mozilla/a11y/IPCTypes.h";
using mozilla::WindowsHandle from "mozilla/ipc/IPCTypes.h";
using mozilla::LayoutDeviceIntRect from "Units.h";
@ -111,11 +110,6 @@ child:
*/
async RestoreFocus();
/*
* Verify the cache. Used for testing purposes.
*/
async VerifyCache(uint64_t aID, uint64_t aCacheDomain, AccAttributes aFields);
async __delete__();
};