Title: [221609] trunk
Revision
221609
Author
[email protected]
Date
2017-09-05 00:16:51 -0700 (Tue, 05 Sep 2017)

Log Message

[GTK] Wrong use of PLUGIN_ARCHITECTURE(X11) in several places
https://bugs.webkit.org/show_bug.cgi?id=176329

Reviewed by Michael Catanzaro.

.:

Only define MOZ_X11 if X11 target is enabled and always define XP_UNIX if NETSCAPE_PLUGIN_API is enabled.

* Source/cmake/OptionsGTK.cmake:

Source/WebKit:

We are using PLUGIN_ARCHITECTURE(X11) in several places where we should actually be using PLATFORM(X11). This is
confusing because PLUGIN_ARCHITECTURE(X11) is no longer specific to X11, it will be renamed as UNIX in a follow
up patch. Because of this we only support plugins in Wayland when building with both X11 and Wayland targets
enabled.

* PluginProcess/PluginControllerProxy.cpp:
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/unix/PluginProcessMainUnix.cpp:
* Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
(WebKit::NetscapePluginModule::determineQuirks):
* Shared/Plugins/PluginQuirks.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/gtk/WebPageProxyGtk.cpp:
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_GetValue):
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::shouldLoadSrcURL):
(WebKit::NetscapePlugin::initialize):
* WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp:
(WebKit::NetscapePlugin::platformHandleMouseEvent):
* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h:
* WebProcess/Plugins/PluginController.h:
* WebProcess/Plugins/PluginProxy.cpp:
* WebProcess/Plugins/PluginProxy.h:
* WebProcess/Plugins/PluginProxy.messages.in:
* WebProcess/Plugins/PluginView.cpp:
* WebProcess/Plugins/PluginView.h:

Tools:

* CMakeLists.txt: Build TestNetscapePlugIn when NETSCAPE_PLUGIN_API is enabled and only link to X11 libraries
when building the X11 target.
* DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:
* DumpRenderTree/TestNetscapePlugIn/Tests/unix/CallInvalidateRectWithNullNPPArgument.cpp: Renamed from Tools/DumpRenderTree/TestNetscapePlugIn/Tests/x11/CallInvalidateRectWithNullNPPArgument.cpp.
* DumpRenderTree/TestNetscapePlugIn/main.cpp:
(NP_Initialize):
(NPP_HandleEvent):
(NPP_GetValue):

Modified Paths

Added Paths

Removed Paths

  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/x11/

Diff

Modified: trunk/ChangeLog (221608 => 221609)


--- trunk/ChangeLog	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/ChangeLog	2017-09-05 07:16:51 UTC (rev 221609)
@@ -1,3 +1,14 @@
+2017-09-05  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Wrong use of PLUGIN_ARCHITECTURE(X11) in several places
+        https://bugs.webkit.org/show_bug.cgi?id=176329
+
+        Reviewed by Michael Catanzaro.
+
+        Only define MOZ_X11 if X11 target is enabled and always define XP_UNIX if NETSCAPE_PLUGIN_API is enabled.
+
+        * Source/cmake/OptionsGTK.cmake:
+
 2017-09-03  Sam Weinig  <[email protected]>
 
         Remove CanvasProxy

Modified: trunk/Source/WebKit/ChangeLog (221608 => 221609)


--- trunk/Source/WebKit/ChangeLog	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/ChangeLog	2017-09-05 07:16:51 UTC (rev 221609)
@@ -1,3 +1,40 @@
+2017-09-05  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Wrong use of PLUGIN_ARCHITECTURE(X11) in several places
+        https://bugs.webkit.org/show_bug.cgi?id=176329
+
+        Reviewed by Michael Catanzaro.
+
+        We are using PLUGIN_ARCHITECTURE(X11) in several places where we should actually be using PLATFORM(X11). This is
+        confusing because PLUGIN_ARCHITECTURE(X11) is no longer specific to X11, it will be renamed as UNIX in a follow
+        up patch. Because of this we only support plugins in Wayland when building with both X11 and Wayland targets
+        enabled.
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        * PluginProcess/PluginControllerProxy.h:
+        * PluginProcess/unix/PluginProcessMainUnix.cpp:
+        * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
+        (WebKit::NetscapePluginModule::determineQuirks):
+        * Shared/Plugins/PluginQuirks.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/gtk/WebPageProxyGtk.cpp:
+        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+        (WebKit::NPN_GetValue):
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::shouldLoadSrcURL):
+        (WebKit::NetscapePlugin::initialize):
+        * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp:
+        (WebKit::NetscapePlugin::platformHandleMouseEvent):
+        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
+        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h:
+        * WebProcess/Plugins/PluginController.h:
+        * WebProcess/Plugins/PluginProxy.cpp:
+        * WebProcess/Plugins/PluginProxy.h:
+        * WebProcess/Plugins/PluginProxy.messages.in:
+        * WebProcess/Plugins/PluginView.cpp:
+        * WebProcess/Plugins/PluginView.h:
+
 2017-09-04  Wenson Hsieh  <[email protected]>
 
         [iOS DnD] Refactor drag and drop logic in WKContentView in preparation for supporting multiple drag items in a drag session

