Title: [88244] trunk/Source
Revision
88244
Author
carlo...@webkit.org
Date
2011-06-07 09:35:06 -0700 (Tue, 07 Jun 2011)

Log Message

2011-06-07  Carlos Garcia Campos  <cgar...@igalia.com>

        Reviewed by Martin Robinson.

        [GTK] Move moduleMixesGtkSymbols() from PluginPackage to PluginView
        https://bugs.webkit.org/show_bug.cgi?id=62200

        In WebKit2 PluginPackage is used by the UI process to load plugins
        in order to get information about them, but it doesn't use any GTK
        symbol. So the UI process should be able to load plugins even when
        building with GTK3, but we should not allow the plugin view to use
        the plugin if it mixes GTK2 and GTK3 symbols.

        * plugins/PluginPackage.h:
        (WebCore::PluginPackage::module): New method to return the
        platform module.
        * plugins/gtk/PluginPackageGtk.cpp:
        (WebCore::PluginPackage::load): Remove moduleMixesGtkSymbols().
        * plugins/gtk/PluginViewGtk.cpp:
        (WebCore::PluginView::updatePluginWidget): Check whether plugin
        was successfully loaded before trying to create the drawable.
        (WebCore::PluginView::paint): Return early if plugin didn't start
        or was not successfully loaded.
        (WebCore::PluginView::handleKeyboardEvent): Ditto.
        (WebCore::PluginView::handleMouseEvent): Ditto.
        (WebCore::PluginView::handleFocusInEvent): Ditto.
        (WebCore::PluginView::handleFocusOutEvent): Ditto.
        (WebCore::moduleMixesGtkSymbols):
        (WebCore::PluginView::platformStart): Check whether module is
        mixing GTK+ 2 and GTK+ 3 symbols.
2011-06-07  Carlos Garcia Campos  <cgar...@igalia.com>

        Reviewed by Martin Robinson.

        [GTK] Move moduleMixesGtkSymbols() from PluginPackage to PluginView
        https://bugs.webkit.org/show_bug.cgi?id=62200

        In WebKit2 PluginPackage is used by the UI process to load plugins
        in order to get information about them, but it doesn't use any GTK
        symbol. So the UI process should be able to load plugins even when
        building with GTK3, but we should not allow the plugin view to use
        the plugin if it mixes GTK2 and GTK3 symbols.

        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
        (WebKit::moduleMixesGtkSymbols):
        (WebKit::NetscapePlugin::platformPostInitialize): Check whether
        the module is mixing GTK+ 2 and GTK+ 3 symbols.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88243 => 88244)


--- trunk/Source/WebCore/ChangeLog	2011-06-07 16:33:06 UTC (rev 88243)
+++ trunk/Source/WebCore/ChangeLog	2011-06-07 16:35:06 UTC (rev 88244)
@@ -1,3 +1,34 @@
+2011-06-07  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Move moduleMixesGtkSymbols() from PluginPackage to PluginView
+        https://bugs.webkit.org/show_bug.cgi?id=62200
+
+        In WebKit2 PluginPackage is used by the UI process to load plugins
+        in order to get information about them, but it doesn't use any GTK
+        symbol. So the UI process should be able to load plugins even when
+        building with GTK3, but we should not allow the plugin view to use
+        the plugin if it mixes GTK2 and GTK3 symbols.
+
+        * plugins/PluginPackage.h:
+        (WebCore::PluginPackage::module): New method to return the
+        platform module.
+        * plugins/gtk/PluginPackageGtk.cpp:
+        (WebCore::PluginPackage::load): Remove moduleMixesGtkSymbols().
+        * plugins/gtk/PluginViewGtk.cpp:
+        (WebCore::PluginView::updatePluginWidget): Check whether plugin
+        was successfully loaded before trying to create the drawable.
+        (WebCore::PluginView::paint): Return early if plugin didn't start
+        or was not successfully loaded.
+        (WebCore::PluginView::handleKeyboardEvent): Ditto.
+        (WebCore::PluginView::handleMouseEvent): Ditto.
+        (WebCore::PluginView::handleFocusInEvent): Ditto.
+        (WebCore::PluginView::handleFocusOutEvent): Ditto.
+        (WebCore::moduleMixesGtkSymbols):
+        (WebCore::PluginView::platformStart): Check whether module is
+        mixing GTK+ 2 and GTK+ 3 symbols.
+
 2011-06-07  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r88238.

Modified: trunk/Source/WebCore/plugins/PluginPackage.h (88243 => 88244)


--- trunk/Source/WebCore/plugins/PluginPackage.h	2011-06-07 16:33:06 UTC (rev 88243)
+++ trunk/Source/WebCore/plugins/PluginPackage.h	2011-06-07 16:35:06 UTC (rev 88244)
@@ -58,6 +58,7 @@
         const String& path() const { return m_path; }
         const String& fileName() const { return m_fileName; }
         const String& parentDirectory() const { return m_parentDirectory; }
+        PlatformModule module() const { return m_module; }
         uint16_t NPVersion() const;
         time_t lastModified() const { return m_lastModified; }
 

Modified: trunk/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp (88243 => 88244)


--- trunk/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp	2011-06-07 16:33:06 UTC (rev 88243)
+++ trunk/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp	2011-06-07 16:35:06 UTC (rev 88244)
@@ -119,17 +119,6 @@
 }
 #endif
 
