Bug 957883: Handle channel errors during process launch such that we don't sit on a dead channel for the full time-out (e.g. 45 secs for NPAPI), and allow us to detect when an error happens during child process init. Also, now that it's possible, actually check for an error during NPAPI child process init. r=bsmedberg

This commit is contained in:
Josh Aas 2014-01-11 21:51:00 -06:00
parent 96409b9e9d
commit 426e0ce897
3 changed files with 18 additions and 7 deletions

View File

@ -119,11 +119,9 @@ PluginProcessChild::Init()
return false;
}
mPlugin.Init(pluginFilename, ParentHandle(),
IOThreadChild::message_loop(),
IOThreadChild::channel());
return true;
return mPlugin.Init(pluginFilename, ParentHandle(),
IOThreadChild::message_loop(),
IOThreadChild::channel());
}
void

View File

@ -45,7 +45,6 @@ public:
using mozilla::ipc::GeckoChildProcessHost::GetShutDownEvent;
using mozilla::ipc::GeckoChildProcessHost::GetChannel;
using mozilla::ipc::GeckoChildProcessHost::GetChildProcessHandle;
private:
std::string mPluginFilePath;

View File

@ -301,7 +301,12 @@ GeckoChildProcessHost::SyncLaunch(std::vector<std::string> aExtraOpts, int aTime
// We'll receive several notifications, we need to exit when we
// have either successfully launched or have timed out.
while (mProcessState < PROCESS_CONNECTED) {
while (mProcessState != PROCESS_CONNECTED) {
// If there was an error then return it, don't wait out the timeout.
if (mProcessState == PROCESS_ERROR) {
break;
}
lock.Wait(timeoutTicks);
if (timeoutTicks != PR_INTERVAL_NO_TIMEOUT) {
@ -843,6 +848,15 @@ GeckoChildProcessHost::OnMessageReceived(const IPC::Message& aMsg)
void
GeckoChildProcessHost::OnChannelError()
{
// Update the process state to an error state if we have a channel
// error before we're connected. This fixes certain failures,
// but does not address the full range of possible issues described
// in the FIXME comment below.
MonitorAutoLock lock(mMonitor);
if (mProcessState < PROCESS_CONNECTED) {
mProcessState = PROCESS_ERROR;
lock.Notify();
}
// FIXME/bug 773925: save up this error for the next listener.
}