Modified: trunk/Source/WebKit/PluginProcess/PluginControllerProxy.cpp (221608 => 221609)


--- trunk/Source/WebKit/PluginProcess/PluginControllerProxy.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/PluginProcess/PluginControllerProxy.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -646,7 +646,7 @@
     returnValue = m_plugin->getFormValue(formValue);
 }
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
 uint64_t PluginControllerProxy::createPluginContainer()
 {
     uint64_t windowID = 0;

Modified: trunk/Source/WebKit/PluginProcess/PluginControllerProxy.h (221608 => 221609)


--- trunk/Source/WebKit/PluginProcess/PluginControllerProxy.h	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/PluginProcess/PluginControllerProxy.h	2017-09-05 07:16:51 UTC (rev 221609)
@@ -114,7 +114,7 @@
     bool getAuthenticationInfo(const WebCore::ProtectionSpace&, String& username, String& password) override;
     void protectPluginFromDestruction() override;
     void unprotectPluginFromDestruction() override;
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
     uint64_t createPluginContainer() override;
     void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID) override;
     void windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID) override;

Modified: trunk/Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.cpp (221608 => 221609)


--- trunk/Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -41,7 +41,7 @@
 #include <gtk/gtk.h>
 #endif
 
-#if defined(XP_UNIX)
+#if PLATFORM(X11)
 #include <WebCore/PlatformDisplayX11.h>
 #include <WebCore/XErrorTrapper.h>
 #endif
@@ -48,9 +48,9 @@
 
 namespace WebKit {
 
-#if defined(XP_UNIX)
+#if PLATFORM(X11)
 static std::unique_ptr<WebCore::XErrorTrapper> xErrorTrapper;
-#endif // XP_UNIX
+#endif
 
 class PluginProcessMain final: public ChildProcessMainBase {
 public:
@@ -76,7 +76,7 @@
             exit(EXIT_FAILURE);
 #endif
 
-#if defined(XP_UNIX)
+#if PLATFORM(X11)
         if (WebCore::PlatformDisplay::sharedDisplay().type() == WebCore::PlatformDisplay::Type::X11) {
             auto* display = downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay()).native();
             xErrorTrapper = std::make_unique<WebCore::XErrorTrapper>(display, WebCore::XErrorTrapper::Policy::Warn);

Modified: trunk/Source/WebKit/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp (221608 => 221609)


--- trunk/Source/WebKit/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -181,6 +181,8 @@
 
     Vector<MimeClassInfo> mimeTypes;
     parseMIMEDescription(metaData.mimeDescription, mimeTypes);
+
+#if PLATFORM(X11)
     for (size_t i = 0; i < mimeTypes.size(); ++i) {
         if (mimeTypes[i].type == "application/x-shockwave-flash") {
 #if CPU(X86_64)
@@ -190,6 +192,7 @@
             break;
         }
     }
+#endif // PLATFORM(X11)
 }
 
 static void writeCharacter(char byte)

Modified: trunk/Source/WebKit/Shared/Plugins/PluginQuirks.h (221608 => 221609)


--- trunk/Source/WebKit/Shared/Plugins/PluginQuirks.h	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/Shared/Plugins/PluginQuirks.h	2017-09-05 07:16:51 UTC (rev 221609)
@@ -79,7 +79,7 @@
 #endif
 
         // X11 specific quirks:
-#elif PLUGIN_ARCHITECTURE(X11)
+#elif PLATFORM(X11)
         // Flash and npwrapper ask the browser about which GTK version does it use
         // and refuse to load and work if it is not GTK 2 so we need to fake it in
         // NPN_GetValue even when it is a lie.

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (221608 => 221609)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2017-09-05 07:16:51 UTC (rev 221609)
@@ -1557,7 +1557,7 @@
 
     void setRenderTreeSize(uint64_t treeSize) { m_renderTreeSize = treeSize; }
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
     void createPluginContainer(uint64_t& windowID);
     void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID);
     void windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID);

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (221608 => 221609)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2017-09-05 07:16:51 UTC (rev 221609)
@@ -373,7 +373,7 @@
     DictationAlternatives(uint64_t dictationContext) -> (Vector<String> alternatives)
 #endif
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
     # X11 windowed plugin messages
     CreatePluginContainer() -> (uint64_t windowID)
     WindowedPluginGeometryDidChange(WebCore::IntRect frameRect, WebCore::IntRect clipRect, uint64_t windowID)

