mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1262937 - part 7 - factor out union type deserialization errors; r=jld
This commit is contained in:
parent
dfe775eb9f
commit
647562c2d2
@ -511,5 +511,12 @@ MismatchedActorTypeError(const char* aActorDescription)
|
||||
ProtocolErrorBreakpoint(message.get());
|
||||
}
|
||||
|
||||
void
|
||||
UnionTypeReadError(const char* aUnionName)
|
||||
{
|
||||
nsPrintfCString message("error deserializing type of union %s", aUnionName);
|
||||
NS_RUNTIMEABORT(message.get());
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
@ -339,6 +339,9 @@ ActorLookupError(const char* aActorDescription);
|
||||
MOZ_NEVER_INLINE void
|
||||
MismatchedActorTypeError(const char* aActorDescription);
|
||||
|
||||
MOZ_NEVER_INLINE void
|
||||
UnionTypeReadError(const char* aUnionName);
|
||||
|
||||
struct PrivateIPDLInterface {};
|
||||
|
||||
nsresult
|
||||
|
@ -403,6 +403,11 @@ def _logicError(msg):
|
||||
return StmtExpr(
|
||||
ExprCall(ExprVar('mozilla::ipc::LogicError'), args=[ ExprLiteral.String(msg) ]))
|
||||
|
||||
def _unionTypeReadError(unionname):
|
||||
return StmtExpr(
|
||||
ExprCall(ExprVar('mozilla::ipc::UnionTypeReadError'),
|
||||
args=[ ExprLiteral.String(unionname) ]))
|
||||
|
||||
def _killProcess(pid):
|
||||
return ExprCall(
|
||||
ExprVar('base::KillProcess'),
|
||||
@ -462,6 +467,9 @@ def errfnRecv(msg, errcode=_Result.ValuError):
|
||||
def errfnRead(msg):
|
||||
return [ _fatalError(msg), StmtReturn.FALSE ]
|
||||
|
||||
def errfnUnionType(unionname):
|
||||
return [ _unionTypeReadError(unionname), StmtReturn.FALSE ]
|
||||
|
||||
def _destroyMethod():
|
||||
return ExprVar('ActorDestroy')
|
||||
|
||||
@ -4632,8 +4640,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
uniontdef,
|
||||
StmtDecl(Decl(Type.INT, typevar.name)),
|
||||
self.checkedRead(
|
||||
None, ExprAddrOf(typevar), msgvar, itervar, errfnRead,
|
||||
'\'' + typevar.name + '\' (' + Type.INT.name + ') of union \'' + uniontype.name() + '\''),
|
||||
None, ExprAddrOf(typevar), msgvar, itervar, errfnUnionType,
|
||||
[ uniontype.name() ]),
|
||||
Whitespace.NL,
|
||||
readswitch,
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user