Bug 829557. Part 2: Allow plugin code to reenter Gecko safely while while the plugin is processing an input event. r=bsmedberg

When nsPluginInstanceOwner passes input events to the plugin instance,
it's safe to reenter Gecko from plugin code and do anything, even
arbitrary script execution.
This commit is contained in:
Robert O'Callahan
2013-02-28 00:50:28 +13:00
parent 9b4faa088f
commit d78efc9174
3 changed files with 11 additions and 9 deletions

View File

@@ -671,7 +671,8 @@ nsresult nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
return NS_OK;
}
nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result)
nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result,
NSPluginCallReentry aSafeToReenterGecko)
{
if (RUNNING != mRunning)
return NS_OK;
@@ -692,7 +693,7 @@ nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result)
mCurrentPluginEvent = event;
#if defined(XP_WIN) || defined(XP_OS2)
NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
aSafeToReenterGecko);
#else
MAIN_THREAD_JNI_REF_GUARD;
tmpResult = (*pluginFunctions->event)(&mNPP, event);