Modified: trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp (221608 => 221609)


--- trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -91,7 +91,7 @@
     m_pageClient.selectionDidChange();
 }
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
 typedef HashMap<uint64_t, GtkWidget* > PluginWindowMap;
 static PluginWindowMap& pluginWindowMap()
 {
@@ -144,7 +144,7 @@
     else
         gtk_widget_hide(plugin);
 }
-#endif // PLUGIN_ARCHITECTURE(X11)
+#endif // PLATFORM(X11)
 
 void WebPageProxy::setInputMethodState(bool enabled)
 {

Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -45,7 +45,7 @@
 #include <WebCore/MachSendRight.h>
 #endif
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
 #include <WebCore/PlatformDisplayX11.h>
 #endif
 
@@ -507,7 +507,7 @@
             *(NPBool*)value = true;
             break;
 #endif
-#elif PLUGIN_ARCHITECTURE(X11)
+#elif PLATFORM(X11)
         case NPNVxDisplay: {
             if (!npp)
                 return NPERR_GENERIC_ERROR;

Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -546,7 +546,7 @@
 
 bool NetscapePlugin::shouldLoadSrcURL()
 {
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
     // Flash crashes when NPP_GetValue is called for NPPVpluginCancelSrcStream in windowed mode.
     if (m_isWindowed && m_pluginModule->pluginQuirks().contains(PluginQuirks::DoNotCancelSrcStreamInWindowedMode))
         return true;
@@ -644,7 +644,7 @@
         paramValues.append(parameters.values[i].utf8());
     }
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
     if (equalLettersIgnoringASCIICase(parameters.mimeType, "application/x-shockwave-flash")) {
         size_t wmodeIndex = parameters.names.find("wmode");
         if (wmodeIndex != notFound) {

Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -24,15 +24,19 @@
  */
 
 #include "config.h"
-#include "NetscapePlugin.h"
+#include "NetscapePluginUnix.h"
 
 #if PLUGIN_ARCHITECTURE(X11) && ENABLE(NETSCAPE_PLUGIN_API)
 
-#include "NetscapePluginX11.h"
+#include "NetscapePlugin.h"
 #include "WebEvent.h"
 #include <WebCore/NotImplemented.h>
 #include <WebCore/PlatformDisplay.h>
 
+#if PLATFORM(X11)
+#include "NetscapePluginX11.h"
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -106,10 +110,12 @@
     if (m_isWindowed || !m_impl)
         return false;
 
+#if PLATFORM(X11)
     if ((event.type() == WebEvent::MouseDown || event.type() == WebEvent::MouseUp)
         && event.button() == WebMouseEvent::RightButton
         && quirks().contains(PluginQuirks::IgnoreRightClickInWindowlessMode))
         return false;
+#endif
 
     return m_impl->handleMouseEvent(event);
 }

Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -27,7 +27,7 @@
 #include "config.h"
 #include "NetscapePluginX11.h"
 
-#if PLUGIN_ARCHITECTURE(X11) && ENABLE(NETSCAPE_PLUGIN_API)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
 
 #include "NetscapePlugin.h"
 #include "PluginController.h"
@@ -540,4 +540,4 @@
 
 } // namespace WebKit
 
-#endif // PLUGIN_ARCHITECTURE(X11) && ENABLE(NETSCAPE_PLUGIN_API)
+#endif // PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)

Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h	2017-09-05 07:16:51 UTC (rev 221609)
@@ -27,7 +27,7 @@
 #ifndef NetscapePluginX11_h
 #define NetscapePluginX11_h
 
-#if PLUGIN_ARCHITECTURE(X11) && ENABLE(NETSCAPE_PLUGIN_API)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
 
 #include "NetscapePluginUnix.h"
 #include <WebCore/XUniqueResource.h>
@@ -70,6 +70,6 @@
 };
 } // namespace WebKit
 
