Index: nsPluginHostImpl.cpp =================================================================== RCS file: /cvsroot/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp,v retrieving revision 1.479 diff -w -u --unified=20 -r1.479 nsPluginHostImpl.cpp --- nsPluginHostImpl.cpp 13 Jun 2003 20:09:47 -0000 1.479 +++ nsPluginHostImpl.cpp 18 Jul 2003 18:58:01 -0000 @@ -142,41 +142,41 @@ #include "nsInt64.h" #include "nsPluginError.h" #include "nsUnicharUtils.h" #include "nsPluginManifestLineReader.h" #include "imgILoader.h" #include "nsDefaultPlugin.h" #include "nsWeakReference.h" #include "nsIDOMElement.h" #include "nsIStyleSet.h" #include "nsIStyleFrameConstruction.h" #include "nsIPresShell.h" #include "nsIPresContext.h" #include "nsIWebNavigation.h" #include "nsISupportsArray.h" #include "nsIDocShell.h" #include "nsPluginNativeWindow.h" #include "nsIScriptSecurityManager.h" -#if defined(XP_MAC) && TARGET_CARBON +#if (defined(XP_MAC) && TARGET_CARBON) || defined(XP_OS2_EMX) #include "nsIClassicPluginFactory.h" #endif #ifdef XP_UNIX #if defined(MOZ_WIDGET_GTK) || defined (MOZ_WIDGET_GTK2) #include // for GDK_DISPLAY() #elif defined(MOZ_WIDGET_XLIB) #include "xlibrgb.h" // for xlib_rgb_get_display() #endif #endif #if defined(XP_MAC) || defined (XP_MACOSX) #if TARGET_CARBON #include // for ::UseInputWindow() #endif #endif // this is the name of the directory which will be created // to cache temporary files. #define kPluginTmpDirName NS_LITERAL_CSTRING("plugtmp") @@ -4541,53 +4541,83 @@ { rv = nsComponentManager::GetClassObject(clsid, nsIPlugin::GetIID(), (void**)&plugin); if (NS_SUCCEEDED(rv) && plugin) { // plugin was addref'd by nsComponentManager::GetClassObject pluginTag->mEntryPoint = plugin; plugin->Initialize(); } } } if (plugin == NULL) { // No, this is not a leak. GetGlobalServiceManager() doesn't // addref the pointer on the way out. It probably should. nsIServiceManagerObsolete* serviceManager; nsServiceManager::GetGlobalServiceManager((nsIServiceManager**)&serviceManager); // need to get the plugin factory from this plugin. nsFactoryProc nsGetFactory = nsnull; +#ifdef XP_OS2 /* Sorry about this */ + nsGetFactory = (nsFactoryProc) PR_FindSymbol(pluginTag->mLibrary, "_NSGetFactory"); +#else nsGetFactory = (nsFactoryProc) PR_FindSymbol(pluginTag->mLibrary, "NSGetFactory"); +#endif if(nsGetFactory != nsnull && IsCompatibleExecutable(pluginTag->mFullPath)) { // XPCOM-style plugins (or at least the OJI one) cause crashes on // on windows GCC builds, so we're just turning them off for now. #if !defined(XP_WIN) || !defined(__GNUC__) rv = nsGetFactory(serviceManager, kPluginCID, nsnull, nsnull, // XXX fix ClassName/ContractID (nsIFactory**)&pluginTag->mEntryPoint); plugin = pluginTag->mEntryPoint; if (plugin != NULL) plugin->Initialize(); #endif } +#ifdef XP_OS2_EMX + // on OS2, first check if this might be legacy XPCOM module. + else if ( PR_FindSymbol(pluginTag->mLibrary, "NSGetFactory") + && IsCompatibleExecutable(pluginTag->mFullPath)) + { + // Possibly a legacy XPCOM module. We'll need to create a calling + // vtable/calling convention wrapper for it. + // + // The idea is to create a separate service for this. Since a similar + // construct already exist for MAC/CARBON we don't need to invent a + // new interface for it. (please disagree if this isn't clean) + nsCOMPtr factory = + do_GetService(NS_CLASSIC_PLUGIN_FACTORY_CONTRACTID, &rv); + if (NS_SUCCEEDED(rv)) + { + rv = factory->CreatePlugin(serviceManager, + pluginTag->mFileName, + pluginTag->mFullPath, + pluginTag->mLibrary, + &pluginTag->mEntryPoint); + plugin = pluginTag->mEntryPoint; + if (plugin != NULL) + plugin->Initialize(); + } + } +#endif else { // Now lets try to get the entry point from a 4.x plugin rv = NS_ERROR_FAILURE; #if defined(XP_MAC) && TARGET_CARBON // on Carbon, first let's see if this is a Classic plugin // should we also look for a 'carb' resource? if (PR_FindSymbol(pluginTag->mLibrary, "mainRD") != NULL) { nsCOMPtr factory = do_GetService(NS_CLASSIC_PLUGIN_FACTORY_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) rv = factory->CreatePlugin(serviceManager, pluginTag->mFileName, pluginTag->mFullPath, pluginTag->mLibrary, &pluginTag->mEntryPoint); if (!pluginTag->mEntryPoint) // plugin wasn't found rv = NS_ERROR_FAILURE; // setup failure to try normal loading next }