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
parent 2430ef4e17
commit 3e3a0c94f5
3 changed files with 18 additions and 1 deletions

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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