Bug 1240985 - Return false when trying to Send while dispatching urgent (r=dvander)

This commit is contained in:
Bill McCloskey 2016-01-19 17:36:44 -08:00
Родитель e64d1645e5
Коммит 78d4767d25
1 изменённых файлов: 18 добавлений и 2 удалений

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

@ -920,15 +920,31 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
{
// Don't allow sending CPOWs while we're dispatching a sync message.
// If you want to do that, use sendRpcMessage instead.
IPC_LOG("Prio forbids send");
return false;
}
if (mCurrentTransaction &&
(DispatchingSyncMessagePriority() == IPC::Message::PRIORITY_URGENT ||
DispatchingAsyncMessagePriority() == IPC::Message::PRIORITY_URGENT))
{
// Generally only the parent dispatches urgent messages. And the only
// sync messages it can send are high-priority. Mainly we want to ensure
// here that we don't return false for non-CPOW messages.
MOZ_ASSERT(msg->priority() == IPC::Message::PRIORITY_HIGH);
return false;
}
if (mCurrentTransaction &&
(msg->priority() < DispatchingSyncMessagePriority() ||
mAwaitingSyncReplyPriority > msg->priority()))
msg->priority() < AwaitingSyncReplyPriority()))
{
MOZ_ASSERT(DispatchingSyncMessage() || DispatchingAsyncMessage());
IPC_LOG("Cancel from Send");
CancelMessage *cancel = new CancelMessage();
cancel->set_transaction_id(mCurrentTransaction);
mLink->SendMessage(cancel);
CancelCurrentTransactionInternal();
mLink->SendMessage(new CancelMessage());
}
IPC_ASSERT(msg->is_sync(), "can only Send() sync messages here");