Bug 829557. Part 1: When calling into plugin code, identify situations where it is safe (or unsafe) to reenter Gecko from plugin code. r=bsmedberg
When Gecko is reentered from unsafe call sites, we allow the reentry, but we suppress execution of the refresh driver to minimize the danger. In this patch, we treat all sites as unsafe.
This commit is contained in:
@@ -213,7 +213,7 @@ nsNPAPIPluginInstance::~nsNPAPIPluginInstance()
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t nsNPAPIPluginInstance::gInPluginCalls = 0;
|
||||
uint32_t nsNPAPIPluginInstance::gInUnsafePluginCalls = 0;
|
||||
|
||||
void
|
||||
nsNPAPIPluginInstance::Destroy()
|
||||
@@ -317,7 +317,8 @@ nsresult nsNPAPIPluginInstance::Stop()
|
||||
if (pluginFunctions->destroy) {
|
||||
NPSavedData *sdata = 0;
|
||||
|
||||
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->destroy)(&mNPP, &sdata), this);
|
||||
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->destroy)(&mNPP, &sdata), this,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
|
||||
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
|
||||
("NPP Destroy called: this=%p, npp=%p, return=%d\n", this, &mNPP, error));
|
||||
@@ -582,7 +583,8 @@ nsresult nsNPAPIPluginInstance::SetWindow(NPWindow* window)
|
||||
NPPAutoPusher nppPusher(&mNPP);
|
||||
|
||||
DebugOnly<NPError> error;
|
||||
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setwindow)(&mNPP, (NPWindow*)window), this);
|
||||
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setwindow)(&mNPP, (NPWindow*)window), this,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
|
||||
mInPluginInitCall = oldVal;
|
||||
|
||||
@@ -650,7 +652,8 @@ nsresult nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
|
||||
}
|
||||
|
||||
if (pluginFunctions->print)
|
||||
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->print)(&mNPP, thePrint), this);
|
||||
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->print)(&mNPP, thePrint), this,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
|
||||
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
|
||||
("NPP PrintProc called: this=%p, pDC=%p, [x=%d,y=%d,w=%d,h=%d], clip[t=%d,b=%d,l=%d,r=%d]\n",
|
||||
@@ -688,7 +691,8 @@ nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result)
|
||||
if (pluginFunctions->event) {
|
||||
mCurrentPluginEvent = event;
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), this);
|
||||
NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), this,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
#else
|
||||
MAIN_THREAD_JNI_REF_GUARD;
|
||||
tmpResult = (*pluginFunctions->event)(&mNPP, event);
|
||||
@@ -718,7 +722,8 @@ nsresult nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* v
|
||||
PluginDestructionGuard guard(this);
|
||||
|
||||
NPError pluginError = NPERR_GENERIC_ERROR;
|
||||
NS_TRY_SAFE_CALL_RETURN(pluginError, (*pluginFunctions->getvalue)(&mNPP, variable, value), this);
|
||||
NS_TRY_SAFE_CALL_RETURN(pluginError, (*pluginFunctions->getvalue)(&mNPP, variable, value), this,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
|
||||
("NPP GetValue called: this=%p, npp=%p, var=%d, value=%d, return=%d\n",
|
||||
this, &mNPP, variable, value, pluginError));
|
||||
@@ -1404,7 +1409,8 @@ nsNPAPIPluginInstance::PrivateModeStateChanged(bool enabled)
|
||||
|
||||
NPError error;
|
||||
NPBool value = static_cast<NPBool>(enabled);
|
||||
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVprivateModeBool, &value), this);
|
||||
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVprivateModeBool, &value), this,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user