-#endif // PLUGIN_ARCHITECTURE(X11) && ENABLE(NETSCAPE_PLUGIN_API)
+#endif // PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
 
 #endif // NetscapePluginX11_h

Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginController.h (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/PluginController.h	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginController.h	2017-09-05 07:16:51 UTC (rev 221609)
@@ -143,7 +143,7 @@
     // Decrements a counter that, when it reaches 0, stops preventing the plug-in from being destroyed.
     virtual void unprotectPluginFromDestruction() = 0;
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
     // Create a plugin container for windowed plugins
     virtual uint64_t createPluginContainer() = 0;
     virtual void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID) = 0;

Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.cpp (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -695,7 +695,7 @@
     controller()->setStatusbarText(statusbarText);
 }
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
 void PluginProxy::createPluginContainer(uint64_t& windowID)
 {
     windowID = controller()->createPluginContainer();

Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.h (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.h	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.h	2017-09-05 07:16:51 UTC (rev 221609)
@@ -174,7 +174,7 @@
     void setComplexTextInputState(uint64_t);
     void setLayerHostingContextID(uint32_t);
 #endif
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
     void createPluginContainer(uint64_t& windowID);
     void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID);
     void windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID);

Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.messages.in (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.messages.in	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.messages.in	2017-09-05 07:16:51 UTC (rev 221609)
@@ -70,7 +70,7 @@
     SetLayerHostingContextID(uint32_t layerHostingContextID)
 #endif
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
     # Create the plugin container for windowed plugins
     CreatePluginContainer() -> (uint64_t windowID)
 

Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -72,7 +72,7 @@
 #include <bindings/ScriptValue.h>
 #include <wtf/text/StringBuilder.h>
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
 #include <WebCore/PlatformDisplay.h>
 #endif
 
@@ -1680,7 +1680,7 @@
     m_plugin->frameDidFail(request->requestID(), wasCancelled);
 }
 
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
 uint64_t PluginView::createPluginContainer()
 {
     uint64_t windowID = 0;

Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginView.h (221608 => 221609)


--- trunk/Source/WebKit/WebProcess/Plugins/PluginView.h	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginView.h	2017-09-05 07:16:51 UTC (rev 221609)
@@ -224,7 +224,7 @@
     bool artificialPluginInitializationDelayEnabled() const override;
     void protectPluginFromDestruction() override;
     void unprotectPluginFromDestruction() override;
-#if PLUGIN_ARCHITECTURE(X11)
+#if PLATFORM(X11)
     uint64_t createPluginContainer() override;
     void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID) override;
     void windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID) override;

Modified: trunk/Source/cmake/OptionsGTK.cmake (221608 => 221609)


--- trunk/Source/cmake/OptionsGTK.cmake	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Source/cmake/OptionsGTK.cmake	2017-09-05 07:16:51 UTC (rev 221609)
@@ -178,10 +178,12 @@
 SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_X11 ${ENABLE_X11_TARGET})
 SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_WAYLAND ${ENABLE_WAYLAND_TARGET})
 
-# MOZ_X11 and XP_UNIX are required by npapi.h. Their value is not checked;
-# only their definedness is. They should only be defined in the true case.
-if (${ENABLE_X11_TARGET})
-    SET_AND_EXPOSE_TO_BUILD(MOZ_X11 1)
+if (ENABLE_NETSCAPE_PLUGIN_API)
+    # MOZ_X11 and XP_UNIX are required by npapi.h. Their value is not checked;
+    # only their definedness is. They should only be defined in the true case.
+    if (ENABLE_X11_TARGET)
+        SET_AND_EXPOSE_TO_BUILD(MOZ_X11 1)
+    endif ()
     SET_AND_EXPOSE_TO_BUILD(XP_UNIX 1)
 endif ()
 

