Bug 1057402: Always log the message type when we hit an IPC protocol error. r=bent

This commit is contained in:
Kyle Huey 2014-08-22 09:23:01 -07:00
parent 653c29eda7
commit 2bd759b486
2 changed files with 13 additions and 8 deletions

View File

@ -1124,7 +1124,7 @@ MessageChannel::DispatchSyncMessage(const Message& aMsg)
Result rv = mListener->OnMessageReceived(aMsg, reply);
mDispatchingSyncMessage = false;
if (!MaybeHandleError(rv, "DispatchSyncMessage")) {
if (!MaybeHandleError(rv, aMsg, "DispatchSyncMessage")) {
delete reply;
reply = new Message();
reply->set_sync();
@ -1182,7 +1182,7 @@ MessageChannel::DispatchUrgentMessage(const Message& aMsg)
mDispatchingUrgentMessageCount--;
gDispatchingUrgentMessageCount--;
if (!MaybeHandleError(rv, "DispatchUrgentMessage")) {
if (!MaybeHandleError(rv, aMsg, "DispatchUrgentMessage")) {
delete reply;
reply = new Message();
reply->set_urgent();
@ -1204,7 +1204,7 @@ MessageChannel::DispatchRPCMessage(const Message& aMsg)
Message *reply = nullptr;
if (!MaybeHandleError(mListener->OnCallReceived(aMsg, reply), "DispatchRPCMessage")) {
if (!MaybeHandleError(mListener->OnCallReceived(aMsg, reply), aMsg, "DispatchRPCMessage")) {
delete reply;
reply = new Message();
reply->set_rpc();
@ -1228,7 +1228,7 @@ MessageChannel::DispatchAsyncMessage(const Message& aMsg)
NS_RUNTIMEABORT("unhandled special message!");
}
MaybeHandleError(mListener->OnMessageReceived(aMsg), "DispatchAsyncMessage");
MaybeHandleError(mListener->OnMessageReceived(aMsg), aMsg, "DispatchAsyncMessage");
}
void
@ -1296,7 +1296,7 @@ MessageChannel::DispatchInterruptMessage(const Message& aMsg, size_t stackDepth)
Result rv = mListener->OnCallReceived(aMsg, reply);
--mRemoteStackDepthGuess;
if (!MaybeHandleError(rv, "DispatchInterruptMessage")) {
if (!MaybeHandleError(rv, aMsg, "DispatchInterruptMessage")) {
delete reply;
reply = new Message();
reply->set_interrupt();
@ -1556,7 +1556,7 @@ MessageChannel::ReportConnectionError(const char* aChannelName) const
}
bool
MessageChannel::MaybeHandleError(Result code, const char* channelName)
MessageChannel::MaybeHandleError(Result code, const Message& aMsg, const char* channelName)
{
if (MsgProcessed == code)
return true;
@ -1587,7 +1587,12 @@ MessageChannel::MaybeHandleError(Result code, const char* channelName)
return false;
}
PrintErrorMessage(mSide, channelName, errorMsg);
char printedMsg[512];
PR_snprintf(printedMsg, sizeof(printedMsg),
"(msgtype=0x%lX,name=%s) %s",
aMsg.type(), aMsg.name(), errorMsg);
PrintErrorMessage(mSide, channelName, printedMsg);
mListener->OnProcessingError(code);

View File

@ -205,7 +205,7 @@ class MessageChannel : HasResultCodes
void OnNotifyMaybeChannelError();
void ReportConnectionError(const char* aChannelName) const;
void ReportMessageRouteError(const char* channelName) const;
bool MaybeHandleError(Result code, const char* channelName);
bool MaybeHandleError(Result code, const Message& aMsg, const char* channelName);
void Clear();