Bug 1695116 part 10: When the cache is enabled, don't send COM proxies and MSAA ids from the content process. r=morgan

Sending these doesn't really do any harm, as we already disregard them in the parent process.
However, it's certainly unnecessary and wasteful.

Differential Revision: https://phabricator.services.mozilla.com/D116204
This commit is contained in:
James Teh 2021-06-08 07:20:53 +00:00
Родитель f3997d5080
Коммит 552af4f9de
4 изменённых файлов: 23 добавлений и 6 удалений

Просмотреть файл

@ -15,6 +15,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/PresShell.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/StaticPrefs_accessibility.h"
#include "mozilla/Telemetry.h"
using namespace mozilla;
@ -909,7 +910,10 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
#if defined(XP_WIN)
parentIPCDoc->ConstructChildDocInParentProcess(
ipcDoc, id, MsaaAccessible::GetChildIDFor(childDoc));
ipcDoc, id,
StaticPrefs::accessibility_cache_enabled_AtStartup()
? 0
: MsaaAccessible::GetChildIDFor(childDoc));
#else
nsCOMPtr<nsIBrowserChild> browserChild =
do_GetInterface(mDocument->DocumentNode()->GetDocShell());

Просмотреть файл

@ -44,6 +44,7 @@
#include "mozilla/EventStates.h"
#include "mozilla/HTMLEditor.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs_accessibility.h"
#include "mozilla/TextEditor.h"
#include "mozilla/dom/AncestorIterator.h"
#include "mozilla/dom/BrowserChild.h"
@ -1760,10 +1761,15 @@ void DocAccessible::DoInitialUpdate() {
browserChild->SetTopLevelDocAccessibleChild(ipcDoc);
#if defined(XP_WIN)
IAccessibleHolder holder(
CreateHolderFromAccessible(WrapNotNull(this)));
MOZ_ASSERT(!holder.IsNull());
int32_t childID = MsaaAccessible::GetChildIDFor(this);
IAccessibleHolder holder;
int32_t childID;
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
childID = 0;
} else {
holder = CreateHolderFromAccessible(WrapNotNull(this));
MOZ_ASSERT(!holder.IsNull());
childID = MsaaAccessible::GetChildIDFor(this);
}
#else
int32_t holder = 0, childID = 0;
#endif

Просмотреть файл

@ -6,6 +6,7 @@
#include "mozilla/a11y/DocAccessibleChildBase.h"
#include "mozilla/a11y/RemoteAccessible.h"
#include "mozilla/StaticPrefs_accessibility.h"
#include "LocalAccessible-inl.h"
@ -17,7 +18,9 @@ void DocAccessibleChildBase::SerializeTree(LocalAccessible* aRoot,
nsTArray<AccessibleData>& aTree) {
uint64_t id = reinterpret_cast<uint64_t>(aRoot->UniqueID());
#if defined(XP_WIN)
int32_t msaaId = MsaaAccessible::GetChildIDFor(aRoot);
int32_t msaaId = StaticPrefs::accessibility_cache_enabled_AtStartup()
? 0
: MsaaAccessible::GetChildIDFor(aRoot);
#endif
a11y::role role = aRoot->Role();
uint32_t childCount = aRoot->ChildCount();

Просмотреть файл

@ -38,6 +38,10 @@ ITypeInfo* MsaaAccessible::gTypeInfo = nullptr;
/* static */
MsaaAccessible* MsaaAccessible::Create(Accessible* aAcc) {
// If the cache is enabled, this should only ever be called in the parent
// process.
MOZ_ASSERT(!StaticPrefs::accessibility_cache_enabled_AtStartup() ||
XRE_IsParentProcess());
// The order of some of these is important! For example, when isRoot is true,
// IsDoc will also be true, so we must check IsRoot first. IsTable/Cell and
// IsHyperText are a similar case.