Commit 49f97660 authored by hausmann@webkit.org's avatar hausmann@webkit.org
Browse files

2008-11-05 Simon Hausmann <hausmann@webkit.org>

        Reviewed by Tor Arne Vestbø

        Unify determineQuirks between the Qt and the Gtk PluginPackage.
        Share the code for parsing the module version from the description.
        This is currently used to determine Flash based quirks.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38123 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 13008dd3
2008-11-05 Simon Hausmann <hausmann@webkit.org>
Reviewed by Tor Arne Vestbø
Unify determineQuirks between the Qt and the Gtk PluginPackage.
Share the code for parsing the module version from the description.
This is currently used to determine Flash based quirks.
* plugins/PluginPackage.cpp:
(WebCore::PluginPackage::createPackage):
(WebCore::PluginPackage::determineQuirks):
(WebCore::PluginPackage::determineModuleVersionFromDescription):
* plugins/PluginPackage.h:
* plugins/gtk/PluginPackageGtk.cpp:
(WebCore::PluginPackage::fetchInfo):
* plugins/qt/PluginPackageQt.cpp:
(WebCore::PluginPackage::fetchInfo):
2008-11-04 Cameron Zwarich <zwarich@apple.com> 2008-11-04 Cameron Zwarich <zwarich@apple.com>
   
