Bug 603373 - Remove unused library argument of NS_TRY_SAFE_CALL_* macros r=joshmoz a=benjamin

This commit is contained in:
Jacek Caban 2010-10-14 21:06:31 +00:00
Родитель 518486e4ab
Коммит 406ac00a77
6 изменённых файлов: 33 добавлений и 77 удалений

Просмотреть файл

@ -854,7 +854,7 @@ nsPluginThreadRunnable::Run()
if (mFunc) {
PluginDestructionGuard guard(mInstance);
NS_TRY_SAFE_CALL_VOID(mFunc(mUserData), nsnull, nsnull);
NS_TRY_SAFE_CALL_VOID(mFunc(mUserData), nsnull);
}
return NS_OK;

Просмотреть файл

@ -201,11 +201,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Stop()
mPStreamListeners.RemoveElement(currentListener);
}
if (!mPlugin)
return NS_ERROR_FAILURE;
PluginLibrary* library = mPlugin->GetLibrary();
if (!library)
if (!mPlugin || !mPlugin->GetLibrary())
return NS_ERROR_FAILURE;
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
@ -214,7 +210,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Stop()
if (pluginFunctions->destroy) {
NPSavedData *sdata = 0;
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->destroy)(&mNPP, &sdata), library, this);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->destroy)(&mNPP, &sdata), this);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP Destroy called: this=%p, npp=%p, return=%d\n", this, &mNPP, error));
@ -451,11 +447,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::SetWindow(NPWindow* window)
}
#endif
if (!mPlugin)
return NS_ERROR_FAILURE;
PluginLibrary* library = mPlugin->GetLibrary();
if (!library)
if (!mPlugin || !mPlugin->GetLibrary())
return NS_ERROR_FAILURE;
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
@ -474,7 +466,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::SetWindow(NPWindow* window)
NPPAutoPusher nppPusher(&mNPP);
NPError error;
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setwindow)(&mNPP, (NPWindow*)window), library, this);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setwindow)(&mNPP, (NPWindow*)window), this);
mInPluginInitCall = oldVal;
@ -526,11 +518,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
PluginDestructionGuard guard(this);
if (!mPlugin)
return NS_ERROR_FAILURE;
PluginLibrary* library = mPlugin->GetLibrary();
if (!library)
if (!mPlugin || !mPlugin->GetLibrary())
return NS_ERROR_FAILURE;
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
@ -556,7 +544,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
}
if (pluginFunctions->print)
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->print)(&mNPP, thePrint), library, this);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->print)(&mNPP, thePrint), this);
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",
@ -584,11 +572,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::HandleEvent(void* event, PRInt16* result)
PluginDestructionGuard guard(this);
if (!mPlugin)
return NS_ERROR_FAILURE;
PluginLibrary* library = mPlugin->GetLibrary();
if (!library)
if (!mPlugin || !mPlugin->GetLibrary())
return NS_ERROR_FAILURE;
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
@ -598,7 +582,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::HandleEvent(void* event, PRInt16* result)
if (pluginFunctions->event) {
mCurrentPluginEvent = event;
#if defined(XP_WIN) || defined(XP_OS2)
NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), library, this);
NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), this);
#else
tmpResult = (*pluginFunctions->event)(&mNPP, event);
#endif
@ -624,11 +608,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, vo
return NS_OK;
}
#endif
if (!mPlugin)
return NS_ERROR_FAILURE;
PluginLibrary* library = mPlugin->GetLibrary();
if (!library)
if (!mPlugin || !mPlugin->GetLibrary())
return NS_ERROR_FAILURE;
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
@ -637,7 +617,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, vo
if (pluginFunctions->getvalue && RUNNING == mRunning) {
PluginDestructionGuard guard(this);
NS_TRY_SAFE_CALL_RETURN(rv, (*pluginFunctions->getvalue)(&mNPP, variable, value), library, this);
NS_TRY_SAFE_CALL_RETURN(rv, (*pluginFunctions->getvalue)(&mNPP, variable, value), this);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP GetValue called: this=%p, npp=%p, var=%d, value=%d, return=%d\n",
this, &mNPP, variable, value, rv));
@ -1003,11 +983,7 @@ nsNPAPIPluginInstance::PrivateModeStateChanged()
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance informing plugin of private mode state change this=%p\n",this));
if (!mPlugin)
return NS_ERROR_FAILURE;
PluginLibrary* library = mPlugin->GetLibrary();
if (!library)
if (!mPlugin || !mPlugin->GetLibrary())
return NS_ERROR_FAILURE;
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
@ -1024,7 +1000,7 @@ nsNPAPIPluginInstance::PrivateModeStateChanged()
NPError error;
NPBool value = static_cast<NPBool>(pme);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVprivateModeBool, &value), library, this);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVprivateModeBool, &value), this);
return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE;
}
}

