From 3e79e9929c8cd23b8fe6d103165e2b1bb1c60a21 Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Thu, 25 Mar 2010 17:11:14 -0400 Subject: [PATCH] Back out patch for bug 554170 due to IPC bustage. --- modules/plugin/base/public/npfunctions.h | 4 +- modules/plugin/base/src/nsNPAPIPlugin.cpp | 119 +++++++++++----------- 2 files changed, 61 insertions(+), 62 deletions(-) diff --git a/modules/plugin/base/public/npfunctions.h b/modules/plugin/base/public/npfunctions.h index 869961ce697..9ccb4953330 100644 --- a/modules/plugin/base/public/npfunctions.h +++ b/modules/plugin/base/public/npfunctions.h @@ -108,8 +108,8 @@ typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentif typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant); typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message); -typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled); -typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp); +typedef bool (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled); +typedef bool (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp); typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count); typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData); typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); diff --git a/modules/plugin/base/src/nsNPAPIPlugin.cpp b/modules/plugin/base/src/nsNPAPIPlugin.cpp index 764aa885fd2..1d09335b738 100644 --- a/modules/plugin/base/src/nsNPAPIPlugin.cpp +++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp @@ -110,66 +110,7 @@ using mozilla::PluginPRLibrary; using mozilla::plugins::PluginModuleParent; #endif -using namespace mozilla::plugins::parent; - -// We should make this const... -static NPNetscapeFuncs sBrowserFuncs = { - sizeof(sBrowserFuncs), - (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR, - _geturl, - _posturl, - _requestread, - _newstream, - _write, - _destroystream, - _status, - _useragent, - _memalloc, - _memfree, - _memflush, - _reloadplugins, - _getJavaEnv, - _getJavaPeer, - _geturlnotify, - _posturlnotify, - _getvalue, - _setvalue, - _invalidaterect, - _invalidateregion, - _forceredraw, - _getstringidentifier, - _getstringidentifiers, - _getintidentifier, - _identifierisstring, - _utf8fromidentifier, - _intfromidentifier, - _createobject, - _retainobject, - _releaseobject, - _invoke, - _invokeDefault, - _evaluate, - _getproperty, - _setproperty, - _removeproperty, - _hasproperty, - _hasmethod, - _releasevariantvalue, - _setexception, - _pushpopupsenabledstate, - _poppopupsenabledstate, - _enumerate, - _pluginthreadasynccall, - _construct, - _getvalueforurl, - _setvalueforurl, - _getauthenticationinfo, - _scheduletimer, - _unscheduletimer, - _popupcontextmenu, - _convertpoint -}; - +static NPNetscapeFuncs sBrowserFuncs; static PRLock *sPluginThreadAsyncCallLock = nsnull; static PRCList sPendingAsyncCalls = PR_INIT_STATIC_CLIST(&sPendingAsyncCalls); @@ -181,6 +122,8 @@ enum eNPPStreamTypeInternal { static NS_DEFINE_IID(kMemoryCID, NS_MEMORY_CID); +using namespace mozilla::plugins::parent; + // This function sends a notification using the observer service to any object // registered to listen to the "experimental-notify-plugin-call" subject. // Each "experimental-notify-plugin-call" notification carries with it the run @@ -209,6 +152,62 @@ nsNPAPIPlugin::CheckClassInitialized() if (initialized) return; + // XXX It'd be nice to make this const and initialize it statically... + 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");