mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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. --HG-- extra : rebase_source : 815683c3027b906c4744495e8e1cfdb261e0c557
This commit is contained in:
parent
1b97fac2e6
commit
21bba7fe47
@ -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);
|
||||
|
@ -87,7 +87,8 @@ public:
|
||||
nsresult SetWindow(NPWindow* window);
|
||||
nsresult NewStreamFromPlugin(const char* type, const char* target, nsIOutputStream* *result);
|
||||
nsresult Print(NPPrint* platformPrint);
|
||||
nsresult HandleEvent(void* event, int16_t* result);
|
||||
nsresult HandleEvent(void* event, int16_t* result,
|
||||
NSPluginCallReentry aSafeToReenterGecko = NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
nsresult GetValueFromPlugin(NPPVariable variable, void* value);
|
||||
nsresult GetDrawingModel(int32_t* aModel);
|
||||
nsresult IsRemoteDrawingCoreAnimation(bool* aDrawing);
|
||||
|
@ -2066,7 +2066,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
int16_t response = kNPEventNotHandled;
|
||||
void* window = FixUpPluginWindow(ePluginPaintEnable);
|
||||
if (window || (eventModel == NPEventModelCocoa)) {
|
||||
mInstance->HandleEvent(event, &response);
|
||||
mInstance->HandleEvent(event, &response, NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
|
||||
}
|
||||
|
||||
if (eventModel == NPEventModelCocoa && response == kNPEventStartIME) {
|
||||
@ -2182,7 +2182,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
|
||||
if (pPluginEvent) {
|
||||
int16_t response = kNPEventNotHandled;
|
||||
mInstance->HandleEvent(pPluginEvent, &response);
|
||||
mInstance->HandleEvent(pPluginEvent, &response, NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
|
||||
if (response == kNPEventHandled)
|
||||
rv = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
@ -2440,7 +2440,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
event.send_event = False;
|
||||
|
||||
int16_t response = kNPEventNotHandled;
|
||||
mInstance->HandleEvent(&pluginEvent, &response);
|
||||
mInstance->HandleEvent(&pluginEvent, &response, NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
|
||||
if (response == kNPEventHandled)
|
||||
rv = nsEventStatus_eConsumeNoDefault;
|
||||
#endif
|
||||
@ -2492,7 +2492,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
event.data.mouse.action = kDown_ANPMouseAction;
|
||||
event.data.mouse.x = pluginPoint.x;
|
||||
event.data.mouse.y = pluginPoint.y;
|
||||
mInstance->HandleEvent(&event, nullptr);
|
||||
mInstance->HandleEvent(&event, nullptr, NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
|
||||
}
|
||||
break;
|
||||
case NS_MOUSE_BUTTON_UP:
|
||||
@ -2503,7 +2503,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
event.data.mouse.action = kUp_ANPMouseAction;
|
||||
event.data.mouse.x = pluginPoint.x;
|
||||
event.data.mouse.y = pluginPoint.y;
|
||||
mInstance->HandleEvent(&event, nullptr);
|
||||
mInstance->HandleEvent(&event, nullptr, NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2519,7 +2519,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
if (pluginEvent) {
|
||||
MOZ_ASSERT(pluginEvent->inSize == sizeof(ANPEvent));
|
||||
MOZ_ASSERT(pluginEvent->eventType == kKey_ANPEventType);
|
||||
mInstance->HandleEvent(pluginEvent, nullptr);
|
||||
mInstance->HandleEvent(pluginEvent, nullptr, NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user