diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 201d8eaf40d9..d0542b68b30a 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -1544,6 +1544,8 @@ PluginModuleParent::DeallocPPluginInstanceParent(PPluginInstanceParent* aActor) void PluginModuleParent::SetPluginFuncs(NPPluginFuncs* aFuncs) { + MOZ_ASSERT(aFuncs); + aFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; aFuncs->javaClass = nullptr; @@ -2179,7 +2181,7 @@ PluginModuleParent::RecvNP_InitializeResult(const NPError& aError) return true; } - if (mIsStartingAsync) { + if (mIsStartingAsync && mNPPIface) { SetPluginFuncs(mNPPIface); InitAsyncSurrogates(); } @@ -2301,8 +2303,17 @@ PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) *error = NPERR_NO_ERROR; if (mIsStartingAsync && !IsChrome()) { - PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs); mNPPIface = pFuncs; +#if defined(XP_MACOSX) + if (mNPInitialized) { + SetPluginFuncs(pFuncs); + InitAsyncSurrogates(); + } else { + PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs); + } +#else + PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs); +#endif } else { SetPluginFuncs(pFuncs); }