Rubber-stamped by Sam Weinig. Rubber-stamped by Sam Weinig.
......
...@@ -148,8 +148,88 @@ PassRefPtr<PluginPackage> PluginPackage::createPackage(const String& path, const ...@@ -148,8 +148,88 @@ PassRefPtr<PluginPackage> PluginPackage::createPackage(const String& path, const
if (!package->fetchInfo()) if (!package->fetchInfo())
return 0; return 0;
return package.release(); return package.release();
} }
#if defined(XP_UNIX)
void PluginPackage::determineQuirks(const String& mimeType)
{
if (MIMETypeRegistry::isJavaAppletMIMEType(mimeType)) {
// Because a single process cannot create multiple VMs, and we cannot reliably unload a
// Java VM, we cannot unload the Java plugin, or we'll lose reference to our only VM
m_quirks.add(PluginQuirkDontUnloadPlugin);
// Setting the window region to an empty region causes bad scrolling repaint problems
// with the Java plug-in.
m_quirks.add(PluginQuirkDontClipToZeroRectWhenScrolling);
return;
}
if (mimeType == "application/x-shockwave-flash") {
static const PlatformModuleVersion flashTenVersion(0x0a000000);
if (compareFileVersion(flashTenVersion) >= 0) {
// Flash 10.0 b218 doesn't like having a NULL window handle
m_quirks.add(PluginQuirkDontSetNullWindowHandleOnDestroy);
} else {
// Flash 9 and older requests windowless plugins if we return a mozilla user agent
m_quirks.add(PluginQuirkWantsMozillaUserAgent);
}
m_quirks.add(PluginQuirkThrottleInvalidate);
m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages);
m_quirks.add(PluginQuirkFlashURLNotifyBug);
}
}
#endif
void PluginPackage::determineModuleVersionFromDescription()
{
// It's a bit lame to detect the plugin version by parsing it
// from the plugin description string, but it doesn't seem that
// version information is available in any standardized way at
// the module level, like in Windows
if (m_description.isEmpty())
return;
if (m_description.startsWith("Shockwave Flash") && m_description.length() >= 19) {
// The flash version as a PlatformModuleVersion differs on Unix from Windows
// since the revision can be larger than a 8 bits, so we allow it 16 here and
// push the major/minor up 8 bits. Thus on Unix, Flash's version may be
// 0x0a000000 instead of 0x000a0000.
Vector<String> versionParts;
m_description.substring(16).split(' ', /*allowEmptyEntries =*/ false, versionParts);
if (versionParts.isEmpty())
return;
if (versionParts.size() >= 1) {
Vector<String> majorMinorParts;
versionParts[0].split('.', majorMinorParts);
if (majorMinorParts.size() >= 1) {
bool converted = false;
unsigned major = majorMinorParts[0].toUInt(&converted);
if (converted)
m_moduleVersion = (major & 0xff) << 24;
}
if (majorMinorParts.size() == 2) {
bool converted = false;
unsigned minor = majorMinorParts[1].toUInt(&converted);
if (converted)
m_moduleVersion |= (minor & 0xff) << 16;
}
}
if (versionParts.size() >= 2) {
String revision = versionParts[1];
if (revision.length() > 1 && (revision[0] == 'r' || revision[0] == 'b')) {
revision.remove(0, 1);
m_moduleVersion |= revision.toInt() & 0xffff;
}
}
}
}
} }
...@@ -74,6 +74,8 @@ namespace WebCore { ...@@ -74,6 +74,8 @@ namespace WebCore {
bool isPluginBlacklisted(); bool isPluginBlacklisted();
void determineQuirks(const String& mimeType); void determineQuirks(const String& mimeType);
void determineModuleVersionFromDescription();
bool m_isLoaded; bool m_isLoaded;
int m_loadCount; int m_loadCount;
......
...@@ -80,36 +80,6 @@ static PlatformModuleVersion getModuleVersion(const char *description) ...@@ -80,36 +80,6 @@ static PlatformModuleVersion getModuleVersion(const char *description)
return version; return version;
} }
void PluginPackage::determineQuirks(const String& mimeType)
{
if (MIMETypeRegistry::isJavaAppletMIMEType(mimeType)) {
// Because a single process cannot create multiple VMs, and we cannot reliably unload a
// Java VM, we cannot unload the Java plugin, or we'll lose reference to our only VM
m_quirks.add(PluginQuirkDontUnloadPlugin);
// Setting the window region to an empty region causes bad scrolling repaint problems
// with the Java plug-in.
m_quirks.add(PluginQuirkDontClipToZeroRectWhenScrolling);
return;
}
if (mimeType == "application/x-shockwave-flash") {
static const PlatformModuleVersion flashTenVersion(0x0a000000);
if (compareFileVersion(flashTenVersion) >= 0) {
// Flash 10.0 b218 doesn't like having a NULL window handle
m_quirks.add(PluginQuirkDontSetNullWindowHandleOnDestroy);
} else {
// Flash 9 and older requests windowless plugins if we return a mozilla user agent
m_quirks.add(PluginQuirkWantsMozillaUserAgent);
}
m_quirks.add(PluginQuirkThrottleInvalidate);
m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages);
m_quirks.add(PluginQuirkFlashURLNotifyBug);
}
}
bool PluginPackage::fetchInfo() bool PluginPackage::fetchInfo()
{ {
#if defined(XP_UNIX) #if defined(XP_UNIX)
...@@ -131,7 +101,7 @@ bool PluginPackage::fetchInfo() ...@@ -131,7 +101,7 @@ bool PluginPackage::fetchInfo()
err = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer); err = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer);
if (err == NPERR_NO_ERROR) { if (err == NPERR_NO_ERROR) {
m_description = buffer; m_description = buffer;
m_moduleVersion = getModuleVersion(buffer); determineModuleVersionFromDescription();
} }
const gchar* types = NP_GetMIMEDescription(); const gchar* types = NP_GetMIMEDescription();
......
...@@ -36,28 +36,6 @@ ...@@ -36,28 +36,6 @@
namespace WebCore { namespace WebCore {
void PluginPackage::determineQuirks(const String& mimeType)
{
if (MIMETypeRegistry::isJavaAppletMIMEType(mimeType)) {
// Because a single process cannot create multiple VMs, and we cannot reliably unload a
// Java VM, we cannot unload the Java plugin, or we'll lose reference to our only VM
m_quirks.add(PluginQuirkDontUnloadPlugin);
// Setting the window region to an empty region causes bad scrolling repaint problems
// with the Java plug-in.
m_quirks.add(PluginQuirkDontClipToZeroRectWhenScrolling);
}
if (mimeType == "application/x-shockwave-flash") {
// The flash plugin only requests windowless plugins if we return a mozilla user agent
m_quirks.add(PluginQuirkWantsMozillaUserAgent);
m_quirks.add(PluginQuirkThrottleInvalidate);
m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages);
m_quirks.add(PluginQuirkFlashURLNotifyBug);
}
}
bool PluginPackage::fetchInfo() bool PluginPackage::fetchInfo()
{ {
if (!load()) if (!load())
...@@ -81,6 +59,7 @@ bool PluginPackage::fetchInfo() ...@@ -81,6 +59,7 @@ bool PluginPackage::fetchInfo()
return false; return false;
} }
m_description = buf; m_description = buf;
determineModuleVersionFromDescription();
String s = gm(); String s = gm();
Vector<String> types; Vector<String> types;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment