Clean up a bunch of things in nsNPAPIPlugin. b=543339
authorJosh Aas <joshmoz@gmail.com>
Sun, 31 Jan 2010 16:41:26 -0500
changeset 37780 e5958f05a6dcf7442bb5a0c179030e8f1ef9d776
parent 37779 a15f09d028593f9ba5235928589d74a05d7af9b3
child 37781 8d97e554054633f72005cffb6d55c481fa3c5539
push id11428
push userjosh@mozilla.com
push dateSun, 31 Jan 2010 21:41:40 +0000
treeherderautoland@e5958f05a6dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs543339
milestone1.9.3a1pre
Clean up a bunch of things in nsNPAPIPlugin. b=543339
dom/plugins/PluginModuleChild.h
modules/plugin/base/src/nsNPAPIPlugin.cpp
modules/plugin/base/src/nsNPAPIPlugin.h
--- a/dom/plugins/PluginModuleChild.h
+++ b/dom/plugins/PluginModuleChild.h
@@ -78,19 +78,16 @@
 #else
 #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (* _name)
 #endif
 
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_GETENTRYPOINTS) (NPPluginFuncs* pCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGININIT) (const NPNetscapeFuncs* pCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINUNIXINIT) (const NPNetscapeFuncs* pCallbacks, NPPluginFuncs* fCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINSHUTDOWN) (void);
-#ifdef XP_MACOSX
-typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_MAIN) (NPNetscapeFuncs* nCallbacks, NPPluginFuncs* pCallbacks, NPP_ShutdownProcPtr* unloadProcPtr);
-#endif
 
 namespace mozilla {
 namespace plugins {
 
 class PluginScriptableObjectChild;
 class PluginInstanceChild;
 
 class PluginModuleChild : public PPluginModuleChild
--- a/modules/plugin/base/src/nsNPAPIPlugin.cpp
+++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp
@@ -104,16 +104,17 @@ using mozilla::PluginLibrary;
 #include "mozilla/PluginPRLibrary.h"
 using mozilla::PluginPRLibrary;
 
 #ifdef MOZ_IPC
 #include "mozilla/plugins/PluginModuleParent.h"
 using mozilla::plugins::PluginModuleParent;
 #endif
 
+static NPNetscapeFuncs sBrowserFuncs;
 static PRLock *sPluginThreadAsyncCallLock = nsnull;
 static PRCList sPendingAsyncCalls = PR_INIT_STATIC_CLIST(&sPendingAsyncCalls);
 
 // POST/GET stream type
 enum eNPPStreamTypeInternal {
   eNPPStreamTypeInternal_Get,
   eNPPStreamTypeInternal_Post
 };
@@ -137,172 +138,169 @@ void NS_NotifyPluginCall(PRIntervalTime 
   float runTimeInSeconds = float(endTime) / PR_TicksPerSecond();
   nsAutoString runTimeString;
   runTimeString.AppendFloat(runTimeInSeconds);
   const PRUnichar* runTime = runTimeString.get();
   notifyUIService->NotifyObservers(nsnull, "experimental-notify-plugin-call",
                                    runTime);
 }
 
-NPNetscapeFuncs nsNPAPIPlugin::CALLBACKS;
-
 void
-nsNPAPIPlugin::CheckClassInitialized(void)
+nsNPAPIPlugin::CheckClassInitialized()
 {
   static PRBool initialized = PR_FALSE;
 
   if (initialized)
     return;
 
   // XXX It'd be nice to make this const and initialize it statically...
-  CALLBACKS.size = sizeof(CALLBACKS);
-  CALLBACKS.version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
-  CALLBACKS.geturl = ((NPN_GetURLProcPtr)_geturl);
-  CALLBACKS.posturl = ((NPN_PostURLProcPtr)_posturl);
-  CALLBACKS.requestread = ((NPN_RequestReadProcPtr)_requestread);
-  CALLBACKS.newstream = ((NPN_NewStreamProcPtr)_newstream);
-  CALLBACKS.write = ((NPN_WriteProcPtr)_write);
-  CALLBACKS.destroystream = ((NPN_DestroyStreamProcPtr)_destroystream);
-  CALLBACKS.status = ((NPN_StatusProcPtr)_status);
-  CALLBACKS.uagent = ((NPN_UserAgentProcPtr)_useragent);
-  CALLBACKS.memalloc = ((NPN_MemAllocProcPtr)_memalloc);
-  CALLBACKS.memfree = ((NPN_MemFreeProcPtr)_memfree);
-  CALLBACKS.memflush = ((NPN_MemFlushProcPtr)_memflush);
-  CALLBACKS.reloadplugins = ((NPN_ReloadPluginsProcPtr)_reloadplugins);
-
-  // Deprecated API callbacks.
-  CALLBACKS.getJavaEnv = ((NPN_GetJavaEnvProcPtr)_getJavaEnv);
-  CALLBACKS.getJavaPeer = ((NPN_GetJavaPeerProcPtr)_getJavaPeer);
-  CALLBACKS.geturlnotify = ((NPN_GetURLNotifyProcPtr)_geturlnotify);
-  CALLBACKS.posturlnotify = ((NPN_PostURLNotifyProcPtr)_posturlnotify);
-  CALLBACKS.getvalue = ((NPN_GetValueProcPtr)_getvalue);
-  CALLBACKS.setvalue = ((NPN_SetValueProcPtr)_setvalue);
-  CALLBACKS.invalidaterect = ((NPN_InvalidateRectProcPtr)_invalidaterect);
-  CALLBACKS.invalidateregion = ((NPN_InvalidateRegionProcPtr)_invalidateregion);
-  CALLBACKS.forceredraw = ((NPN_ForceRedrawProcPtr)_forceredraw);
-  CALLBACKS.getstringidentifier = ((NPN_GetStringIdentifierProcPtr)_getstringidentifier);
-  CALLBACKS.getstringidentifiers = ((NPN_GetStringIdentifiersProcPtr)_getstringidentifiers);
-  CALLBACKS.getintidentifier = ((NPN_GetIntIdentifierProcPtr)_getintidentifier);
-  CALLBACKS.identifierisstring = ((NPN_IdentifierIsStringProcPtr)_identifierisstring);
-  CALLBACKS.utf8fromidentifier = ((NPN_UTF8FromIdentifierProcPtr)_utf8fromidentifier);
-  CALLBACKS.intfromidentifier = ((NPN_IntFromIdentifierProcPtr)_intfromidentifier);
-  CALLBACKS.createobject = ((NPN_CreateObjectProcPtr)_createobject);
-  CALLBACKS.retainobject = ((NPN_RetainObjectProcPtr)_retainobject);
-  CALLBACKS.releaseobject = ((NPN_ReleaseObjectProcPtr)_releaseobject);
-  CALLBACKS.invoke = ((NPN_InvokeProcPtr)_invoke);
-  CALLBACKS.invokeDefault = ((NPN_InvokeDefaultProcPtr)_invokeDefault);
-  CALLBACKS.evaluate = ((NPN_EvaluateProcPtr)_evaluate);
-  CALLBACKS.getproperty = ((NPN_GetPropertyProcPtr)_getproperty);
-  CALLBACKS.setproperty = ((NPN_SetPropertyProcPtr)_setproperty);
-  CALLBACKS.removeproperty = ((NPN_RemovePropertyProcPtr)_removeproperty);
-  CALLBACKS.hasproperty = ((NPN_HasPropertyProcPtr)_hasproperty);
-  CALLBACKS.hasmethod = ((NPN_HasMethodProcPtr)_hasmethod);
-  CALLBACKS.enumerate = ((NPN_EnumerateProcPtr)_enumerate);
-  CALLBACKS.construct = ((NPN_ConstructProcPtr)_construct);
-  CALLBACKS.releasevariantvalue = ((NPN_ReleaseVariantValueProcPtr)_releasevariantvalue);
-  CALLBACKS.setexception = ((NPN_SetExceptionProcPtr)_setexception);
-  CALLBACKS.pushpopupsenabledstate = ((NPN_PushPopupsEnabledStateProcPtr)_pushpopupsenabledstate);
-  CALLBACKS.poppopupsenabledstate = ((NPN_PopPopupsEnabledStateProcPtr)_poppopupsenabledstate);
-  CALLBACKS.pluginthreadasynccall = ((NPN_PluginThreadAsyncCallProcPtr)_pluginthreadasynccall);
-  CALLBACKS.getvalueforurl = ((NPN_GetValueForURLPtr)_getvalueforurl);
-  CALLBACKS.setvalueforurl = ((NPN_SetValueForURLPtr)_setvalueforurl);
-  CALLBACKS.getauthenticationinfo = ((NPN_GetAuthenticationInfoPtr)_getauthenticationinfo);
-  CALLBACKS.scheduletimer = ((NPN_ScheduleTimerPtr)_scheduletimer);
-  CALLBACKS.unscheduletimer = ((NPN_UnscheduleTimerPtr)_unscheduletimer);
-  CALLBACKS.popupcontextmenu = ((NPN_PopUpContextMenuPtr)_popupcontextmenu);
-  CALLBACKS.convertpoint = ((NPN_ConvertPointPtr)_convertpoint);
+  sBrowserFuncs.size = sizeof(sBrowserFuncs);
+  sBrowserFuncs.version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
+  sBrowserFuncs.geturl = ((NPN_GetURLProcPtr)_geturl);
+  sBrowserFuncs.posturl = ((NPN_PostURLProcPtr)_posturl);
+  sBrowserFuncs.requestread = ((NPN_RequestReadProcPtr)_requestread);
+  sBrowserFuncs.newstream = ((NPN_NewStreamProcPtr)_newstream);
+  sBrowserFuncs.write = ((NPN_WriteProcPtr)_write);
+  sBrowserFuncs.destroystream = ((NPN_DestroyStreamProcPtr)_destroystream);
+  sBrowserFuncs.status = ((NPN_StatusProcPtr)_status);
+  sBrowserFuncs.uagent = ((NPN_UserAgentProcPtr)_useragent);
+  sBrowserFuncs.memalloc = ((NPN_MemAllocProcPtr)_memalloc);
+  sBrowserFuncs.memfree = ((NPN_MemFreeProcPtr)_memfree);
+  sBrowserFuncs.memflush = ((NPN_MemFlushProcPtr)_memflush);
+  sBrowserFuncs.reloadplugins = ((NPN_ReloadPluginsProcPtr)_reloadplugins);
+  sBrowserFuncs.getJavaEnv = ((NPN_GetJavaEnvProcPtr)_getJavaEnv);
+  sBrowserFuncs.getJavaPeer = ((NPN_GetJavaPeerProcPtr)_getJavaPeer);
+  sBrowserFuncs.geturlnotify = ((NPN_GetURLNotifyProcPtr)_geturlnotify);
+  sBrowserFuncs.posturlnotify = ((NPN_PostURLNotifyProcPtr)_posturlnotify);
+  sBrowserFuncs.getvalue = ((NPN_GetValueProcPtr)_getvalue);
+  sBrowserFuncs.setvalue = ((NPN_SetValueProcPtr)_setvalue);
+  sBrowserFuncs.invalidaterect = ((NPN_InvalidateRectProcPtr)_invalidaterect);
+  sBrowserFuncs.invalidateregion = ((NPN_InvalidateRegionProcPtr)_invalidateregion);
+  sBrowserFuncs.forceredraw = ((NPN_ForceRedrawProcPtr)_forceredraw);
+  sBrowserFuncs.getstringidentifier = ((NPN_GetStringIdentifierProcPtr)_getstringidentifier);
+  sBrowserFuncs.getstringidentifiers = ((NPN_GetStringIdentifiersProcPtr)_getstringidentifiers);
+  sBrowserFuncs.getintidentifier = ((NPN_GetIntIdentifierProcPtr)_getintidentifier);
+  sBrowserFuncs.identifierisstring = ((NPN_IdentifierIsStringProcPtr)_identifierisstring);
+  sBrowserFuncs.utf8fromidentifier = ((NPN_UTF8FromIdentifierProcPtr)_utf8fromidentifier);
+  sBrowserFuncs.intfromidentifier = ((NPN_IntFromIdentifierProcPtr)_intfromidentifier);
+  sBrowserFuncs.createobject = ((NPN_CreateObjectProcPtr)_createobject);
+  sBrowserFuncs.retainobject = ((NPN_RetainObjectProcPtr)_retainobject);
+  sBrowserFuncs.releaseobject = ((NPN_ReleaseObjectProcPtr)_releaseobject);
+  sBrowserFuncs.invoke = ((NPN_InvokeProcPtr)_invoke);
+  sBrowserFuncs.invokeDefault = ((NPN_InvokeDefaultProcPtr)_invokeDefault);
+  sBrowserFuncs.evaluate = ((NPN_EvaluateProcPtr)_evaluate);
+  sBrowserFuncs.getproperty = ((NPN_GetPropertyProcPtr)_getproperty);
+  sBrowserFuncs.setproperty = ((NPN_SetPropertyProcPtr)_setproperty);
+  sBrowserFuncs.removeproperty = ((NPN_RemovePropertyProcPtr)_removeproperty);
+  sBrowserFuncs.hasproperty = ((NPN_HasPropertyProcPtr)_hasproperty);
+  sBrowserFuncs.hasmethod = ((NPN_HasMethodProcPtr)_hasmethod);
+  sBrowserFuncs.enumerate = ((NPN_EnumerateProcPtr)_enumerate);
+  sBrowserFuncs.construct = ((NPN_ConstructProcPtr)_construct);
+  sBrowserFuncs.releasevariantvalue = ((NPN_ReleaseVariantValueProcPtr)_releasevariantvalue);
+  sBrowserFuncs.setexception = ((NPN_SetExceptionProcPtr)_setexception);
+  sBrowserFuncs.pushpopupsenabledstate = ((NPN_PushPopupsEnabledStateProcPtr)_pushpopupsenabledstate);
+  sBrowserFuncs.poppopupsenabledstate = ((NPN_PopPopupsEnabledStateProcPtr)_poppopupsenabledstate);
+  sBrowserFuncs.pluginthreadasynccall = ((NPN_PluginThreadAsyncCallProcPtr)_pluginthreadasynccall);
+  sBrowserFuncs.getvalueforurl = ((NPN_GetValueForURLPtr)_getvalueforurl);
+  sBrowserFuncs.setvalueforurl = ((NPN_SetValueForURLPtr)_setvalueforurl);
+  sBrowserFuncs.getauthenticationinfo = ((NPN_GetAuthenticationInfoPtr)_getauthenticationinfo);
+  sBrowserFuncs.scheduletimer = ((NPN_ScheduleTimerPtr)_scheduletimer);
+  sBrowserFuncs.unscheduletimer = ((NPN_UnscheduleTimerPtr)_unscheduletimer);
+  sBrowserFuncs.popupcontextmenu = ((NPN_PopUpContextMenuPtr)_popupcontextmenu);
+  sBrowserFuncs.convertpoint = ((NPN_ConvertPointPtr)_convertpoint);
 
   if (!sPluginThreadAsyncCallLock)
     sPluginThreadAsyncCallLock = nsAutoLock::NewLock("sPluginThreadAsyncCallLock");
 
   initialized = PR_TRUE;
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,("NPN callbacks initialized\n"));
 }
 
 NS_IMPL_ISUPPORTS1(nsNPAPIPlugin, nsIPlugin)
 
 nsNPAPIPlugin::nsNPAPIPlugin(NPPluginFuncs* callbacks, 
                              PluginLibrary* aLibrary)
 {
-  memset((void*) &fCallbacks, 0, sizeof(fCallbacks));
-
-  fCallbacks.size = sizeof(fCallbacks);
-  fLibrary = nsnull;
+  memset((void*) &mPluginFuncs, 0, sizeof(mPluginFuncs));
+
+  mPluginFuncs.size = sizeof(mPluginFuncs);
+  mLibrary = nsnull;
   mIsDefaultPlugin = PR_FALSE;
 
 #if defined(XP_WIN) || defined(XP_OS2)
-  // On Windows (and Mac) we need to keep a direct reference to the
-  // fCallbacks and NOT just copy the struct. See Bugzilla 85334
+  // On Windows and OS/2 we need to keep a direct reference to
+  // the plugin's function struct, we can't just copy it. See
+  // Mozilla bug 85334.
 
   NPError gepError;
-  nsresult gepResult = aLibrary->NP_GetEntryPoints(&fCallbacks, &gepError);
+  nsresult gepResult = aLibrary->NP_GetEntryPoints(&mPluginFuncs, &gepError);
   if (gepResult != NS_OK || gepError != NPERR_NO_ERROR)
     return;
 
-  NS_ASSERTION(HIBYTE(fCallbacks.version) >= NP_VERSION_MAJOR,
+  NS_ASSERTION(HIBYTE(mPluginFuncs.version) >= NP_VERSION_MAJOR,
                "callback version is less than NP version");
 
 #elif defined(XP_MACOSX)
   NPPluginFuncs np_callbacks;
   memset((void*) &np_callbacks, 0, sizeof(np_callbacks));
   np_callbacks.size = sizeof(np_callbacks);
 
   if (!aLibrary->HasRequiredFunctions()) {
     NS_WARNING("Not all necessary functions exposed by plugin, it will not load.");
     return;
   }
 
   // we call NP_Initialize before getting function pointers to match
   // WebKit's behavior. They implemented this first on Mac OS X.
   NPError initError;
-  nsresult initResult = aLibrary->NP_Initialize(&(nsNPAPIPlugin::CALLBACKS), &initError);
+  nsresult initResult = aLibrary->NP_Initialize(&(sBrowserFuncs), &initError);
   if (initResult != NS_OK || initError != NPERR_NO_ERROR)
     return;
   NPError gepError;
   nsresult gepResult = aLibrary->NP_GetEntryPoints(&np_callbacks, &gepError);
   if (gepResult != NS_OK || gepError != NPERR_NO_ERROR)
     return;
 
-  fCallbacks.version = np_callbacks.version;
-  fCallbacks.newp = (NPP_NewProcPtr)np_callbacks.newp;
-  fCallbacks.destroy = (NPP_DestroyProcPtr)np_callbacks.destroy;
-  fCallbacks.setwindow = (NPP_SetWindowProcPtr)np_callbacks.setwindow;
-  fCallbacks.newstream = (NPP_NewStreamProcPtr)np_callbacks.newstream;
-  fCallbacks.destroystream = (NPP_DestroyStreamProcPtr)np_callbacks.destroystream;
-  fCallbacks.asfile = (NPP_StreamAsFileProcPtr)np_callbacks.asfile;
-  fCallbacks.writeready = (NPP_WriteReadyProcPtr)np_callbacks.writeready;
-  fCallbacks.write = (NPP_WriteProcPtr)np_callbacks.write;
-  fCallbacks.print = (NPP_PrintProcPtr)np_callbacks.print;
-  fCallbacks.event = (NPP_HandleEventProcPtr)np_callbacks.event;
-  fCallbacks.urlnotify = (NPP_URLNotifyProcPtr)np_callbacks.urlnotify;
-  fCallbacks.getvalue = (NPP_GetValueProcPtr)np_callbacks.getvalue;
-  fCallbacks.setvalue = (NPP_SetValueProcPtr)np_callbacks.setvalue;
+  mPluginFuncs.version = np_callbacks.version;
+  mPluginFuncs.newp = (NPP_NewProcPtr)np_callbacks.newp;
+  mPluginFuncs.destroy = (NPP_DestroyProcPtr)np_callbacks.destroy;
+  mPluginFuncs.setwindow = (NPP_SetWindowProcPtr)np_callbacks.setwindow;
+  mPluginFuncs.newstream = (NPP_NewStreamProcPtr)np_callbacks.newstream;
+  mPluginFuncs.destroystream = (NPP_DestroyStreamProcPtr)np_callbacks.destroystream;
+  mPluginFuncs.asfile = (NPP_StreamAsFileProcPtr)np_callbacks.asfile;
+  mPluginFuncs.writeready = (NPP_WriteReadyProcPtr)np_callbacks.writeready;
+  mPluginFuncs.write = (NPP_WriteProcPtr)np_callbacks.write;
+  mPluginFuncs.print = (NPP_PrintProcPtr)np_callbacks.print;
+  mPluginFuncs.event = (NPP_HandleEventProcPtr)np_callbacks.event;
+  mPluginFuncs.urlnotify = (NPP_URLNotifyProcPtr)np_callbacks.urlnotify;
+  mPluginFuncs.getvalue = (NPP_GetValueProcPtr)np_callbacks.getvalue;
+  mPluginFuncs.setvalue = (NPP_SetValueProcPtr)np_callbacks.setvalue;
 #else // for everyone else
-  memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
+  memcpy((void*) &mPluginFuncs, (void*) callbacks, sizeof(mPluginFuncs));
 #endif
 
-  fLibrary = aLibrary;
-  fLibrary->SetPlugin(this);
+  mLibrary = aLibrary;
+  mLibrary->SetPlugin(this);
 }
 
 nsNPAPIPlugin::~nsNPAPIPlugin()
 {
   // reset the callbacks list
-  memset((void*) &fCallbacks, 0, sizeof(fCallbacks));
-  delete fLibrary;
-  fLibrary = NULL;
+  memset((void*) &mPluginFuncs, 0, sizeof(mPluginFuncs));
+  delete mLibrary;
+  mLibrary = NULL;
 }
 
 
 #if defined(XP_MACOSX)
 void
 nsNPAPIPlugin::SetPluginRefNum(short aRefNum)
 {
-  fPluginRefNum = aRefNum;
+  mPluginRefNum = aRefNum;
 }
 #endif
 
 #ifdef MOZ_IPC
 void
 nsNPAPIPlugin::PluginCrashed()
 {
   nsRefPtr<nsPluginHost> host = dont_AddRef(nsPluginHost::GetInst());
@@ -415,24 +413,24 @@ nsNPAPIPlugin::CreatePlugin(const char* 
     return NS_OK;
 
   // we must init here because the plugin may call NPN functions
   // when we call into the NP_Initialize entry point - NPN functions
   // require that mBrowserManager be set up
   plptr->Initialize();
 
   NPError initError;
-  nsresult initResult = pluginLib->NP_Initialize(&(nsNPAPIPlugin::CALLBACKS),&callbacks, &initError);
+  nsresult initResult = pluginLib->NP_Initialize(&(sBrowserFuncs),&callbacks, &initError);
   if (initResult != NS_OK || initError != NPERR_NO_ERROR) {
     NS_RELEASE(*aResult);
     return NS_ERROR_UNEXPECTED;
   }
 
   // now copy function table back to nsNPAPIPlugin instance
-  memcpy((void*) &(plptr->fCallbacks), (void*)&callbacks, sizeof(callbacks));
+  memcpy((void*) &(plptr->mPluginFuncs), (void*)&callbacks, sizeof(callbacks));
 #endif
 
 #ifdef XP_WIN
   PluginLibrary* pluginLib = GetNewPluginLibrary(aFilePath, aLibrary);
 
   // Note: on Windows, we must use the fCallback because plugins may
   // change the function table. The Shockwave installer makes changes
   // in the table while running
@@ -447,17 +445,17 @@ nsNPAPIPlugin::CreatePlugin(const char* 
   // when we call into the NP_Initialize entry point - NPN functions
   // require that mBrowserManager be set up
   if (NS_FAILED((*aResult)->Initialize())) {
     NS_RELEASE(*aResult);
     return NS_ERROR_FAILURE;
   }
 
   NPError initError;
-  nsresult initResult = pluginLib->NP_Initialize(&(nsNPAPIPlugin::CALLBACKS), &initError);
+  nsresult initResult = pluginLib->NP_Initialize(&(sBrowserFuncs), &initError);
   if (initResult != NS_OK || initError != NPERR_NO_ERROR)
     return NS_ERROR_FAILURE;
 #endif
 
 #ifdef XP_OS2
   PluginLibrary* pluginLib = GetNewPluginLibrary(aFilePath, aLibrary);
 
   // create the new plugin handler
@@ -519,17 +517,17 @@ nsNPAPIPlugin::CreatePlugin(const char* 
   }
 
   if (stricmp(origPath, pluginPath) != 0) {
     rc = DosSetCurrentDir(pluginPath);
     NS_ASSERTION(NO_ERROR == rc,"DosSetCurrentDir failed");
     bChangedDir = TRUE;
   }
 
-  nsresult rv = pfnInitialize(&(nsNPAPIPlugin::CALLBACKS));
+  nsresult rv = pfnInitialize(&(sBrowserFuncs));
 
   if (bChangedDisk) {
     rc= DosSetDefaultDisk(origDiskNum);
     NS_ASSERTION(NO_ERROR == rc,"DosSetDefaultDisk failed");
   }
   if (bChangedDir) {
     rc = DosSetCurrentDir(origPath);
     NS_ASSERTION(NO_ERROR == rc,"DosSetCurrentDir failed");
@@ -539,24 +537,22 @@ nsNPAPIPlugin::CreatePlugin(const char* 
     return NS_ERROR_UNEXPECTED;
   }
 #endif
 
 #if defined(XP_MACOSX)
 #ifndef __LP64__
   short appRefNum = ::CurResFile();
   short pluginRefNum;
-#endif
 
   nsCOMPtr<nsILocalFile> pluginPath;
   NS_NewNativeLocalFile(nsDependentCString(aFilePath), PR_TRUE,
                         getter_AddRefs(pluginPath));
   nsPluginFile pluginFile(pluginPath);
 
-#ifndef __LP64__
   pluginRefNum = pluginFile.OpenPluginResource();
 #endif
 
   PluginLibrary* pluginLib = GetNewPluginLibrary(aFilePath, aLibrary);
   nsNPAPIPlugin* plugin = new nsNPAPIPlugin(nsnull, pluginLib);
 #ifndef __LP64__
   ::UseResFile(appRefNum);
 #endif
@@ -605,85 +601,85 @@ nsNPAPIPlugin::CreatePlugin(const char* 
   plptr->Initialize();
 
   NP_PLUGINUNIXINIT pfnInitialize =
     (NP_PLUGINUNIXINIT)PR_FindSymbol(aLibrary, "NP_Initialize");
 
   if (!pfnInitialize)
     return NS_ERROR_FAILURE;
 
-  if (pfnInitialize(&(nsNPAPIPlugin::CALLBACKS),&callbacks) != NS_OK)
+  if (pfnInitialize(&(sBrowserFuncs),&callbacks) != NS_OK)
     return NS_ERROR_FAILURE;
 
   // now copy function table back to nsNPAPIPlugin instance
-  memcpy((void*) &(plptr->fCallbacks), (void*)&callbacks, sizeof(callbacks));
+  memcpy((void*) &(plptr->mPluginFuncs), (void*)&callbacks, sizeof(callbacks));
 #endif
 
   return NS_OK;
 }
 
 NS_METHOD
 nsNPAPIPlugin::CreatePluginInstance(nsIPluginInstance **aResult)
 {
   if (!aResult)
     return NS_ERROR_NULL_POINTER;
 
   *aResult = NULL;
 
-  nsRefPtr<nsNPAPIPluginInstance> inst = new nsNPAPIPluginInstance(this, &fCallbacks, fLibrary);
+  nsRefPtr<nsNPAPIPluginInstance> inst = new nsNPAPIPluginInstance(this, &mPluginFuncs, mLibrary);
   if (!inst)
     return NS_ERROR_OUT_OF_MEMORY;
 
   NS_ADDREF(inst);
   *aResult = static_cast<nsIPluginInstance*>(inst);
   return NS_OK;
 }
 
 nsresult
-nsNPAPIPlugin::Initialize(void)
+nsNPAPIPlugin::Initialize()
 {
-  if (!fLibrary)
+  if (!mLibrary)
     return NS_ERROR_FAILURE;
   return NS_OK;
 }
 
 nsresult
-nsNPAPIPlugin::Shutdown(void)
+nsNPAPIPlugin::Shutdown()
 {
   NPP_PLUGIN_LOG(PLUGIN_LOG_BASIC,
                  ("NPP Shutdown to be called: this=%p\n", this));
 
   NPError shutdownError;
-  fLibrary->NP_Shutdown(&shutdownError);
+  mLibrary->NP_Shutdown(&shutdownError);
 #ifdef XP_MACOSX
-  if (shutdownError == NS_OK && fPluginRefNum > 0)
-    ::CloseResFile(fPluginRefNum);
+  if (shutdownError == NS_OK && mPluginRefNum > 0)
+    ::CloseResFile(mPluginRefNum);
 #endif
   return NS_OK;
 }
 
 nsresult
 nsNPAPIPlugin::GetMIMEDescription(const char* *resultingDesc)
 {
-  nsresult gmdResult = fLibrary->NP_GetMIMEDescription(resultingDesc);
+  nsresult gmdResult = mLibrary->NP_GetMIMEDescription(resultingDesc);
   if (gmdResult != NS_OK) {
     return gmdResult;
   }
 
   return NS_OK;
 }
 
 nsresult
 nsNPAPIPlugin::GetValue(NPPVariable variable, void *value)
 {
   PLUGIN_LOG(PLUGIN_LOG_NORMAL,
   ("nsNPAPIPlugin::GetValue called: this=%p, variable=%d\n", this, variable));
 
   NPError gvError;
-  fLibrary->NP_GetValue(nsnull, variable, value, &gvError);
+  mLibrary->NP_GetValue(nsnull, variable, value, &gvError);
 
   return gvError;
 }
 
 // Create a new NPP GET or POST (given in the type argument) url
 // stream that may have a notify callback
 NPError
 MakeNewNPAPIStreamInternal(NPP npp, const char *relativeURL, const char *target,
@@ -751,17 +747,17 @@ protected:
   nsIOutputStream *fStream;
   NPStream        fNPStream;
 
 public:
   nsNPAPIStreamWrapper(nsIOutputStream* stream);
   ~nsNPAPIStreamWrapper();
 
   void GetStream(nsIOutputStream* &result);
-  NPStream* GetNPStream(void) { return &fNPStream; }
+  NPStream* GetNPStream() { return &fNPStream; }
 };
 
 class nsPluginThreadRunnable : public nsRunnable,
                                public PRCList
 {
 public:
   nsPluginThreadRunnable(NPP instance, PluginThreadCallback func,
                          void *userData);
@@ -874,17 +870,17 @@ nsNPAPIStreamWrapper::nsNPAPIStreamWrapp
 
   fStream = stream;
   NS_ADDREF(fStream);
 
   memset(&fNPStream, 0, sizeof(fNPStream));
   fNPStream.ndata = (void*) this;
 }
 
-nsNPAPIStreamWrapper::~nsNPAPIStreamWrapper(void)
+nsNPAPIStreamWrapper::~nsNPAPIStreamWrapper()
 {
   fStream->Close();
   NS_IF_RELEASE(fStream);
 }
 
 void
 nsNPAPIStreamWrapper::GetStream(nsIOutputStream* &result)
 {
@@ -2394,17 +2390,17 @@ NPError NP_CALLBACK
   if (streamlistener->mStreamInfo)
     streamlistener->mStreamInfo->RequestRead((NPByteRange *)rangeList);
 
   return NS_OK;
 }
 
 // Deprecated, only stubbed out
 void* NP_CALLBACK /* OJI type: JRIEnv* */
-_getJavaEnv(void)
+_getJavaEnv()
 {
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetJavaEnv\n"));
   return NULL;
 }
 
 const char * NP_CALLBACK
 _useragent(NPP npp)
 {
--- a/modules/plugin/base/src/nsNPAPIPlugin.h
+++ b/modules/plugin/base/src/nsNPAPIPlugin.h
@@ -63,20 +63,17 @@
 #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (_System * _name)
 #else
 #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (* _name)
 #endif
 
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_GETENTRYPOINTS) (NPPluginFuncs* pCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGININIT) (const NPNetscapeFuncs* pCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINUNIXINIT) (const NPNetscapeFuncs* pCallbacks, NPPluginFuncs* fCallbacks);
-typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINSHUTDOWN) (void);
-#ifdef XP_MACOSX
-typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_MAIN) (NPNetscapeFuncs* nCallbacks, NPPluginFuncs* pCallbacks, NPP_ShutdownProcPtr* unloadProcPtr);
-#endif
+typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINSHUTDOWN) ();
 
 class nsNPAPIPlugin : public nsIPlugin
 {
 private:
   typedef mozilla::PluginLibrary PluginLibrary;
 
 public:
   nsNPAPIPlugin(NPPluginFuncs* callbacks,
@@ -99,31 +96,27 @@ public:
   // no longer usable.
   void PluginCrashed();
 #endif
 
   void SetIsDefaultPlugin();
   PRBool IsDefaultPlugin();
 
 protected:
-  // Ensures that the static CALLBACKS is properly initialized
-  static void CheckClassInitialized(void);
+  // Ensures that the static browser functions are properly initialized
+  static void CheckClassInitialized();
 
 #ifdef XP_MACOSX
-  short fPluginRefNum;
+  short mPluginRefNum;
 #endif
 
   // The plugin-side callbacks that the browser calls. One set of
   // plugin callbacks for each plugin.
-  NPPluginFuncs fCallbacks;
-  PluginLibrary* fLibrary;
-  PRLibrary* fPRLibrary;
-
-  // Browser-side callbacks that the plugin calls.
-  static NPNetscapeFuncs CALLBACKS;
+  NPPluginFuncs mPluginFuncs;
+  PluginLibrary* mLibrary;
 
   PRBool mIsDefaultPlugin;
 };
 
 namespace mozilla {
 namespace plugins {
 namespace parent {
 
@@ -300,17 +293,17 @@ void NP_CALLBACK
 const char* NP_CALLBACK
 _useragent(NPP npp);
 
 void* NP_CALLBACK
 _memalloc (uint32_t size);
 
 // Deprecated entry points for the old Java plugin.
 void* NP_CALLBACK /* OJI type: JRIEnv* */
-_getJavaEnv(void);
+_getJavaEnv();
 
 void* NP_CALLBACK /* OJI type: jref */
 _getJavaPeer(NPP npp);
 
 } /* namespace parent */
 } /* namespace plugins */
 } /* namespace mozilla */