Просмотреть файл

@ -215,11 +215,7 @@ nsNPAPIPluginStreamListener::CleanUpStream(NPReason reason)
PluginDestructionGuard guard(mInst);
nsNPAPIPlugin* plugin = mInst->GetPlugin();
if (!plugin)
return rv;
PluginLibrary* library = plugin->GetLibrary();
if (!library)
if (!plugin || !plugin->GetLibrary())
return rv;
NPPluginFuncs* pluginFunctions = plugin->PluginFuncs();
@ -231,7 +227,7 @@ nsNPAPIPluginStreamListener::CleanUpStream(NPReason reason)
NPPAutoPusher nppPusher(npp);
NPError error;
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->destroystream)(npp, &mNPStream, reason), library, mInst);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->destroystream)(npp, &mNPStream, reason), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP DestroyStream called: this=%p, npp=%p, reason=%d, return=%d, url=%s\n",
@ -260,11 +256,7 @@ nsNPAPIPluginStreamListener::CallURLNotify(NPReason reason)
mCallNotify = PR_FALSE; // only do this ONCE and prevent recursion
nsNPAPIPlugin* plugin = mInst->GetPlugin();
if (!plugin)
return;
PluginLibrary* library = plugin->GetLibrary();
if (!library)
if (!plugin || !plugin->GetLibrary())
return;
NPPluginFuncs* pluginFunctions = plugin->PluginFuncs();
@ -273,7 +265,7 @@ nsNPAPIPluginStreamListener::CallURLNotify(NPReason reason)
NPP npp;
mInst->GetNPP(&npp);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->urlnotify)(npp, mNotifyURL, reason, mNotifyData), library, mInst);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->urlnotify)(npp, mNotifyURL, reason, mNotifyData), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP URLNotify called: this=%p, npp=%p, notify=%p, reason=%d, url=%s\n",
@ -290,11 +282,7 @@ nsNPAPIPluginStreamListener::OnStartBinding(nsIPluginStreamInfo* pluginInfo)
PluginDestructionGuard guard(mInst);
nsNPAPIPlugin* plugin = mInst->GetPlugin();
if (!plugin)
return NS_ERROR_FAILURE;
PluginLibrary* library = plugin->GetLibrary();
if (!library)
if (!plugin || !plugin->GetLibrary())
return NS_ERROR_FAILURE;
NPPluginFuncs* pluginFunctions = plugin->PluginFuncs();
@ -328,7 +316,7 @@ nsNPAPIPluginStreamListener::OnStartBinding(nsIPluginStreamInfo* pluginInfo)
NPPAutoPusher nppPusher(npp);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->newstream)(npp, (char*)contentType, &mNPStream, seekable, &streamType), library, mInst);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->newstream)(npp, (char*)contentType, &mNPStream, seekable, &streamType), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP NewStream called: this=%p, npp=%p, mime=%s, seek=%d, type=%d, return=%d, url=%s\n",
@ -464,11 +452,7 @@ nsNPAPIPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
mStreamInfo = pluginInfo;
nsNPAPIPlugin* plugin = mInst->GetPlugin();
if (!plugin)
return NS_ERROR_FAILURE;
PluginLibrary* library = plugin->GetLibrary();
if (!library)
if (!plugin || !plugin->GetLibrary())
return NS_ERROR_FAILURE;
NPPluginFuncs* pluginFunctions = plugin->PluginFuncs();
@ -588,7 +572,7 @@ nsNPAPIPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
if (pluginFunctions->writeready) {
NPPAutoPusher nppPusher(npp);
NS_TRY_SAFE_CALL_RETURN(numtowrite, (*pluginFunctions->writeready)(npp, &mNPStream), library, mInst);
NS_TRY_SAFE_CALL_RETURN(numtowrite, (*pluginFunctions->writeready)(npp, &mNPStream), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NOISY,
("NPP WriteReady called: this=%p, npp=%p, "
"return(towrite)=%d, url=%s\n",
@ -637,7 +621,7 @@ nsNPAPIPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
NPPAutoPusher nppPusher(npp);
PRInt32 writeCount = 0; // bytes consumed by plugin instance
NS_TRY_SAFE_CALL_RETURN(writeCount, (*pluginFunctions->write)(npp, &mNPStream, streamPosition, numtowrite, ptrStreamBuffer), library, mInst);
NS_TRY_SAFE_CALL_RETURN(writeCount, (*pluginFunctions->write)(npp, &mNPStream, streamPosition, numtowrite, ptrStreamBuffer), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NOISY,
("NPP Write called: this=%p, npp=%p, pos=%d, len=%d, "
@ -734,11 +718,7 @@ nsNPAPIPluginStreamListener::OnFileAvailable(nsIPluginStreamInfo* pluginInfo,
PluginDestructionGuard guard(mInst);
nsNPAPIPlugin* plugin = mInst->GetPlugin();
if (!plugin)
return NS_ERROR_FAILURE;
PluginLibrary* library = plugin->GetLibrary();
if (!library)
if (!plugin || !plugin->GetLibrary())
return NS_ERROR_FAILURE;
NPPluginFuncs* pluginFunctions = plugin->PluginFuncs();
@ -749,7 +729,7 @@ nsNPAPIPluginStreamListener::OnFileAvailable(nsIPluginStreamInfo* pluginInfo,
NPP npp;
mInst->GetNPP(&npp);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->asfile)(npp, &mNPStream, fileName), library, mInst);
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->asfile)(npp, &mNPStream, fileName), mInst);
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP StreamAsFile called: this=%p, npp=%p, url=%s, file=%s\n",

Просмотреть файл

@ -333,7 +333,7 @@ NS_IMETHODIMP nsPluginUnloadEvent::Run()
{
if (mLibrary) {
// put our unload call in a safety wrapper
NS_TRY_SAFE_CALL_VOID(PR_UnloadLibrary(mLibrary), nsnull, nsnull);
NS_TRY_SAFE_CALL_VOID(PR_UnloadLibrary(mLibrary), nsnull);
} else {
NS_WARNING("missing library from nsPluginUnloadEvent");
}
@ -348,7 +348,7 @@ nsresult nsPluginHost::PostPluginUnloadEvent(PRLibrary* aLibrary)
return NS_OK;
// failure case
NS_TRY_SAFE_CALL_VOID(PR_UnloadLibrary(aLibrary), nsnull, nsnull);
NS_TRY_SAFE_CALL_VOID(PR_UnloadLibrary(aLibrary), nsnull);
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -183,7 +183,7 @@ static PRBool ProcessFlashMessageDelayed(nsPluginNativeWindowWin * aWin, nsIPlug
// See PluginWindowEvent::Run() below.
NS_ASSERTION((sWM_FLASHBOUNCEMSG != 0), "RegisterWindowMessage failed in flash plugin WM_USER message handling!");
NS_TRY_SAFE_CALL_VOID(::CallWindowProc((WNDPROC)aWin->GetWindowProc(), hWnd, WM_USER_FLASH, wParam, lParam),
nsnull, aInst);
aInst);
return TRUE;
}
@ -352,7 +352,7 @@ static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
LRESULT res = TRUE;
NS_TRY_SAFE_CALL_RETURN(res,
::CallWindowProc((WNDPROC)win->GetWindowProc(), hWnd, msg, wParam, lParam),
nsnull, inst);
inst);
sInMessageDispatch = PR_FALSE;
@ -446,7 +446,7 @@ NS_IMETHODIMP PluginWindowEvent::Run()
GetMsg(),
GetWParam(),
GetLParam()),
nsnull, inst);
inst);
}
Clear();

