bug 1331255 - annotate some IPC failure conditions r=eeejay

This commit is contained in:
Trevor Saunders 2017-01-18 15:30:00 -05:00
parent 8f32455085
commit 71398a8500
3 changed files with 11 additions and 11 deletions

View File

@ -374,22 +374,22 @@ DocAccessibleParent::RecvBindChildDoc(PDocAccessibleParent* aChildDoc, const uin
// We should always have at least an outer doc accessible in between.
MOZ_ASSERT(aID);
if (!aID)
return IPC_FAIL_NO_REASON(this);
return IPC_FAIL(this, "ID is 0!");
MOZ_DIAGNOSTIC_ASSERT(CheckDocTree());
auto childDoc = static_cast<DocAccessibleParent*>(aChildDoc);
childDoc->Unbind();
bool result = AddChildDoc(childDoc, aID, false);
ipc::IPCResult result = AddChildDoc(childDoc, aID, false);
MOZ_ASSERT(result);
MOZ_DIAGNOSTIC_ASSERT(CheckDocTree());
if (!result) {
return IPC_FAIL_NO_REASON(this);
return result;
}
return IPC_OK();
}
bool
ipc::IPCResult
DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
uint64_t aParentID, bool aCreating)
{
@ -397,7 +397,7 @@ DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
// document it self.
ProxyEntry* e = mAccessibles.GetEntry(aParentID);
if (!e)
return false;
return IPC_FAIL(this, "binding to nonexistant proxy!");
ProxyAccessible* outerDoc = e->mProxy;
MOZ_ASSERT(outerDoc);
@ -407,7 +407,7 @@ DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
// here.
if (outerDoc->ChildrenCount() > 1 ||
(outerDoc->ChildrenCount() == 1 && !outerDoc->ChildAt(0)->IsDoc())) {
return false;
return IPC_FAIL(this, "binding to proxy that can't be a outerDoc!");
}
aChildDoc->mParent = outerDoc;
@ -419,7 +419,7 @@ DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
ProxyCreated(aChildDoc, Interfaces::DOCUMENT | Interfaces::HYPERTEXT);
}
return true;
return IPC_OK();
}
mozilla::ipc::IPCResult

View File

@ -102,8 +102,8 @@ public:
* Called when a document in a content process notifies the main process of a
* new child document.
*/
bool AddChildDoc(DocAccessibleParent* aChildDoc, uint64_t aParentID,
bool aCreating = true);
ipc::IPCResult AddChildDoc(DocAccessibleParent* aChildDoc,
uint64_t aParentID, bool aCreating = true);
/*
* Called when the document in the content process this object represents

View File

@ -916,7 +916,7 @@ TabParent::RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc,
}
auto parentDoc = static_cast<a11y::DocAccessibleParent*>(aParentDoc);
bool added = parentDoc->AddChildDoc(doc, aParentID);
mozilla::ipc::IPCResult added = parentDoc->AddChildDoc(doc, aParentID);
#ifdef XP_WIN
MOZ_ASSERT(aDocCOMProxy.IsNull());
if (added) {
@ -924,7 +924,7 @@ TabParent::RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc,
}
#endif
if (!added) {
return IPC_FAIL_NO_REASON(this);
return added;
}
return IPC_OK();
} else {