Bug 1310833: Make nsAccessibilityService synchronously query for its MSAA content process ID if the ID is not yet present; r=tbsaunde

MozReview-Commit-ID: 9qZNzmwlBNC

--HG--
extra : rebase_source : c9135cb54dd223aef28189957701199f17d63e46
This commit is contained in:
Aaron Klotz 2016-10-27 12:40:50 -06:00
Родитель e97105dc3a
Коммит 7689dc3caa
6 изменённых файлов: 45 добавлений и 2 удалений

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

@ -44,6 +44,7 @@
#ifdef XP_WIN
#include "mozilla/a11y/Compatibility.h"
#include "mozilla/dom/ContentChild.h"
#include "HTMLWin32ObjectAccessible.h"
#include "mozilla/StaticPtr.h"
#endif
@ -1264,10 +1265,23 @@ nsAccessibilityService::Init()
gAccessibilityService = this;
NS_ADDREF(gAccessibilityService); // will release in Shutdown()
if (XRE_IsParentProcess())
if (XRE_IsParentProcess()) {
gApplicationAccessible = new ApplicationAccessibleWrap();
else
} else {
#if defined(XP_WIN)
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
MOZ_ASSERT(contentChild);
// If we were instantiated by the chrome process, GetMsaaID() will return
// a non-zero value and we may safely continue with initialization.
if (!contentChild->GetMsaaID()) {
// Since we were not instantiated by chrome, we need to synchronously
// obtain a MSAA content process id.
contentChild->SendGetA11yContentId();
}
#endif // defined(XP_WIN)
gApplicationAccessible = new ApplicationAccessible();
}
NS_ADDREF(gApplicationAccessible); // will release in Shutdown()
gApplicationAccessible->Init();

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

@ -3284,6 +3284,13 @@ ContentChild::RecvBlobURLUnregistration(const nsCString& aURI)
return true;
}
#if defined(XP_WIN) && defined(ACCESSIBILITY)
bool
ContentChild::SendGetA11yContentId()
{
return PContentChild::SendGetA11yContentId(&mMsaaID);
}
#endif // defined(XP_WIN) && defined(ACCESSIBILITY)
void
ContentChild::CreateGetFilesRequest(const nsAString& aDirectoryPath,

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

@ -645,6 +645,11 @@ public:
virtual bool
RecvBlobURLUnregistration(const nsCString& aURI) override;
#if defined(XP_WIN) && defined(ACCESSIBILITY)
bool
SendGetA11yContentId();
#endif // defined(XP_WIN) && defined(ACCESSIBILITY)
/**
* Helper function for protocols that use the GPU process when available.
* Overrides FatalError to just be a warning when communicating with the

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

@ -5146,6 +5146,18 @@ ContentParent::RecvUnstoreAndBroadcastBlobURLUnregistration(const nsCString& aUR
return true;
}
bool
ContentParent::RecvGetA11yContentId(uint32_t* aContentId)
{
#if defined(XP_WIN32) && defined(ACCESSIBILITY)
*aContentId = a11y::AccessibleWrap::GetContentProcessIdFor(ChildID());
MOZ_ASSERT(*aContentId);
return true;
#else
return false;
#endif
}
} // namespace dom
} // namespace mozilla

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

@ -552,6 +552,9 @@ public:
virtual bool
RecvUnstoreAndBroadcastBlobURLUnregistration(const nsCString& aURI) override;
virtual bool
RecvGetA11yContentId(uint32_t* aContentId) override;
virtual int32_t Pid() const override;
// Use the PHangMonitor channel to ask the child to repaint a tab.

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

@ -1178,6 +1178,8 @@ parent:
async AccumulateChildHistogram(Accumulation[] accumulations);
async AccumulateChildKeyedHistogram(KeyedAccumulation[] accumulations);
sync GetA11yContentId() returns (uint32_t aContentId);
both:
async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
Principal aPrincipal, ClonedMessageData aData);