Modified: trunk/Tools/CMakeLists.txt (221608 => 221609)


--- trunk/Tools/CMakeLists.txt	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Tools/CMakeLists.txt	2017-09-05 07:16:51 UTC (rev 221609)
@@ -7,7 +7,7 @@
       if (ENABLE_API_TESTS)
           add_subdirectory(TestWebKitAPI/glib)
       endif ()
-      if (ENABLE_X11_TARGET)
+      if (ENABLE_NETSCAPE_PLUGIN_API)
           add_subdirectory(DumpRenderTree/TestNetscapePlugIn)
       endif ()
     endif ()

Modified: trunk/Tools/ChangeLog (221608 => 221609)


--- trunk/Tools/ChangeLog	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Tools/ChangeLog	2017-09-05 07:16:51 UTC (rev 221609)
@@ -1,3 +1,19 @@
+2017-09-05  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Wrong use of PLUGIN_ARCHITECTURE(X11) in several places
+        https://bugs.webkit.org/show_bug.cgi?id=176329
+
+        Reviewed by Michael Catanzaro.
+
+        * CMakeLists.txt: Build TestNetscapePlugIn when NETSCAPE_PLUGIN_API is enabled and only link to X11 libraries
+        when building the X11 target.
+        * DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:
+        * DumpRenderTree/TestNetscapePlugIn/Tests/unix/CallInvalidateRectWithNullNPPArgument.cpp: Renamed from Tools/DumpRenderTree/TestNetscapePlugIn/Tests/x11/CallInvalidateRectWithNullNPPArgument.cpp.
+        * DumpRenderTree/TestNetscapePlugIn/main.cpp:
+        (NP_Initialize):
+        (NPP_HandleEvent):
+        (NPP_GetValue):
+
 2017-09-04  Eric Carlson  <[email protected]>
 
         Switch HTMLMediaElement to release logging

Modified: trunk/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt (221608 => 221609)


--- trunk/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt	2017-09-05 07:16:51 UTC (rev 221609)
@@ -27,7 +27,6 @@
     ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PrivateBrowsing.cpp
     ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/ToStringAndValueOfObject.cpp
     ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/URLRedirect.cpp
-    ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/x11/CallInvalidateRectWithNullNPPArgument.cpp
 )
 
 set(WebKitTestNetscapePlugIn_INCLUDE_DIRECTORIES
@@ -37,21 +36,29 @@
     ${WTF_DIR}
 )
 
-set(WebKitTestNetscapePlugIn_SYSTEM_INCLUDE_DIRECTORIES
-    ${X11_INCLUDE_DIR}
-)
+if (MOZ_X11)
+    set(WebKitTestNetscapePlugIn_SYSTEM_INCLUDE_DIRECTORIES
+        ${X11_INCLUDE_DIR}
+    )
 
-include_directories(${WebKitTestNetscapePlugIn_INCLUDE_DIRECTORIES})
-include_directories(SYSTEM ${WebKitTestNetscapePlugIn_SYSTEM_INCLUDE_DIRECTORIES})
+    set(WebKitTestNetscapePlugIn_LIBRARIES
+        ${X11_LIBRARIES}
+    )
 
-set(WebKitTestNetscapePlugIn_LIBRARIES
-    ${X11_LIBRARIES}
-)
+    add_definitions(-DMOZ_X11)
+endif ()
 
-if (WTF_OS_UNIX)
+if (XP_UNIX)
+    list(APPEND WebKitTestNetscapePlugIn_SOURCES
+        ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/unix/CallInvalidateRectWithNullNPPArgument.cpp
+    )
+
     add_definitions(-DXP_UNIX)
 endif ()
 
+include_directories(${WebKitTestNetscapePlugIn_INCLUDE_DIRECTORIES})
+include_directories(SYSTEM ${WebKitTestNetscapePlugIn_SYSTEM_INCLUDE_DIRECTORIES})
+
 add_library(TestNetscapePlugIn SHARED ${WebKitTestNetscapePlugIn_SOURCES})
 target_link_libraries(TestNetscapePlugIn ${WebKitTestNetscapePlugIn_LIBRARIES})
 set_target_properties(TestNetscapePlugIn PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugins)