Просмотреть файл

@ -62,7 +62,7 @@ PR_BEGIN_MACRO \
res = pref->GetBoolPref("plugin.dont_try_safe_calls", &gSkipPluginSafeCalls);\
PR_END_MACRO
#define NS_TRY_SAFE_CALL_RETURN(ret, fun, library, pluginInst) \
#define NS_TRY_SAFE_CALL_RETURN(ret, fun, pluginInst) \
PR_BEGIN_MACRO \
PRIntervalTime startTime = PR_IntervalNow(); \
if(gSkipPluginSafeCalls) \
@ -85,7 +85,7 @@ PR_BEGIN_MACRO \
NS_NotifyPluginCall(startTime); \
PR_END_MACRO
#define NS_TRY_SAFE_CALL_VOID(fun, library, pluginInst) \
#define NS_TRY_SAFE_CALL_VOID(fun, pluginInst) \
PR_BEGIN_MACRO \
PRIntervalTime startTime = PR_IntervalNow(); \
if(gSkipPluginSafeCalls) \
@ -109,14 +109,14 @@ PR_END_MACRO
#else // vanilla calls
#define NS_TRY_SAFE_CALL_RETURN(ret, fun, library, pluginInst) \
#define NS_TRY_SAFE_CALL_RETURN(ret, fun, pluginInst) \
PR_BEGIN_MACRO \
PRIntervalTime startTime = PR_IntervalNow(); \
ret = fun; \
NS_NotifyPluginCall(startTime); \
PR_END_MACRO
#define NS_TRY_SAFE_CALL_VOID(fun, library, pluginInst) \
#define NS_TRY_SAFE_CALL_VOID(fun, pluginInst) \
PR_BEGIN_MACRO \
PRIntervalTime startTime = PR_IntervalNow(); \
fun; \