-static bool moduleMixesGtkSymbols(GModule* module)
-{
-    gpointer symbol;
-#ifdef GTK_API_VERSION_2
-    return g_module_symbol(module, "gtk_application_get_type", &symbol);
-#else
-    return g_module_symbol(module, "gtk_object_get_type", &symbol);
-#endif
-}
-
-
 bool PluginPackage::load()
 {
     if (m_isLoaded) {
@@ -161,12 +150,6 @@
         return false;
     }
 
-    if (moduleMixesGtkSymbols(m_module)) {
-        LOG(Plugins, "Module '%s' mixes GTK+ 2 and GTK+ 3 symbols, ignoring plugin.\n", m_path.utf8().data());
-        g_module_close(m_module);
-        return false;
-    }
-
     m_isLoaded = true;
 
 #if defined(XP_UNIX)

Modified: trunk/Source/WebCore/plugins/gtk/PluginViewGtk.cpp (88243 => 88244)


--- trunk/Source/WebCore/plugins/gtk/PluginViewGtk.cpp	2011-06-07 16:33:06 UTC (rev 88243)
+++ trunk/Source/WebCore/plugins/gtk/PluginViewGtk.cpp	2011-06-07 16:35:06 UTC (rev 88244)
@@ -141,6 +141,9 @@
     if (m_windowRect == oldWindowRect && m_clipRect == oldClipRect)
         return;
 
+    if (m_status != PluginStatusLoadedSuccessfully)
+        return;
+
 #if defined(XP_UNIX)
     if (!m_isWindowed) {
         Display* display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
@@ -177,7 +180,7 @@
 
 void PluginView::paint(GraphicsContext* context, const IntRect& rect)
 {
-    if (!m_isStarted) {
+    if (!m_isStarted || m_status != PluginStatusLoadedSuccessfully) {
         paintMissingPluginIcon(context, rect);
         return;
     }
@@ -271,7 +274,7 @@
 {
     JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly);
 
-    if (m_isWindowed)
+    if (!m_isStarted || m_status != PluginStatusLoadedSuccessfully)
         return;
 
     if (event->type() != eventNames().keydownEvent && event->type() != eventNames().keyupEvent)
@@ -401,7 +404,7 @@
 {
     JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly);
 
-    if (m_isWindowed)
+    if (!m_isStarted || m_status != PluginStatusLoadedSuccessfully)
         return;
 
     if (event->type() == eventNames().mousedownEvent) {
@@ -439,6 +442,9 @@
 #if defined(XP_UNIX)
 void PluginView::handleFocusInEvent()
 {
+    if (!m_isStarted || m_status != PluginStatusLoadedSuccessfully)
+        return;
+
     XEvent npEvent;
     initXEvent(&npEvent);
 
@@ -452,6 +458,9 @@
 
 void PluginView::handleFocusOutEvent()
 {
+    if (!m_isStarted || m_status != PluginStatusLoadedSuccessfully)
+        return;
+
     XEvent npEvent;
     initXEvent(&npEvent);
 
@@ -799,11 +808,26 @@
     view->updateWidgetAllocationAndClip();
 }
 
+static bool moduleMixesGtkSymbols(GModule* module)
+{
+    gpointer symbol;
+#ifdef GTK_API_VERSION_2
+    return g_module_symbol(module, "gtk_application_get_type", &symbol);
+#else
+    return g_module_symbol(module, "gtk_object_get_type", &symbol);
+#endif
+}
+
 bool PluginView::platformStart()
 {
     ASSERT(m_isStarted);
     ASSERT(m_status == PluginStatusLoadedSuccessfully);
 
+    if (moduleMixesGtkSymbols(m_plugin->module())) {
+        LOG(Plugins, "Module '%s' mixes GTK+ 2 and GTK+ 3 symbols, ignoring plugin.\n", m_plugin->path().utf8().data());
+        return false;
+    }
+
 #if defined(XP_UNIX)
     if (m_plugin->pluginFuncs()->getvalue) {
         PluginView::setCurrentPluginView(this);

Modified: trunk/Source/WebKit2/ChangeLog (88243 => 88244)


--- trunk/Source/WebKit2/ChangeLog	2011-06-07 16:33:06 UTC (rev 88243)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-07 16:35:06 UTC (rev 88244)
@@ -1,3 +1,21 @@
+2011-06-07  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Move moduleMixesGtkSymbols() from PluginPackage to PluginView
+        https://bugs.webkit.org/show_bug.cgi?id=62200
+
+        In WebKit2 PluginPackage is used by the UI process to load plugins
+        in order to get information about them, but it doesn't use any GTK
+        symbol. So the UI process should be able to load plugins even when
+        building with GTK3, but we should not allow the plugin view to use
+        the plugin if it mixes GTK2 and GTK3 symbols.
+
+        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
+        (WebKit::moduleMixesGtkSymbols):
+        (WebKit::NetscapePlugin::platformPostInitialize): Check whether
+        the module is mixing GTK+ 2 and GTK+ 3 symbols.
+
 2011-06-06  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r88222.

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp (88243 => 88244)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2011-06-07 16:33:06 UTC (rev 88243)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2011-06-07 16:35:06 UTC (rev 88244)
@@ -131,8 +131,24 @@
 #endif
 }
 
+#if PLATFORM(GTK)
+static bool moduleMixesGtkSymbols(Module* module)
+{
+#ifdef GTK_API_VERSION_2
+    return module->functionPointer<gpointer>("gtk_application_get_type");
+#else
+    return module->functionPointer<gpointer>("gtk_object_get_type");
+#endif
+}
+#endif
+
 bool NetscapePlugin::platformPostInitialize()
 {
+#if PLATFORM(GTK)
+    if (moduleMixesGtkSymbols(m_pluginModule->module()))
+        return false;
+#endif
+
     if (m_isWindowed)
         return false;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to