- diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
- index 9fb1e54..ed6f3ca 100644
- --- a/WebCore/ChangeLog
- +++ b/WebCore/ChangeLog
- @@ -1,3 +1,26 @@
- +2010-09-23 Balazs Kelemen <kbalazs@webkit.org>
- +
- + Reviewed by NOBODY (OOPS!).
- +
- + [Qt] [WebKit2] Workarounds for the flash plugin
- + https://bugs.webkit.org/show_bug.cgi?id=46262
- + No new functionality so no new tests.
- +
- + Factoring the logic in PluginPackageQt.cpp
- + that deals with workarounding problems with the flash
- + plugin into a new class with static methods.
- + * WebCore.pro:
- + * plugins/qt/FlashPluginWorkarounds.cpp: Added.
- + (WebCore::FlashPluginWorkarounds::isFlashPlugin):
- + (WebCore::FlashPluginWorkarounds::isFlashPluginNPWrapper):
- + (WebCore::FlashPluginWorkarounds::initializeGTK):
- + * plugins/qt/FlashPluginWorkarounds.h: Added.
- + * plugins/qt/PluginPackageQt.cpp: Removed the static function we used to
- + override NPN_GetValue for the npwrapper. That was redundant since we can
- + achieve the same effect by setting the appropriate quirk.
- + (WebCore::PluginPackage::load): Set the PluginQuirkRequiresGtkToolKit
- + quirk if we are dealing with the npwrapper.
- +
- 2010-10-19 Philippe Normand <pnormand@igalia.com>
- Reviewed by Xan Lopez.
- diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
- index a964d89..3940997 100644
- --- a/WebCore/WebCore.pro
- +++ b/WebCore/WebCore.pro
- @@ -2764,10 +2764,12 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) {
- DEFINES += MOZ_PLATFORM_MAEMO=6
- }
- SOURCES += \
- + plugins/qt/PluginQuirks.cpp \
- plugins/qt/PluginContainerQt.cpp \
- plugins/qt/PluginPackageQt.cpp \
- plugins/qt/PluginViewQt.cpp
- HEADERS += \
- + plugins/qt/PluginQuirks.h \
- plugins/qt/PluginContainerQt.h
- DEFINES += XP_UNIX
- DEFINES += ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE=1
- diff --git a/WebCore/plugins/qt/PluginPackageQt.cpp b/WebCore/plugins/qt/PluginPackageQt.cpp
- index e7058c7..4f82c43 100644
- --- a/WebCore/plugins/qt/PluginPackageQt.cpp
- +++ b/WebCore/plugins/qt/PluginPackageQt.cpp
- @@ -1,6 +1,7 @@
- /*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Collabora Ltd. All rights reserved.
- + * Copyright (C) 2010 University of Szeged. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- @@ -31,6 +32,7 @@
- #include "npruntime_impl.h"
- #include "PluginDatabase.h"
- #include "PluginDebug.h"
- +#include "PluginQuirks.h"
- #include <wtf/text/CString.h>
- namespace WebCore {
- @@ -88,49 +90,6 @@ void PluginPackage::setMIMEDescription(const String& mimeDescription)
- }
- }
- -static NPError staticPluginQuirkRequiresGtkToolKit_NPN_GetValue(NPP instance, NPNVariable variable, void* value)
- -{
- - if (variable == NPNVToolkit) {
- - *static_cast<uint32_t*>(value) = 2;
- - return NPERR_NO_ERROR;
- - }
- -
- - return NPN_GetValue(instance, variable, value);
- -}
- -
- -static void initializeGtk(QLibrary* module = 0)
- -{
- - // Ensures missing Gtk initialization in some versions of Adobe's flash player
- - // plugin do not cause crashes. See BR# 40567, 44324, and 44405 for details.
- - if (module) {
- - typedef void *(*gtk_init_ptr)(int*, char***);
- - gtk_init_ptr gtkInit = (gtk_init_ptr)module->resolve("gtk_init");
- - if (gtkInit) {
- - // Prevent gtk_init() from replacing the X error handlers, since the Gtk
- - // handlers abort when they receive an X error, thus killing the viewer.
- -#ifdef Q_WS_X11
- - int (*old_error_handler)(Display*, XErrorEvent*) = XSetErrorHandler(0);
- - int (*old_io_error_handler)(Display*) = XSetIOErrorHandler(0);
- -#endif
- - gtkInit(0, 0);
- -#ifdef Q_WS_X11
- - XSetErrorHandler(old_error_handler);
- - XSetIOErrorHandler(old_io_error_handler);
- -#endif
- - return;
- - }
- - }
- -
- - QLibrary library("libgtk-x11-2.0.so.0");
- - if (library.load()) {
- - typedef void *(*gtk_init_check_ptr)(int*, char***);
- - gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
- - // NOTE: We're using gtk_init_check() since gtk_init() calls exit() on failure.
- - if (gtkInitCheck)
- - (void) gtkInitCheck(0, 0);
- - }
- -}
- -
- bool PluginPackage::load()
- {
- if (m_isLoaded) {
- @@ -162,17 +121,17 @@ bool PluginPackage::load()
- initializeBrowserFuncs();
- - if (m_path.contains("npwrapper.")) {
- + if (FlashPluginWorkarounds::isFlashPluginNPWrapper(m_path)) {
- // nspluginwrapper relies on the toolkit value to know if glib is available
- // It does so in NP_Initialize with a null instance, therefore it is done this way:
- - m_browserFuncs.getvalue = staticPluginQuirkRequiresGtkToolKit_NPN_GetValue;
- + m_quirks.add(PluginQuirkRequiresGtkToolKit);
- // Workaround Adobe's failure to properly initialize Gtk in some versions
- // of their flash player plugin.
- - initializeGtk();
- - } else if (m_path.contains("flashplayer")) {
- + FlashPluginWorkarounds::initializeGTK();
- + } else if (FlashPluginWorkarounds::isFlashPlugin(m_path)) {
- // Workaround Adobe's failure to properly initialize Gtk in some versions
- // of their flash player plugin.
- - initializeGtk(m_module);
- + FlashPluginWorkarounds::initializeGTK(m_module);
- }
- #if defined(XP_UNIX)
- diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
- index b83dc19..8b169ff 100644
- --- a/WebKit2/ChangeLog
- +++ b/WebKit2/ChangeLog
- @@ -1,3 +1,28 @@
- +2010-09-23 Balazs Kelemen <kbalazs@webkit.org>
- +
- + Reviewed by NOBODY (OOPS!).
- +
- + [Qt] [WebKit2] Workarounds for the flash plugin
- + https://bugs.webkit.org/show_bug.cgi?id=46262
- +
- + Apply the same workarounds for the flash plugin
- + that we use in WebCore.
- + * Platform/qt/ModuleQt.cpp:
- + (WebKit::Module::load): Use the ResolveAllSymbolsHint
- + hint when we loading the library as we do in WebCore.
- + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
- + (WebKit::NPN_GetValue): Applying the workaround we use in WebCore
- + for the flash plugin npwrapper.
- + * WebProcess/Plugins/Netscape/NetscapePlugin.h:
- + (WebKit::NetscapePlugin::quirks): Added a PluginQuirkSet
- + member for Qt and a getter.
- + * WebProcess/Plugins/Netscape/NetscapePluginModule.h:
- + (WebKit::NetscapePluginModule::path): Added getter for the path.
- + We need it in NetscapePlugin::platformPostInitialize.
- + * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp:
- + (WebKit::NetscapePlugin::platformPostInitialize): Applying the
- + workarounds we use in WebCore for the flash plugin and the npwrapper.
- +
- 2010-10-18 Anders Carlsson <andersca@apple.com>
- Reviewed by Sam Weinig.
- diff --git a/WebKit2/Platform/qt/ModuleQt.cpp b/WebKit2/Platform/qt/ModuleQt.cpp
- index 8a68cf4..b195f72 100644
- --- a/WebKit2/Platform/qt/ModuleQt.cpp
- +++ b/WebKit2/Platform/qt/ModuleQt.cpp
- @@ -26,11 +26,14 @@
- #include "Module.h"
- +#include <cstdio>
- +
- namespace WebKit {
- bool Module::load()
- {
- m_lib.setFileName(static_cast<QString>(m_path));
- + m_lib.setLoadHints(QLibrary::ResolveAllSymbolsHint);
- return m_lib.load();
- }
- diff --git a/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp b/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp
- index 3e50da0..e71a9dd 100644
- --- a/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp
- +++ b/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp
- @@ -72,18 +72,20 @@ bool PluginInfoStore::getPluginInfo(const String& pluginPath, Plugin& plugin)
- const MIMEToDescriptionsMap& descriptions = package->mimeToDescriptions();
- const MIMEToExtensionsMap& extensions = package->mimeToExtensions();
- - Vector<MimeClassInfo> mimes(descriptions.size());
- MIMEToDescriptionsMap::const_iterator descEnd = descriptions.end();
- - unsigned i = 0;
- + plugin.info.mimes.reserveCapacity(descriptions.size());
- for (MIMEToDescriptionsMap::const_iterator it = descriptions.begin(); it != descEnd; ++it) {
- - MimeClassInfo& mime = mimes[i++];
- + MimeClassInfo mime;
- mime.type = it->first;
- mime.desc = it->second;
- MIMEToExtensionsMap::const_iterator extensionIt = extensions.find(it->first);
- ASSERT(extensionIt != extensions.end());
- mime.extensions = extensionIt->second;
- + plugin.info.mimes.uncheckedAppend(mime);
- }
- + printf("found plugin: %s\n", qPrintable(static_cast<QString>(pluginPath)));
- +
- package->unload();
- return true;
- }
- diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
- index c5c705b..df76767 100644
- --- a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
- +++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
- @@ -455,6 +455,14 @@ static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value)
- case NPNVSupportsWindowless:
- *(NPBool*)value = true;
- break;
- +#elif PLATFORM(QT)
- + case NPNVToolkit: {
- + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
- +
- + if (plugin->quirks().contains(PluginQuirkRequiresGtkToolKit))
- + *reinterpret_cast<uint32_t*>(value) = 2;
- + break;
- + }
- #endif
- default:
- notImplemented();
- diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
- index c9ab440..a4c38a3 100644
- --- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
- +++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
- @@ -31,6 +31,7 @@
- #include "RunLoop.h"
- #include <WebCore/GraphicsLayer.h>
- #include <WebCore/IntRect.h>
- +#include <WebCore/PluginQuirkSet.h>
- #include <wtf/HashMap.h>
- #include <wtf/text/CString.h>
- #include <wtf/text/StringHash.h>
- @@ -73,6 +74,7 @@ public:
- static void setException(const String&);
- bool evaluate(NPObject*, const String&scriptString, NPVariant* result);
- bool isPrivateBrowsingEnabled();
- + WebCore::PluginQuirkSet quirks() const { return m_quirks; }
- // These return retained objects.
- NPObject* windowScriptNPObject();
- @@ -186,6 +188,8 @@ private:
- bool m_loadManually;
- RefPtr<NetscapePluginStream> m_manualStream;
- + WebCore::PluginQuirkSet m_quirks;
- +
- #if PLATFORM(MAC)
- NPDrawingModel m_drawingModel;
- NPEventModel m_eventModel;
- diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp
- index b7d4a8e..0d2be45 100644
- --- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp
- +++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp
- @@ -141,6 +141,9 @@ bool NetscapePluginModule::tryLoad()
- #elif PLATFORM(WIN)
- if (getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR || initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR)
- return false;
- +#elif PLATFORM(QT)
- + if (initializeFuncPtr(browserFuncs, &m_pluginFuncs) != NPERR_NO_ERROR)
- + return false;
- #endif
- return true;
- diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.h
- index e495242..586bd13 100644
- --- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.h
- +++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.h
- @@ -43,6 +43,8 @@ public:
- void pluginCreated();
- void pluginDestroyed();
- + String path() const { return m_pluginPath; }
- +
- private:
- explicit NetscapePluginModule(const String& pluginPath);
- diff --git a/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp b/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
- index 206859a..7137bbe 100644
- --- a/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
- +++ b/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
- @@ -28,15 +28,36 @@
- #include "NotImplemented.h"
- #include "WebEvent.h"
- +#include <WebCore/PluginQuirks.h>
- #include <WebCore/GraphicsContext.h>
- using namespace WebCore;
- namespace WebKit {
- +bool NetscapePlugin::platformPreInitialize()
- +{
- + // nspluginwrapper relies on the toolkit value to know if glib is available.
- + if (PluginQuirks::isNPWrapper(m_pluginModule->path()))
- + m_quirks.add(PluginQuirkRequiresGtkToolKit);
- +
- + return true;
- +}
- +
- bool NetscapePlugin::platformPostInitialize()
- {
- - notImplemented();
- + // Workaround Adobe's failure to properly initialize Gtk
- + // in some versions of their flash player plugin.
- + if (PluginQuirks::isFlashPlugin(m_pluginModule->path())) {
- + // We have already loaded the plugin but initializeGTK
- + // needs a QLibrary for resolving gtk_init.
- + QLibrary flashPlugin(m_pluginModule->path());
- + if (!flashPlugin.load())
- + return false;
- +
- + PluginQuirks::initializeGTK(&flashPlugin);
- + }
- +
- return true;
- }