Copied: trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/unix/CallInvalidateRectWithNullNPPArgument.cpp (from rev 221608, trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/x11/CallInvalidateRectWithNullNPPArgument.cpp) (0 => 221609)


--- trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/unix/CallInvalidateRectWithNullNPPArgument.cpp	                        (rev 0)
+++ trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/unix/CallInvalidateRectWithNullNPPArgument.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginTest.h"
+
+#include "PluginObject.h"
+
+using namespace std;
+
+class CallInvalidateRectWithNullNPPArgument : public PluginTest {
+public:
+    CallInvalidateRectWithNullNPPArgument(NPP npp, const string& identifier)
+        : PluginTest(npp, identifier)
+    {
+    }
+
+private:
+    virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved)
+    {
+        NPRect rect;
+        browser->invalidaterect(0, &rect);
+        pluginLog(m_npp, "SUCCESS!");
+        return NPERR_NO_ERROR;
+    }
+
+};
+
+static PluginTest::Register<CallInvalidateRectWithNullNPPArgument> callInvalidateRectWithNullNPPArgument("call-invalidate-rect-with-null-npp-argument");

Modified: trunk/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp (221608 => 221609)


--- trunk/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp	2017-09-05 04:55:29 UTC (rev 221608)
+++ trunk/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp	2017-09-05 07:16:51 UTC (rev 221609)
@@ -30,7 +30,7 @@
 #include <cstring>
 #include <string>
 
-#ifdef XP_UNIX
+#if defined(MOZ_X11)
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #endif
@@ -63,7 +63,7 @@
 // Entry points
 extern "C"
 NPError STDCALL NP_Initialize(NPNetscapeFuncs *browserFuncs
-#ifdef XP_UNIX
+#if defined(XP_UNIX)
                               , NPPluginFuncs *pluginFuncs
 #endif
                               )
@@ -78,7 +78,7 @@
 
     browser = browserFuncs;
 
-#ifdef XP_UNIX
+#if defined(XP_UNIX)
     return NP_GetEntryPoints(pluginFuncs);
 #else
     return NPERR_NO_ERROR;
@@ -641,8 +641,7 @@
 
 #endif // XP_MACOSX
 
-#ifdef XP_UNIX
-
+#if defined(MOZ_X11)
 static char keyEventToChar(XKeyEvent* event)
 {
     char c = ' ';
@@ -707,7 +706,7 @@
     fflush(stdout);
     return 0;
 }
-#endif // XP_UNIX
+#endif // MOZ_X11
 
 #ifdef XP_WIN
 static int16_t handleEventWin(NPP instance, PluginObject* obj, NPEvent* event)
@@ -776,7 +775,7 @@
 
     assert(obj->eventModel == NPEventModelCocoa);
     return handleEventCocoa(instance, obj, static_cast<NPCocoaEvent*>(event));
-#elif defined(XP_UNIX)
+#elif defined(MOZ_X11)
     return handleEventX11(instance, obj, static_cast<XEvent*>(event));
 #elif defined(XP_WIN)
     return handleEventWin(instance, obj, static_cast<NPEvent*>(event));
@@ -806,7 +805,7 @@
 
 NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
 {
-#ifdef XP_UNIX
+#if defined(XP_UNIX)
     if (variable == NPPVpluginNameString) {
         *((char **)value) = const_cast<char*>("WebKit Test PlugIn");
         return NPERR_NO_ERROR;
@@ -815,6 +814,9 @@
         *((char **)value) = const_cast<char*>("Simple Netscape® plug-in that handles test content for WebKit");
         return NPERR_NO_ERROR;
     }
+#endif
+
+#if defined(MOZ_X11)
     if (variable == NPPVpluginNeedsXEmbed) {
         *((NPBool *)value) = TRUE;
         return NPERR_NO_ERROR;
@@ -857,7 +859,7 @@
     return obj->pluginTest->NPP_SetValue(variable, value);
 }
 
-#ifdef XP_UNIX
+#if defined(XP_UNIX)
 extern "C"
 const char* NP_GetMIMEDescription(void)
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to