Title: [212891] trunk/Source/WebKit2
Revision
212891
Author
carlo...@webkit.org
Date
2017-02-23 08:47:04 -0800 (Thu, 23 Feb 2017)

Log Message

[GTK] Crash attempting to load Flash plugin in Wayland
https://bugs.webkit.org/show_bug.cgi?id=163159

Reviewed by Michael Catanzaro.

The problem is that we check if the current diplay is X11 or Wayland also in the plugin process, but with GTK2
plugins the display is always X11. We should early reject plugins requiring GTK2 in the UI process when the
current display is Wayland.

* UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
(WebKit::PluginInfoStore::getPluginInfo):
* UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
(WebKit::PluginProcessProxy::scanPlugin):
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::createPluginContainer): Add an assert to ensure this message is never received on a
non-X11 display.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::createPluginContainer): Never send CreatePluginContainer message to the UI process if the
display is not X11.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (212890 => 212891)


--- trunk/Source/WebKit2/ChangeLog	2017-02-23 16:39:37 UTC (rev 212890)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-23 16:47:04 UTC (rev 212891)
@@ -1,3 +1,25 @@
+2017-02-23  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK] Crash attempting to load Flash plugin in Wayland
+        https://bugs.webkit.org/show_bug.cgi?id=163159
+
+        Reviewed by Michael Catanzaro.
+
+        The problem is that we check if the current diplay is X11 or Wayland also in the plugin process, but with GTK2
+        plugins the display is always X11. We should early reject plugins requiring GTK2 in the UI process when the
+        current display is Wayland.
+
+        * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
+        (WebKit::PluginInfoStore::getPluginInfo):
+        * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
+        (WebKit::PluginProcessProxy::scanPlugin):
+        * UIProcess/gtk/WebPageProxyGtk.cpp:
+        (WebKit::WebPageProxy::createPluginContainer): Add an assert to ensure this message is never received on a
+        non-X11 display.
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::createPluginContainer): Never send CreatePluginContainer message to the UI process if the
+        display is not X11.
+
 2017-02-23  Eric Carlson  <eric.carl...@apple.com>
 
         [MediaStream iOS] Allow web process sandbox to be extended for media capture

Modified: trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp (212890 => 212891)


--- trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp	2017-02-23 16:39:37 UTC (rev 212890)
+++ trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp	2017-02-23 16:47:04 UTC (rev 212891)
@@ -35,6 +35,7 @@
 #include "PluginSearchPath.h"
 #include "ProcessExecutablePath.h"
 #include <WebCore/FileSystem.h>
+#include <WebCore/PlatformDisplay.h>
 #include <limits.h>
 #include <stdlib.h>
 
@@ -75,6 +76,8 @@
     if (PluginInfoCache::singleton().getPluginInfo(pluginPath, plugin)) {
 #if ENABLE(PLUGIN_PROCESS_GTK2)
         if (plugin.requiresGtk2) {
+            if (PlatformDisplay::sharedDisplay().type() != PlatformDisplay::Type::X11)
+                return false;
             String pluginProcessPath = executablePathOfPluginProcess();
             pluginProcessPath.append('2');
             if (!fileExists(pluginProcessPath))

Modified: trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp (212890 => 212891)


--- trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp	2017-02-23 16:39:37 UTC (rev 212890)
+++ trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp	2017-02-23 16:47:04 UTC (rev 212891)
@@ -33,6 +33,7 @@
 #include "PluginProcessCreationParameters.h"
 #include "ProcessExecutablePath.h"
 #include <WebCore/FileSystem.h>
+#include <WebCore/PlatformDisplay.h>
 #include <sys/wait.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
@@ -84,6 +85,8 @@
 #if PLATFORM(GTK)
     bool requiresGtk2 = pluginRequiresGtk2(pluginPath);
     if (requiresGtk2) {
+        if (PlatformDisplay::sharedDisplay().type() != PlatformDisplay::Type::X11)
+            return false;
 #if ENABLE(PLUGIN_PROCESS_GTK2)
         pluginProcessPath.append('2');
         if (!fileExists(pluginProcessPath))

Modified: trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp (212890 => 212891)


--- trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp	2017-02-23 16:39:37 UTC (rev 212890)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp	2017-02-23 16:47:04 UTC (rev 212891)
@@ -34,6 +34,7 @@
 #include "WebPasteboardProxy.h"
 #include "WebProcessProxy.h"
 #include "WebsiteDataStore.h"
+#include <WebCore/PlatformDisplay.h>
 #include <WebCore/UserAgent.h>
 #include <gtk/gtkx.h>
 #include <wtf/NeverDestroyed.h>
@@ -102,6 +103,7 @@
 
 void WebPageProxy::createPluginContainer(uint64_t& windowID)
 {
+    RELEASE_ASSERT(WebCore::PlatformDisplay::sharedDisplay().type() == WebCore::PlatformDisplay::Type::X11);
     GtkWidget* socket = gtk_socket_new();
     g_signal_connect(socket, "plug-removed", G_CALLBACK(pluginContainerPlugRemoved), 0);
     gtk_container_add(GTK_CONTAINER(viewWidget()), socket);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (212890 => 212891)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2017-02-23 16:39:37 UTC (rev 212890)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2017-02-23 16:47:04 UTC (rev 212891)
@@ -72,6 +72,10 @@
 #include <bindings/ScriptValue.h>
 #include <wtf/text/StringBuilder.h>
 
+#if PLUGIN_ARCHITECTURE(X11)
+#include <WebCore/PlatformDisplay.h>
+#endif
+
 using namespace JSC;
 using namespace WebCore;
 
@@ -1677,7 +1681,8 @@
 uint64_t PluginView::createPluginContainer()
 {
     uint64_t windowID = 0;
-    m_webPage->sendSync(Messages::WebPageProxy::CreatePluginContainer(), Messages::WebPageProxy::CreatePluginContainer::Reply(windowID));
+    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11)
+        m_webPage->sendSync(Messages::WebPageProxy::CreatePluginContainer(), Messages::WebPageProxy::CreatePluginContainer::Reply(windowID));
     return windowID;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to