Bug 1117244: Prevent e10s plugin module bridging from preempting async init messages; r=jimm

This commit is contained in:
Aaron Klotz 2015-01-16 14:03:27 -07:00
parent af143b10fe
commit 9b1fe793b0
6 changed files with 26 additions and 11 deletions

View File

@ -2485,7 +2485,9 @@ ContentChild::RecvGetProfile(nsCString* aProfile)
bool
ContentChild::RecvLoadPluginResult(const uint32_t& aPluginId, const bool& aResult)
{
plugins::PluginModuleContentParent::OnLoadPluginResult(aPluginId, aResult);
bool finalResult = aResult && SendConnectPluginBridge(aPluginId);
plugins::PluginModuleContentParent::OnLoadPluginResult(aPluginId,
finalResult);
return true;
}

View File

@ -981,6 +981,12 @@ ContentParent::RecvLoadPlugin(const uint32_t& aPluginId)
return mozilla::plugins::SetupBridge(aPluginId, this);
}
bool
ContentParent::RecvConnectPluginBridge(const uint32_t& aPluginId)
{
return mozilla::plugins::SetupBridge(aPluginId, this, true);
}
bool
ContentParent::RecvFindPlugins(const uint32_t& aPluginEpoch,
nsTArray<PluginTag>* aPlugins,

View File

@ -154,6 +154,7 @@ public:
virtual bool RecvBridgeToChildProcess(const ContentParentId& aCpId) MOZ_OVERRIDE;
virtual bool RecvLoadPlugin(const uint32_t& aPluginId) MOZ_OVERRIDE;
virtual bool RecvConnectPluginBridge(const uint32_t& aPluginId) MOZ_OVERRIDE;
virtual bool RecvFindPlugins(const uint32_t& aPluginEpoch,
nsTArray<PluginTag>* aPlugins,
uint32_t* aNewPluginEpoch) MOZ_OVERRIDE;

View File

@ -594,6 +594,14 @@ parent:
*/
sync LoadPlugin(uint32_t pluginId);
/**
* This call is used by asynchronous plugin instantiation to notify the
* content parent that it is now safe to initiate the plugin bridge for
* the specified plugin id. When this call returns, the requested bridge
* connection has been made.
*/
sync ConnectPluginBridge(uint32_t aPluginId);
/**
* This call returns the set of plugins loaded in the chrome
* process. However, in many cases this set will not have changed since the

View File

@ -16,7 +16,8 @@ class ContentParent;
namespace plugins {
bool
SetupBridge(uint32_t aPluginId, dom::ContentParent* aContentParent);
SetupBridge(uint32_t aPluginId, dom::ContentParent* aContentParent,
bool aForceBridgeNow = false);
bool
FindPluginsForContent(uint32_t aPluginEpoch,

View File

@ -92,7 +92,9 @@ struct RunnableMethodTraits<mozilla::plugins::PluginModuleParent>
};
bool
mozilla::plugins::SetupBridge(uint32_t aPluginId, dom::ContentParent* aContentParent)
mozilla::plugins::SetupBridge(uint32_t aPluginId,
dom::ContentParent* aContentParent,
bool aForceBridgeNow)
{
nsRefPtr<nsPluginHost> host = nsPluginHost::GetInst();
nsRefPtr<nsNPAPIPlugin> plugin;
@ -102,7 +104,7 @@ mozilla::plugins::SetupBridge(uint32_t aPluginId, dom::ContentParent* aContentPa
}
PluginModuleChromeParent* chromeParent = static_cast<PluginModuleChromeParent*>(plugin->GetLibrary());
chromeParent->SetContentParent(aContentParent);
if (chromeParent->IsStartingAsync()) {
if (!aForceBridgeNow && chromeParent->IsStartingAsync()) {
// We'll handle the bridging asynchronously
return true;
}
@ -1832,12 +1834,8 @@ PluginModuleChromeParent::RecvNP_InitializeResult(const NPError& aError)
bool initOk = aError == NPERR_NO_ERROR;
if (initOk) {
SetPluginFuncs(mNPPIface);
if (mIsStartingAsync) {
if (SendAssociatePluginId()) {
PPluginModule::Bridge(mContentParent, this);
} else {
initOk = false;
}
if (mIsStartingAsync && !SendAssociatePluginId()) {
initOk = false;
}
}
mNPInitialized = initOk;
@ -1932,7 +1930,6 @@ PluginModuleChromeParent::RecvNP_InitializeResult(const NPError& aError)
bool ok = true;
if (mContentParent) {
if ((ok = SendAssociatePluginId())) {
PPluginModule::Bridge(mContentParent, this);
ok = mContentParent->SendLoadPluginResult(mPluginId,
aError == NPERR_NO_ERROR);
}