Bug 1383501 - Do not crash when TabParent::RecvPDocAccessibleConstructor receives a null COM proxy sent to the parent process. r=jimm

MozReview-Commit-ID: 5IOuLXc375T
This commit is contained in:
Aaron Klotz 2017-10-04 09:12:25 -06:00
parent 9f071755ad
commit aab52dc8f2
3 changed files with 15 additions and 2 deletions

View File

@ -34,7 +34,7 @@ ProxyAccessible::GetCOMInterface(void** aOutAccessible) const
return false;
}
if (!mCOMProxy) {
if (!mCOMProxy && mSafeToRecurse) {
// See if we can lazily obtain a COM proxy
AccessibleWrap* wrap = WrapperFor(this);
bool isDefunct = false;

View File

@ -27,6 +27,7 @@ public:
ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
DocAccessibleParent* aDoc, role aRole, uint32_t aInterfaces)
: ProxyAccessibleBase(aID, aParent, aDoc, aRole, aInterfaces)
, mSafeToRecurse(true)
{
MOZ_COUNT_CTOR(ProxyAccessible);
}
@ -40,7 +41,16 @@ public:
bool GetCOMInterface(void** aOutAccessible) const;
void SetCOMInterface(const RefPtr<IAccessible>& aIAccessible)
{ mCOMProxy = aIAccessible; }
{
if (aIAccessible) {
mCOMProxy = aIAccessible;
} else {
// If we were supposed to be receiving an interface (hence the call to
// this function), but the interface turns out to be null, then we're
// broken for some reason.
mSafeToRecurse = false;
}
}
protected:
explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc)
@ -49,6 +59,7 @@ protected:
private:
RefPtr<IAccessible> mCOMProxy;
bool mSafeToRecurse;
};
}

View File

@ -973,9 +973,11 @@ TabParent::RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc,
#ifdef XP_WIN
a11y::WrapperFor(doc)->SetID(aMsaaID);
MOZ_ASSERT(!aDocCOMProxy.IsNull());
#ifdef NIGHTLY_BUILD
if (aDocCOMProxy.IsNull()) {
return IPC_FAIL(this, "Constructing a top-level PDocAccessible with null COM proxy");
}
#endif
RefPtr<IAccessible> proxy(aDocCOMProxy.Get());
doc->SetCOMInterface(proxy);