Title: [205485] trunk/Source/WebKit2
Revision
205485
Author
[email protected]
Date
2016-09-06 09:28:03 -0700 (Tue, 06 Sep 2016)

Log Message

[GTK][Wayland] evince-browser-plugin prevents viewing PDFs
https://bugs.webkit.org/show_bug.cgi?id=158697

Reviewed by Michael Catanzaro.

Use a different cache file for plugins depending on the current platform display. Plugins can claim to work on
X11 but not on Wayland, for example, if they need XEmebed to work. That's the case of the evince browser plugin.

* UIProcess/Plugins/gtk/PluginInfoCache.cpp:
(WebKit::cacheFilenameForCurrentDisplay):
(WebKit::PluginInfoCache::PluginInfoCache):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (205484 => 205485)


--- trunk/Source/WebKit2/ChangeLog	2016-09-06 16:26:05 UTC (rev 205484)
+++ trunk/Source/WebKit2/ChangeLog	2016-09-06 16:28:03 UTC (rev 205485)
@@ -1,5 +1,19 @@
 2016-09-06  Carlos Garcia Campos  <[email protected]>
 
+        [GTK][Wayland] evince-browser-plugin prevents viewing PDFs
+        https://bugs.webkit.org/show_bug.cgi?id=158697
+
+        Reviewed by Michael Catanzaro.
+
+        Use a different cache file for plugins depending on the current platform display. Plugins can claim to work on
+        X11 but not on Wayland, for example, if they need XEmebed to work. That's the case of the evince browser plugin.
+
+        * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
+        (WebKit::cacheFilenameForCurrentDisplay):
+        (WebKit::PluginInfoCache::PluginInfoCache):
+
+2016-09-06  Carlos Garcia Campos  <[email protected]>
+
         [Threaded Compositor] Update timer should have lower priority than tasks scheduled in compositing thread
         https://bugs.webkit.org/show_bug.cgi?id=161625
 

Modified: trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.cpp (205484 => 205485)


--- trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.cpp	2016-09-06 16:26:05 UTC (rev 205484)
+++ trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.cpp	2016-09-06 16:28:03 UTC (rev 205485)
@@ -30,6 +30,7 @@
 
 #include "NetscapePluginModule.h"
 #include <WebCore/FileSystem.h>
+#include <WebCore/PlatformDisplay.h>
 #include <wtf/text/CString.h>
 
 namespace WebKit {
@@ -42,6 +43,21 @@
     return pluginInfoCache;
 }
 
+static inline const char* cacheFilenameForCurrentDisplay()
+{
+#if PLATFORM(X11)
+    if (WebCore::PlatformDisplay::sharedDisplay().type() == WebCore::PlatformDisplay::Type::X11)
+        return "plugins-x11";
+#endif
+#if PLATFORM(WAYLAND)
+    if (WebCore::PlatformDisplay::sharedDisplay().type() == WebCore::PlatformDisplay::Type::Wayland)
+        return "plugins-wayland";
+#endif
+
+    ASSERT_NOT_REACHED();
+    return "plugins";
+}
+
 PluginInfoCache::PluginInfoCache()
     : m_cacheFile(g_key_file_new())
     , m_saveToFileIdle(RunLoop::main(), this, &PluginInfoCache::saveToFile)
@@ -51,7 +67,11 @@
 
     GUniquePtr<char> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "webkitgtk", nullptr));
     if (WebCore::makeAllDirectories(cacheDirectory.get())) {
-        m_cachePath.reset(g_build_filename(cacheDirectory.get(), "plugins", nullptr));
+        // Delete old cache file.
+        GUniquePtr<char> oldCachePath(g_build_filename(cacheDirectory.get(), "plugins", nullptr));
+        WebCore::deleteFile(WebCore::filenameToString(oldCachePath.get()));
+
+        m_cachePath.reset(g_build_filename(cacheDirectory.get(), cacheFilenameForCurrentDisplay(), nullptr));
         g_key_file_load_from_file(m_cacheFile.get(), m_cachePath.get(), G_KEY_FILE_NONE, nullptr);
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to