Bug 778866 - Abort from the I/O thread on abnormal shutdown of a plugin-process, in case the main thread is wedged and the Firefox process has already been killed, r=cjones

This commit is contained in:
Benjamin Smedberg 2014-03-04 12:17:01 -05:00
Родитель 6a6fc17609
Коммит 070bb00497
3 изменённых файлов: 18 добавлений и 1 удалений

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

@ -144,6 +144,8 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
{
PLUGIN_LOG_DEBUG_METHOD;
GetIPCChannel()->SetAbortOnError(true);
#ifdef XP_WIN
COMMessageFilter::Initialize(this);
#endif
@ -595,6 +597,8 @@ PluginModuleChild::AnswerNP_Shutdown(NPError *rv)
ResetEventHooks();
#endif
GetIPCChannel()->SetAbortOnError(false);
return true;
}

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

@ -204,7 +204,8 @@ MessageChannel::MessageChannel(MessageListener *aListener)
mDispatchingSyncMessage(false),
mDispatchingUrgentMessageCount(0),
mRemoteStackDepthGuess(false),
mSawInterruptOutMsg(false)
mSawInterruptOutMsg(false),
mAbortOnError(false)
{
MOZ_COUNT_CTOR(ipc::MessageChannel);
@ -1517,6 +1518,9 @@ MessageChannel::OnChannelErrorFromLink()
NotifyWorkerThread();
if (ChannelClosing != mChannelState) {
if (mAbortOnError) {
NS_RUNTIMEABORT("Aborting on channel error.");
}
mChannelState = ChannelError;
mMonitor->Notify();
}

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

@ -81,6 +81,11 @@ class MessageChannel : HasResultCodes
// for process links only, not thread links.
void CloseWithError();
void SetAbortOnError(bool abort)
{
mAbortOnError = true;
}
// Asynchronously send a message to the other side of the channel
bool Send(Message* aMsg);
@ -623,6 +628,10 @@ class MessageChannel : HasResultCodes
#ifdef OS_WIN
HANDLE mEvent;
#endif
// Should the channel abort the process from the I/O thread when
// a channel error occurs?
bool mAbortOnError;
};
} // namespace ipc