Bug 1102052 - Crash for PBackground protocol errors, r=mrbkap.

This commit is contained in:
Ben Turner 2014-11-20 11:48:18 -08:00
Родитель 08f987df9c
Коммит 44622b4efd
2 изменённых файлов: 37 добавлений и 0 удалений

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

@ -5,6 +5,7 @@
#include "BackgroundChildImpl.h"
#include "FileDescriptorSetChild.h"
#include "mozilla/Assertions.h"
#include "mozilla/dom/PBlobChild.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryChild.h"
#include "mozilla/dom/ipc/BlobChild.h"
@ -80,6 +81,39 @@ BackgroundChildImpl::~BackgroundChildImpl()
MOZ_COUNT_DTOR(mozilla::ipc::BackgroundChildImpl);
}
void
BackgroundChildImpl::ProcessingError(Result aWhat)
{
// May happen on any thread!
nsAutoCString abortMessage;
switch (aWhat) {
#define HANDLE_CASE(_result) \
case _result: \
abortMessage.AssignLiteral(#_result); \
break
HANDLE_CASE(MsgDropped);
HANDLE_CASE(MsgNotKnown);
HANDLE_CASE(MsgNotAllowed);
HANDLE_CASE(MsgPayloadError);
HANDLE_CASE(MsgProcessingError);
HANDLE_CASE(MsgRouteError);
HANDLE_CASE(MsgValueError);
#undef HANDLE_CASE
default:
MOZ_CRASH("Unknown error code!");
}
// This is just MOZ_CRASH() un-inlined so that we can pass the result code as
// a string. MOZ_CRASH() only supports string literals at the moment.
MOZ_ReportCrash(abortMessage.get(), __FILE__, __LINE__); MOZ_REALLY_CRASH();
}
void
BackgroundChildImpl::ActorDestroy(ActorDestroyReason aWhy)
{

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

@ -40,6 +40,9 @@ protected:
BackgroundChildImpl();
virtual ~BackgroundChildImpl();
virtual void
ProcessingError(Result aWhat) MOZ_OVERRIDE;
virtual void
ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;