Fixing bug 169753: NPN_GetURL and friends fail if called before NPP_New returns r=av sr=heikki
git-svn-id: svn://10.0.0.236/trunk@130092 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -800,6 +800,13 @@ nsresult ns4xPluginInstance::InitializePlugin(nsIPluginInstancePeer* peer)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Assign mPeer now and mark this instance as started before calling NPP_New
|
||||
// because the plugin may call other NPAPI functions, like NPN_GetURLNotify,
|
||||
// that assume these are set before returning. If the plugin returns failure,
|
||||
// we'll clear them out below.
|
||||
mPeer = peer;
|
||||
mStarted = PR_TRUE;
|
||||
|
||||
NS_TRY_SAFE_CALL_RETURN(error, CallNPP_NewProc(fCallbacks->newp,
|
||||
(char *)mimetype,
|
||||
&fNPP,
|
||||
@@ -813,13 +820,13 @@ nsresult ns4xPluginInstance::InitializePlugin(nsIPluginInstancePeer* peer)
|
||||
("NPP New called: this=%p, npp=%p, mime=%s, mode=%d, argc=%d, return=%d\n",
|
||||
this, &fNPP, mimetype, mode, count, error));
|
||||
|
||||
if(error != NPERR_NO_ERROR)
|
||||
if(error != NPERR_NO_ERROR) {
|
||||
// since the plugin returned failure, these should not be set
|
||||
mPeer = nsnull;
|
||||
mStarted = PR_FALSE;
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// assign mPeer only if there was no error
|
||||
mPeer = peer;
|
||||
|
||||
mStarted = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user