[GTK] Hide GTK+ 2 plugins if GTK+ 2 plugin process was built but is not installed
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jun 2016 14:12:54 +0000 (14:12 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jun 2016 14:12:54 +0000 (14:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158419

Reviewed by Carlos Garcia Campos.

* UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
(WebKit::PluginInfoStore::getPluginInfo):
* UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
(WebKit::PluginProcessProxy::scanPlugin):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201749 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp
Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp

index 5434c52..ba873cc 100644 (file)
@@ -1,3 +1,17 @@
+2016-06-07  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        [GTK] Hide GTK+ 2 plugins if GTK+ 2 plugin process was built but is not installed
+        https://bugs.webkit.org/show_bug.cgi?id=158419
+
+        Reviewed by Carlos Garcia Campos.
+
+        Patch by Alberto Garcia <berto@igalia.com>
+
+        * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
+        (WebKit::PluginInfoStore::getPluginInfo):
+        * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
+        (WebKit::PluginProcessProxy::scanPlugin):
+
 2016-06-06  Antoine Quint  <graouts@apple.com>
 
         Position of WebGL <canvas> on iOS is incorrect with CSS borders
index cfe9bd7..35afe9f 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "NetscapePluginModule.h"
 #include "PluginSearchPath.h"
+#include "ProcessExecutablePath.h"
 #include <WebCore/FileSystem.h>
 
 #if PLATFORM(GTK)
@@ -69,8 +70,17 @@ Vector<String> PluginInfoStore::individualPluginPaths()
 bool PluginInfoStore::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
 {
 #if PLATFORM(GTK)
-    if (PluginInfoCache::singleton().getPluginInfo(pluginPath, plugin))
+    if (PluginInfoCache::singleton().getPluginInfo(pluginPath, plugin)) {
+#if ENABLE(PLUGIN_PROCESS_GTK2)
+        if (plugin.requiresGtk2) {
+            String pluginProcessPath = executablePathOfPluginProcess();
+            pluginProcessPath.append('2');
+            if (!fileExists(pluginProcessPath))
+                return false;
+        }
+#endif
         return true;
+    }
 
     if (NetscapePluginModule::getPluginInfo(pluginPath, plugin)) {
         PluginInfoCache::singleton().updatePluginInfo(pluginPath, plugin);
index 8569450..a6c52f8 100644 (file)
@@ -83,12 +83,15 @@ bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData&
 
 #if PLATFORM(GTK)
     bool requiresGtk2 = pluginRequiresGtk2(pluginPath);
-    if (requiresGtk2)
+    if (requiresGtk2) {
 #if ENABLE(PLUGIN_PROCESS_GTK2)
         pluginProcessPath.append('2');
+        if (!fileExists(pluginProcessPath))
+            return false;
 #else
         return false;
 #endif
+    }
 #endif
 
     CString binaryPath = fileSystemRepresentation(pluginProcessPath);