Changeset 80007 in webkit


Ignore:
Timestamp:
Mar 1, 2011 9:47:11 AM (13 years ago)
Author:
kbalazs@webkit.org
Message:

2011-03-01 Balazs Kelemen <kbalazs@webkit.org>

Reviewed by Anders Carlsson.

[Qt][WK2] Plugin initialization
https://bugs.webkit.org/show_bug.cgi?id=48127

Apply the quirks that are necessary for the flash plugin
to not crash on X11.

  • Platform/qt/ModuleQt.cpp: (WebKit::Module::load): Use the ResolveAllSymbols hint as we do in WebCore.
  • Shared/Plugins/Netscape/NetscapePluginModule.cpp: (WebKit::NetscapePluginModule::tryLoad): Call applyX11QuirksBeforeLoad if PLUGIN_ARCHITECTURE is X11.
  • Shared/Plugins/Netscape/NetscapePluginModule.h:
  • Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp: (WebKit::initializeGTK): The same hack that we do in WebCore. Call gtk_init because flash don't do it for itself. (WebKit::NetscapePluginModule::applyX11QuirksBeforeLoad): Added for X11. Do the hacks that we need to do before calling NP_Initialize on the flash plugin to save it form crashing.
  • Shared/Plugins/PluginQuirks.h: Use PLUGIN_ARCHITECTURE macros. Added RequiresGTKToolKit quirk for X11.
  • WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: (WebKit::NPN_GetValue): Handle the RequiresGTKToolKit quirk on X11.
  • WebProcess/Plugins/Netscape/NetscapePlugin.h: (WebKit::NetscapePlugin::quirks): Added getter for the PluginModule's quirks to be available in NPN_GetValue.
Location:
trunk/Source/WebKit2
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r80001 r80007  
     12011-03-01  Balazs Kelemen  <kbalazs@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        [Qt][WK2] Plugin initialization
     6        https://bugs.webkit.org/show_bug.cgi?id=48127
     7
     8        Apply the quirks that are necessary for the flash plugin
     9        to not crash on X11.
     10
     11        * Platform/qt/ModuleQt.cpp:
     12        (WebKit::Module::load): Use the ResolveAllSymbols hint as we do in WebCore.
     13        * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
     14        (WebKit::NetscapePluginModule::tryLoad): Call applyX11QuirksBeforeLoad
     15        if PLUGIN_ARCHITECTURE is X11.
     16        * Shared/Plugins/Netscape/NetscapePluginModule.h:
     17        * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
     18        (WebKit::initializeGTK):  The same hack that we do in WebCore.
     19        Call gtk_init because flash don't do it for itself.
     20        (WebKit::NetscapePluginModule::applyX11QuirksBeforeLoad): Added for X11.
     21        Do the hacks that we need to do before calling NP_Initialize on the
     22        flash plugin to save it form crashing.
     23        * Shared/Plugins/PluginQuirks.h: Use PLUGIN_ARCHITECTURE macros.
     24        Added RequiresGTKToolKit quirk for X11.
     25        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
     26        (WebKit::NPN_GetValue): Handle the RequiresGTKToolKit quirk on X11.
     27        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
     28        (WebKit::NetscapePlugin::quirks): Added getter for the PluginModule's
     29        quirks to be available in NPN_GetValue.
     30
    1312011-03-01  Adam Roben  <aroben@apple.com>
    232
  • trunk/Source/WebKit2/Platform/qt/ModuleQt.cpp

    r76916 r80007  
    3333{
    3434    m_lib.setFileName(static_cast<QString>(m_path));
     35    m_lib.setLoadHints(QLibrary::ResolveAllSymbolsHint);
    3536    return m_lib.load();
    3637}
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp

    r79925 r80007  
    211211bool NetscapePluginModule::tryLoad()
    212212{
     213#if PLUGIN_ARCHITECTURE(X11)
     214    applyX11QuirksBeforeLoad();
     215#endif
     216
    213217    m_module = adoptPtr(new Module(m_pluginPath));
    214218    if (!m_module->load())
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h

    r78800 r80007  
    6565    void determineQuirks();
    6666
     67#if PLUGIN_ARCHITECTURE(X11)
     68    void applyX11QuirksBeforeLoad();
     69#endif
     70
    6771    void incrementLoadCount();
    6872    void decrementLoadCount();
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp

    r76916 r80007  
    3030#include "PluginPackage.h"
    3131
     32#if PLATFORM(QT)
     33#include <QLibrary>
     34#endif
     35
    3236using namespace WebCore;
    3337
    3438namespace WebKit {
     39
     40#if PLATFORM(QT)
     41static void initializeGTK()
     42{
     43    QLibrary library("libgtk-x11-2.0.so.0");
     44    if (library.load()) {
     45        typedef void *(*gtk_init_check_ptr)(int*, char***);
     46        gtk_init_check_ptr gtkInitCheck = reinterpret_cast<gtk_init_check_ptr>(library.resolve("gtk_init_check"));
     47        // NOTE: We're using gtk_init_check() since gtk_init() calls exit() on failure.
     48        if (gtkInitCheck)
     49            (void) gtkInitCheck(0, 0);
     50    }
     51}
     52#endif
     53
     54void NetscapePluginModule::applyX11QuirksBeforeLoad()
     55{
     56#if PLATFORM(QT)
     57    if (m_pluginPath.contains("npwrapper") || m_pluginPath.contains("flashplayer")) {
     58        initializeGTK();
     59        m_pluginQuirks.add(PluginQuirks::RequiresGTKToolKit);
     60    }
     61#endif
     62}
    3563
    3664bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin& plugin)
  • trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h

    r78956 r80007  
    3333    enum PluginQuirk {
    3434        // Mac specific quirks:
    35 #if PLATFORM(MAC)
     35#if PLUGIN_ARCHITECTURE(MAC)
    3636        // The plug-in wants the call to getprogame() to return "WebKitPluginHost".
    3737        // Adobe Flash Will not handle key down events otherwise.
     
    3939        // Supports receiving a paint event, even when using CoreAnimation rendering.
    4040        SupportsSnapshotting,
     41#elif PLUGIN_ARCHITECTURE(X11)
     42        // Flash and npwrapper ask the browser about which GTK version does it use
     43        // and refuse to load and work if it is not GTK 2 so we need to fake it in
     44        // NPN_GetValue even when it is a lie.
     45        RequiresGTKToolKit,
    4146#endif
    4247        NumPluginQuirks
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp

    r79335 r80007  
    484484           *(NPBool*)value = true;
    485485           break;
     486#elif PLUGIN_ARCHITECTURE(X11)
     487       case NPNVToolkit: {
     488           const uint32_t expectedGTKToolKitVersion = 2;
     489
     490           RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
     491           if (plugin->quirks().contains(PluginQuirks::RequiresGTKToolKit)) {
     492               *reinterpret_cast<uint32_t*>(value) = expectedGTKToolKitVersion;
     493               break;
     494           }
     495
     496           return NPERR_GENERIC_ERROR;
     497       }
    486498#endif
    487499        default:
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h

    r78956 r80007  
    7171#endif
    7272
     73    PluginQuirks quirks() const { return m_pluginModule->pluginQuirks(); }
     74
    7375    void invalidate(const NPRect*);
    7476    static const char* userAgent(NPP);
Note: See TracChangeset for help on using the changeset viewer.