Title: [89256] trunk/Source/WebKit2
- Revision
- 89256
- Author
- carlo...@webkit.org
- Date
- 2011-06-20 10:49:13 -0700 (Mon, 20 Jun 2011)
Log Message
2011-06-20 Carlos Garcia Campos <cgar...@igalia.com>
Reviewed by Martin Robinson.
[UNIX] Don't use WebCore::PluginPackage to get plugin information
https://bugs.webkit.org/show_bug.cgi?id=62899
The problem is that both PluginPackage in WebCore and
NetscapePluginModule in webkit2 install their own netscape browser
functions and that can cause conflicts in some situations.
* Shared/Plugins/Netscape/NetscapePluginModule.h: Add helper
function to set plugin mime type descriptions.
* Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
(WebKit::NetscapePluginModule::setMIMEDescription): Helper
function to set plugin mime type descriptions.
(WebKit::NetscapePluginModule::getPluginInfo): Use
NetscapePluginModule instead of PluginPackage.
* UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp: Remove unneeded
header include.
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_GetValue): Do not try to get the XDisplay if the
plugin doesn't have a view. It fixes a crash with flash plugin and
matches WebCore.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (89255 => 89256)
--- trunk/Source/WebKit2/ChangeLog 2011-06-20 17:35:31 UTC (rev 89255)
+++ trunk/Source/WebKit2/ChangeLog 2011-06-20 17:49:13 UTC (rev 89256)
@@ -1,5 +1,30 @@
2011-06-20 Carlos Garcia Campos <cgar...@igalia.com>
+ Reviewed by Martin Robinson.
+
+ [UNIX] Don't use WebCore::PluginPackage to get plugin information
+ https://bugs.webkit.org/show_bug.cgi?id=62899
+
+ The problem is that both PluginPackage in WebCore and
+ NetscapePluginModule in webkit2 install their own netscape browser
+ functions and that can cause conflicts in some situations.
+
+ * Shared/Plugins/Netscape/NetscapePluginModule.h: Add helper
+ function to set plugin mime type descriptions.
+ * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
+ (WebKit::NetscapePluginModule::setMIMEDescription): Helper
+ function to set plugin mime type descriptions.
+ (WebKit::NetscapePluginModule::getPluginInfo): Use
+ NetscapePluginModule instead of PluginPackage.
+ * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp: Remove unneeded
+ header include.
+ * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+ (WebKit::NPN_GetValue): Do not try to get the XDisplay if the
+ plugin doesn't have a view. It fixes a crash with flash plugin and
+ matches WebCore.
+
+2011-06-20 Carlos Garcia Campos <cgar...@igalia.com>
+
Reviewed by Xan Lopez.
[GTK] Split libWebCore into two libWebCore and libWebCoreGtk
Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h (89255 => 89256)
--- trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h 2011-06-20 17:35:31 UTC (rev 89255)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h 2011-06-20 17:49:13 UTC (rev 89256)
@@ -68,6 +68,7 @@
#if PLUGIN_ARCHITECTURE(X11)
void applyX11QuirksBeforeLoad();
+ static void setMIMEDescription(const String& mimeDescription, PluginModuleInfo&);
#endif
bool tryGetSitesWithData(Vector<String>&);
Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp (89255 => 89256)
--- trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp 2011-06-20 17:35:31 UTC (rev 89255)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp 2011-06-20 17:49:13 UTC (rev 89256)
@@ -28,8 +28,8 @@
#include "NetscapePluginModule.h"
-#include "PluginDatabase.h"
-#include "PluginPackage.h"
+#include "NetscapeBrowserFuncs.h"
+#include <WebCore/FileSystem.h>
#if PLATFORM(QT)
#include <QLibrary>
@@ -93,6 +93,31 @@
#endif
}
+void NetscapePluginModule::setMIMEDescription(const String& mimeDescription, PluginModuleInfo& plugin)
+{
+ Vector<String> types;
+ mimeDescription.lower().split(UChar(';'), false, types);
+ plugin.info.mimes.reserveCapacity(types.size());
+
+ size_t mimeInfoCount = 0;
+ for (size_t i = 0; i < types.size(); ++i) {
+ Vector<String> mimeTypeParts;
+ types[i].split(UChar(':'), true, mimeTypeParts);
+ if (mimeTypeParts.size() <= 0)
+ continue;
+
+ plugin.info.mimes.uncheckedAppend(MimeClassInfo());
+ MimeClassInfo& mimeInfo = plugin.info.mimes[mimeInfoCount++];
+ mimeInfo.type = mimeTypeParts[0];
+
+ if (mimeTypeParts.size() > 1)
+ mimeTypeParts[1].split(UChar(','), false, mimeInfo.extensions);
+
+ if (mimeTypeParts.size() > 2)
+ mimeInfo.desc = mimeTypeParts[2];
+ }
+}
+
bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
{
// Tempararily suppress stdout in this function as plugins will be loaded and shutdown and debug info
@@ -101,31 +126,33 @@
// We are loading the plugin here since it does not seem to be a standardized way to
// get the needed informations from a UNIX plugin without loading it.
-
- RefPtr<PluginPackage> package = PluginPackage::createPackage(pluginPath, 0 /*lastModified*/);
- if (!package)
+ RefPtr<NetscapePluginModule> pluginModule = NetscapePluginModule::getOrCreate(pluginPath);
+ if (!pluginModule)
return false;
plugin.path = pluginPath;
- plugin.info.desc = package->description();
- plugin.info.file = package->fileName();
+ plugin.info.file = pathGetFileName(pluginPath);
- const MIMEToDescriptionsMap& descriptions = package->mimeToDescriptions();
- const MIMEToExtensionsMap& extensions = package->mimeToExtensions();
- MIMEToDescriptionsMap::const_iterator descEnd = descriptions.end();
- plugin.info.mimes.reserveCapacity(descriptions.size());
- unsigned i = 0;
- for (MIMEToDescriptionsMap::const_iterator it = descriptions.begin(); it != descEnd; ++it) {
- plugin.info.mimes.uncheckedAppend(MimeClassInfo());
- MimeClassInfo& mime = plugin.info.mimes[i++];
- mime.type = it->first;
- mime.desc = it->second;
- MIMEToExtensionsMap::const_iterator extensionIt = extensions.find(it->first);
- ASSERT(extensionIt != extensions.end());
- mime.extensions = extensionIt->second;
- }
+ Module* module = pluginModule->module();
+ NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue");
+ if (!NPP_GetValue)
+ return false;
- package->unload();
+ NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = module->functionPointer<NP_GetMIMEDescriptionFuncPtr>("NP_GetMIMEDescription");
+ if (!NP_GetMIMEDescription)
+ return false;
+
+ char* buffer = 0;
+ NPError err = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer);
+ if (err == NPERR_NO_ERROR)
+ plugin.info.desc = buffer;
+
+ const char* mimeDescription = NP_GetMIMEDescription();
+ if (!mimeDescription)
+ return false;
+
+ setMIMEDescription(mimeDescription, plugin);
+
return true;
}
Modified: trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp (89255 => 89256)
--- trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp 2011-06-20 17:35:31 UTC (rev 89255)
+++ trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp 2011-06-20 17:49:13 UTC (rev 89256)
@@ -30,7 +30,6 @@
#include "NetscapePluginModule.h"
#include "PluginDatabase.h"
-#include "PluginPackage.h"
using namespace WebCore;
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp (89255 => 89256)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp 2011-06-20 17:35:31 UTC (rev 89255)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp 2011-06-20 17:49:13 UTC (rev 89256)
@@ -503,7 +503,10 @@
*(NPBool*)value = true;
break;
#elif PLUGIN_ARCHITECTURE(X11)
- case NPNVxDisplay:
+ case NPNVxDisplay: {
+ RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
+ if (!plugin)
+ return NPERR_GENERIC_ERROR;
#if PLATFORM(QT)
*reinterpret_cast<Display**>(value) = QX11Info::display();
break;
@@ -513,6 +516,7 @@
#else
goto default;
#endif
+ }
case NPNVSupportsXEmbedBool:
*static_cast<NPBool*>(value) = true;
break;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes