diff --git a/mozilla/modules/plugin/samples/4x-scriptable/np_entry.cpp b/mozilla/modules/plugin/samples/4x-scriptable/np_entry.cpp index 97200664950..06c3fffeca0 100644 --- a/mozilla/modules/plugin/samples/4x-scriptable/np_entry.cpp +++ b/mozilla/modules/plugin/samples/4x-scriptable/np_entry.cpp @@ -29,6 +29,8 @@ NPNetscapeFuncs NPNFuncs; +#ifdef XP_WIN + NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs) { if(pFuncs == NULL) @@ -56,6 +58,8 @@ NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs) return NPERR_NO_ERROR; } +#endif /* XP_WIN */ + NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs) { if(pFuncs == NULL) diff --git a/mozilla/modules/plugin/samples/4x-scriptable/npp_gate.cpp b/mozilla/modules/plugin/samples/4x-scriptable/npp_gate.cpp index 107974758da..d48cb8c66dc 100644 --- a/mozilla/modules/plugin/samples/4x-scriptable/npp_gate.cpp +++ b/mozilla/modules/plugin/samples/4x-scriptable/npp_gate.cpp @@ -27,6 +27,15 @@ // #include "plugin.h" +NPError NPP_Initialize(void) +{ + return NPERR_NO_ERROR; +} + +void NPP_Shutdown(void) +{ +} + // here the plugin creates an instance of our CPlugin object which // will be associated with this newly created plugin instance and // will do all the neccessary job @@ -132,17 +141,24 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) if(pPlugin == NULL) return NPERR_GENERIC_ERROR; - static nsIID scriptableIID = NS_I4XSCRIPTABLEPLUGIN_IID; - if (variable == NPPVpluginScriptableInstance) { // addref happens in getter, so we don't addref here nsI4xScriptablePlugin * scriptablePeer = pPlugin->getScriptablePeer(); - *(nsISupports **)value = scriptablePeer; + if (scriptablePeer) { + *(nsISupports **)value = scriptablePeer; + } else { + rv = NPERR_OUT_OF_MEMORY_ERROR; + } } else if (variable == NPPVpluginScriptableIID) { + static nsIID scriptableIID = NS_I4XSCRIPTABLEPLUGIN_IID; nsIID* ptr = (nsIID *)NPN_MemAlloc(sizeof(nsIID)); - *ptr = scriptableIID; - *(nsIID **)value = ptr; + if (ptr) { + *ptr = scriptableIID; + *(nsIID **)value = ptr; + } else { + rv = NPERR_OUT_OF_MEMORY_ERROR; + } } return rv; diff --git a/mozilla/modules/plugin/samples/4x-scriptable/plugin.cpp b/mozilla/modules/plugin/samples/4x-scriptable/plugin.cpp index ca4f5daa1e8..bcf1aadc2ac 100644 --- a/mozilla/modules/plugin/samples/4x-scriptable/plugin.cpp +++ b/mozilla/modules/plugin/samples/4x-scriptable/plugin.cpp @@ -54,7 +54,7 @@ static LRESULT CALLBACK PluginWinProc(HWND, UINT, WPARAM, LPARAM); static WNDPROC lpOldProc = NULL; #endif -BOOL CPlugin::init(NPWindow* pNPWindow) +NPBool CPlugin::init(NPWindow* pNPWindow) { if(pNPWindow == NULL) return FALSE; @@ -88,7 +88,7 @@ void CPlugin::shut() m_bInitialized = FALSE; } -BOOL CPlugin::isInitialized() +NPBool CPlugin::isInitialized() { return m_bInitialized; } diff --git a/mozilla/modules/plugin/samples/4x-scriptable/plugin.h b/mozilla/modules/plugin/samples/4x-scriptable/plugin.h index 4e49ec0dcd1..1324bccdda5 100644 --- a/mozilla/modules/plugin/samples/4x-scriptable/plugin.h +++ b/mozilla/modules/plugin/samples/4x-scriptable/plugin.h @@ -36,7 +36,7 @@ private: #endif NPStream * m_pNPStream; - BOOL m_bInitialized; + NPBool m_bInitialized; nsI4xScriptablePlugin * m_pScriptablePeer; public: @@ -46,9 +46,9 @@ public: CPlugin(NPP pNPInstance); ~CPlugin(); - BOOL init(NPWindow* pNPWindow); + NPBool init(NPWindow* pNPWindow); void shut(); - BOOL isInitialized(); + NPBool isInitialized(); void showVersion(); void clear();