Bug 1735706: Check the cache pref instead of mCachedFields in non-Windows RemoteAccessible methods. r=eeejay
authorJames Teh <jteh@mozilla.com>
Tue, 26 Oct 2021 22:26:45 +0000
changeset 597025 d3b53386023fcac74c6948fb568bd8eb17b6f29f
parent 597024 2adf5103cb9fddf2e30c11a0b4d813a6461fab72
child 597026 2160e62ae7c3f3065ba290099df99ede11257a6e
push id152197
push userjteh@mozilla.com
push dateTue, 26 Oct 2021 22:39:46 +0000
treeherderautoland@d3b53386023f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay
bugs1735706
milestone95.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1735706: Check the cache pref instead of mCachedFields in non-Windows RemoteAccessible methods. r=eeejay mCachedFields might be null because all fields are default; i.e. mCachedFields being null doesn't mean the cache is invalid/disabled. We should check the pref instead when determining whether to call base class methods to query the cache. Differential Revision: https://phabricator.services.mozilla.com/D128445
accessible/ipc/other/RemoteAccessible.cpp
--- a/accessible/ipc/other/RemoteAccessible.cpp
+++ b/accessible/ipc/other/RemoteAccessible.cpp
@@ -28,17 +28,17 @@ uint64_t RemoteAccessible::State() const
 
 uint64_t RemoteAccessible::NativeState() const {
   uint64_t state = 0;
   Unused << mDoc->SendNativeState(mID, &state);
   return state;
 }
 
 ENameValueFlag RemoteAccessible::Name(nsString& aName) const {
-  if (mCachedFields) {
+  if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
     return RemoteAccessibleBase<RemoteAccessible>::Name(aName);
   }
 
   uint32_t flag = 0;
   Unused << mDoc->SendName(mID, &aName, &flag);
   return static_cast<ENameValueFlag>(flag);
 }
 
@@ -46,17 +46,17 @@ void RemoteAccessible::Value(nsString& a
   Unused << mDoc->SendValue(mID, &aValue);
 }
 
 void RemoteAccessible::Help(nsString& aHelp) const {
   Unused << mDoc->SendHelp(mID, &aHelp);
 }
 
 void RemoteAccessible::Description(nsString& aDesc) const {
-  if (mCachedFields) {
+  if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
     RemoteAccessibleBase<RemoteAccessible>::Description(aDesc);
     return;
   }
 
   Unused << mDoc->SendDescription(mID, &aDesc);
 }
 
 void RemoteAccessible::Attributes(RefPtr<AccAttributes>* aAttributes) const {
@@ -756,53 +756,53 @@ KeyBinding RemoteAccessible::KeyboardSho
   return KeyBinding(key, modifierMask);
 }
 
 void RemoteAccessible::AtkKeyBinding(nsString& aBinding) {
   Unused << mDoc->SendAtkKeyBinding(mID, &aBinding);
 }
 
 double RemoteAccessible::CurValue() const {
-  if (mCachedFields) {
+  if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
     return RemoteAccessibleBase<RemoteAccessible>::CurValue();
   }
 
   double val = UnspecifiedNaN<double>();
   Unused << mDoc->SendCurValue(mID, &val);
   return val;
 }
 
 bool RemoteAccessible::SetCurValue(double aValue) {
   bool success = false;
   Unused << mDoc->SendSetCurValue(mID, aValue, &success);
   return success;
 }
 
 double RemoteAccessible::MinValue() const {
-  if (mCachedFields) {
+  if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
     return RemoteAccessibleBase<RemoteAccessible>::MinValue();
   }
 
   double val = UnspecifiedNaN<double>();
   Unused << mDoc->SendMinValue(mID, &val);
   return val;
 }
 
 double RemoteAccessible::MaxValue() const {
-  if (mCachedFields) {
+  if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
     return RemoteAccessibleBase<RemoteAccessible>::MaxValue();
   }
 
   double val = UnspecifiedNaN<double>();
   Unused << mDoc->SendMaxValue(mID, &val);
   return val;
 }
 
 double RemoteAccessible::Step() const {
-  if (mCachedFields) {
+  if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
     return RemoteAccessibleBase<RemoteAccessible>::Step();
   }
 
   double step = UnspecifiedNaN<double>();
   Unused << mDoc->SendStep(mID, &step);
   return step;
 }