Fix for Bug 1416. Moving the call of the plugin entry point into Initialize (after the mPluginManager is set up).

This is so that NPN calls can get resolved if the plugin makes them in the entry point routine.


git-svn-id: svn://10.0.0.236/trunk@15137 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
amusil%netscape.com
1998-11-22 23:13:44 +00:00
parent 5b6c955aac
commit 5445c054f5
4 changed files with 16 additions and 12 deletions

View File

@@ -74,12 +74,13 @@ ns4xPlugin::CheckClassInitialized(void)
////////////////////////////////////////////////////////////////////////
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown)
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown, NP_PLUGININIT aInit)
{
NS_INIT_REFCNT();
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
fShutdownEntry = aShutdown;
fInitialize = aInit;
}
@@ -192,10 +193,7 @@ ns4xPlugin::CreatePlugin(PRLibrary *library,
if (pfnInitialize == NULL)
return NS_ERROR_UNEXPECTED; // XXX Right error?
if (pfnInitialize(&ns4xPlugin::CALLBACKS) != NS_OK)
return NS_ERROR_UNEXPECTED; // XXX shoudl convert the 4.x error...
*result = new ns4xPlugin(&callbacks, pfnShutdown);
*result = new ns4xPlugin(&callbacks, pfnShutdown, pfnInitialize);
NS_ADDREF(*result);
@@ -254,6 +252,9 @@ ns4xPlugin::Initialize(nsISupports* browserInterfaces)
if (nsnull == mMalloc)
rv = browserInterfaces->QueryInterface(kIMallocIID, (void **)&mMalloc);
if (fInitialize(&ns4xPlugin::CALLBACKS) != NS_OK)
rv = NS_ERROR_UNEXPECTED; // XXX shoudl convert the 4.x error...
return rv;
}

View File

@@ -64,7 +64,7 @@ typedef NPError (PLUGIN_ENTRYPOINT_CALL_TYPE *NP_PLUGINSHUTDOWN)();
class ns4xPlugin : public nsILiveConnectPlugin
{
public:
ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown);
ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown, NP_PLUGININIT aInit);
~ns4xPlugin(void);
NS_DECL_ISUPPORTS
@@ -219,6 +219,7 @@ protected:
*/
NPPluginFuncs fCallbacks;
NP_PLUGININIT fInitialize;
NP_PLUGINSHUTDOWN fShutdownEntry;
/**

View File

@@ -74,12 +74,13 @@ ns4xPlugin::CheckClassInitialized(void)
////////////////////////////////////////////////////////////////////////
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown)
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown, NP_PLUGININIT aInit)
{
NS_INIT_REFCNT();
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
fShutdownEntry = aShutdown;
fInitialize = aInit;
}
@@ -192,10 +193,7 @@ ns4xPlugin::CreatePlugin(PRLibrary *library,
if (pfnInitialize == NULL)
return NS_ERROR_UNEXPECTED; // XXX Right error?
if (pfnInitialize(&ns4xPlugin::CALLBACKS) != NS_OK)
return NS_ERROR_UNEXPECTED; // XXX shoudl convert the 4.x error...
*result = new ns4xPlugin(&callbacks, pfnShutdown);
*result = new ns4xPlugin(&callbacks, pfnShutdown, pfnInitialize);
NS_ADDREF(*result);
@@ -254,6 +252,9 @@ ns4xPlugin::Initialize(nsISupports* browserInterfaces)
if (nsnull == mMalloc)
rv = browserInterfaces->QueryInterface(kIMallocIID, (void **)&mMalloc);
if (fInitialize(&ns4xPlugin::CALLBACKS) != NS_OK)
rv = NS_ERROR_UNEXPECTED; // XXX shoudl convert the 4.x error...
return rv;
}

View File

@@ -64,7 +64,7 @@ typedef NPError (PLUGIN_ENTRYPOINT_CALL_TYPE *NP_PLUGINSHUTDOWN)();
class ns4xPlugin : public nsILiveConnectPlugin
{
public:
ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown);
ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown, NP_PLUGININIT aInit);
~ns4xPlugin(void);
NS_DECL_ISUPPORTS
@@ -219,6 +219,7 @@ protected:
*/
NPPluginFuncs fCallbacks;
NP_PLUGININIT fInitialize;
NP_PLUGINSHUTDOWN fShutdownEntry;
/**