summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorQuentin Glidic2018-12-12 22:24:46 +0100
committerQuentin Glidic2018-12-13 14:36:41 +0100
commit437cc9018fd8cfa22432a5a7ab5678e9510d81da (patch)
tree2ccd895598715794e5cd7afcdba57f2a6588d739 /packages
parentf9c28e2320d52e0a1e80c8d14b10ee75dfe14dae (diff)
downloadsardemff7-pending-437cc9018fd8cfa22432a5a7ab5678e9510d81da.tar.xz
nightly,daily: Update GTK+2 removal patch
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Diffstat (limited to 'packages')
-rw-r--r--packages/mail-client/daily/files/gtk2less.patch463
-rw-r--r--packages/net-www/nightly/files/gtk2less.patch463
2 files changed, 746 insertions, 180 deletions
diff --git a/packages/mail-client/daily/files/gtk2less.patch b/packages/mail-client/daily/files/gtk2less.patch
index daa3a6d..25f7c85 100644
--- a/packages/mail-client/daily/files/gtk2less.patch
+++ b/packages/mail-client/daily/files/gtk2less.patch
@@ -1,139 +1,422 @@
-From d744f1f548f7e17f3562c96a6f33e778a3e73197 Mon Sep 17 00:00:00 2001
+From 5ac45581ae5c1cb42a3bc4748fcfae5f67f6ae56 Mon Sep 17 00:00:00 2001
From: Quentin Glidic <sardemff7+git@sardemff7.net>
-Date: Mon, 18 Jul 2016 13:32:15 +0200
-Subject: [PATCH] Less GKT+2
+Date: Wed, 12 Dec 2018 21:47:34 +0100
+Subject: [PATCH] Less GTK+2
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
---
- dom/plugins/ipc/PluginInstanceChild.cpp | 6 +++---
- dom/plugins/ipc/PluginInstanceChild.h | 4 ++--
- dom/plugins/ipc/PluginModuleChild.cpp | 25 +++++++++++++++++++------
- 3 files changed, 24 insertions(+), 11 deletions(-)
+ dom/plugins/ipc/PluginInstanceChild.cpp | 27 +--
+ dom/plugins/ipc/PluginInstanceChild.h | 7 -
+ dom/plugins/ipc/PluginModuleChild.cpp | 263 ------------------------
+ dom/plugins/ipc/PluginModuleChild.h | 8 -
+ 4 files changed, 1 insertion(+), 304 deletions(-)
diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp
-index ba75651b1e49..ab1a04b0b9ac 100644
+index 76b0a14636e8..4e7e26a967e7 100644
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
-@@ -47,7 +47,7 @@ using namespace mozilla::gfx;
+@@ -46,14 +46,7 @@ using namespace mozilla::gfx;
using namespace mozilla::widget;
using namespace std;
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
+-
+-#include <gtk/gtk.h>
+-#include <gdk/gdkx.h>
+-#include <gdk/gdk.h>
+-#include "gtk2xtbin.h"
+-
+-#elif defined(OS_WIN)
++#if defined(OS_WIN)
- #include <gtk/gtk.h>
- #include <gdk/gdkx.h>
-@@ -194,7 +194,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
+ #include <windows.h>
+ #include <windowsx.h>
+@@ -194,11 +187,7 @@ PluginInstanceChild::PluginInstanceChild(
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
- mWindow.ws_info = &mWsInfo;
- memset(&mWsInfo, 0, sizeof(mWsInfo));
+ mWindow.ws_info = &mWsInfo;
+ memset(&mWsInfo, 0, sizeof(mWsInfo));
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
- mWsInfo.display = nullptr;
- #else
- mWsInfo.display = DefaultXDisplay();
-@@ -1270,7 +1270,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
- bool
- PluginInstanceChild::Initialize()
- {
+- mWsInfo.display = nullptr;
+-#else
+ mWsInfo.display = DefaultXDisplay();
+-#endif
+ #endif // MOZ_X11 && XP_UNIX && !XP_MACOSX
+ #if defined(OS_WIN)
+ InitPopupMenuHook();
+@@ -1221,20 +1210,6 @@ mozilla::ipc::IPCResult PluginInstanceChild::AnswerNPP_SetWindow(
+ }
+
+ bool PluginInstanceChild::Initialize() {
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
- if (mWsInfo.display) {
- // Already initialized
- return true;
+- if (mWsInfo.display) {
+- // Already initialized
+- return true;
+- }
+-
+- // Request for windowless plugins is set in newp(), before this call.
+- if (mWindow.type == NPWindowTypeWindow) {
+- return false;
+- }
+-
+- mWsInfo.display = DefaultXDisplay();
+-#endif
+-
+ #if defined(XP_MACOSX) && defined(__i386__)
+ // If an i386 Mac OS X plugin has selected the Carbon event model then
+ // we have to fail. We do not support putting Carbon event model plugins
diff --git a/dom/plugins/ipc/PluginInstanceChild.h b/dom/plugins/ipc/PluginInstanceChild.h
-index 1836cec193a8..19abeeb0e9bf 100644
+index abdca763321a..455db166cb55 100644
--- a/dom/plugins/ipc/PluginInstanceChild.h
+++ b/dom/plugins/ipc/PluginInstanceChild.h
-@@ -35,7 +35,7 @@
+@@ -34,10 +34,6 @@
#include <map>
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
- #include "gtk2xtbin.h"
- #endif
+-#include "gtk2xtbin.h"
+-#endif
+-
+ class gfxASurface;
-@@ -447,7 +447,7 @@ private:
+ namespace mozilla {
+@@ -377,9 +373,6 @@ class PluginInstanceChild : public PPluginInstanceChild {
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
- NPSetWindowCallbackStruct mWsInfo;
+ NPSetWindowCallbackStruct mWsInfo;
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
- XtClient mXtClient;
- #endif
+- XtClient mXtClient;
+-#endif
#elif defined(OS_WIN)
+ HWND mPluginWindowHWND;
+ WNDPROC mPluginWndProc;
diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp
-index f86149eac5d1..7068cd5bd138 100644
+index 5c0bc18b1977..a57ab3248616 100644
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
-@@ -11,7 +11,7 @@
+@@ -12,10 +12,6 @@
#include "mozilla/ipc/MessageChannel.h"
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
- #include <gtk/gtk.h>
- #endif
+-#include <gtk/gtk.h>
+-#endif
+-
+ #include "nsIFile.h"
-@@ -127,7 +127,7 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome)
- , mInitializeFunc(0)
+ #include "pratom.h"
+@@ -99,9 +95,6 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome)
#if defined(OS_WIN) || defined(OS_MACOSX)
- , mGetEntryPointsFunc(0)
+ ,
+ mGetEntryPointsFunc(0)
-#elif defined(MOZ_WIDGET_GTK)
-+#elif (MOZ_WIDGET_GTK == 2)
- , mNestedLoopTimerId(0)
+- ,
+- mNestedLoopTimerId(0)
#endif
#ifdef OS_WIN
-@@ -316,7 +316,20 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
- return true;
+ ,
+@@ -330,210 +323,6 @@ bool PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
+ return true;
}
-#if defined(MOZ_WIDGET_GTK)
-+
-+#if (MOZ_WIDGET_GTK == 3)
-+
-+void
-+PluginModuleChild::EnteredCxxStack()
-+{
-+}
-+
-+void
-+PluginModuleChild::ExitedCxxStack()
-+{
-+}
-+
-+#elif (MOZ_WIDGET_GTK == 2)
+-
+-typedef void (*GObjectDisposeFn)(GObject*);
+-typedef gboolean (*GtkWidgetScrollEventFn)(GtkWidget*, GdkEventScroll*);
+-typedef void (*GtkPlugEmbeddedFn)(GtkPlug*);
+-
+-static GObjectDisposeFn real_gtk_plug_dispose;
+-static GtkPlugEmbeddedFn real_gtk_plug_embedded;
+-
+-static void undo_bogus_unref(gpointer data, GObject* object,
+- gboolean is_last_ref) {
+- if (!is_last_ref) // recursion in g_object_ref
+- return;
+-
+- g_object_ref(object);
+-}
+-
+-static void wrap_gtk_plug_dispose(GObject* object) {
+- // Work around Flash Player bug described in bug 538914.
+- //
+- // This function is called during gtk_widget_destroy and/or before
+- // the object's last reference is removed. A reference to the
+- // object is held during the call so the ref count should not drop
+- // to zero. However, Flash Player tries to destroy the GtkPlug
+- // using g_object_unref instead of gtk_widget_destroy. The
+- // reference that Flash is removing actually belongs to the
+- // GtkPlug. During real_gtk_plug_dispose, the GtkPlug removes its
+- // reference.
+- //
+- // A toggle ref is added to prevent premature deletion of the object
+- // caused by Flash Player's extra unref, and to detect when there are
+- // unexpectedly no other references.
+- g_object_add_toggle_ref(object, undo_bogus_unref, nullptr);
+- (*real_gtk_plug_dispose)(object);
+- g_object_remove_toggle_ref(object, undo_bogus_unref, nullptr);
+-}
+-
+-static gboolean gtk_plug_scroll_event(GtkWidget* widget,
+- GdkEventScroll* gdk_event) {
+- if (!gtk_widget_is_toplevel(widget)) // in same process as its GtkSocket
+- return FALSE; // event not handled; propagate to GtkSocket
+-
+- GdkWindow* socket_window = gtk_plug_get_socket_window(GTK_PLUG(widget));
+- if (!socket_window) return FALSE;
+-
+- // Propagate the event to the embedder.
+- GdkScreen* screen = gdk_window_get_screen(socket_window);
+- GdkWindow* plug_window = gtk_widget_get_window(widget);
+- GdkWindow* event_window = gdk_event->window;
+- gint x = gdk_event->x;
+- gint y = gdk_event->y;
+- unsigned int button;
+- unsigned int button_mask = 0;
+- XEvent xevent;
+- Display* dpy = GDK_WINDOW_XDISPLAY(socket_window);
+-
+- /* Translate the event coordinates to the plug window,
+- * which should be aligned with the socket window.
+- */
+- while (event_window != plug_window) {
+- gint dx, dy;
+-
+- gdk_window_get_position(event_window, &dx, &dy);
+- x += dx;
+- y += dy;
+-
+- event_window = gdk_window_get_parent(event_window);
+- if (!event_window) return FALSE;
+- }
+-
+- switch (gdk_event->direction) {
+- case GDK_SCROLL_UP:
+- button = 4;
+- button_mask = Button4Mask;
+- break;
+- case GDK_SCROLL_DOWN:
+- button = 5;
+- button_mask = Button5Mask;
+- break;
+- case GDK_SCROLL_LEFT:
+- button = 6;
+- break;
+- case GDK_SCROLL_RIGHT:
+- button = 7;
+- break;
+- default:
+- return FALSE; // unknown GdkScrollDirection
+- }
+-
+- memset(&xevent, 0, sizeof(xevent));
+- xevent.xbutton.type = ButtonPress;
+- xevent.xbutton.window = gdk_x11_window_get_xid(socket_window);
+- xevent.xbutton.root =
+- gdk_x11_window_get_xid(gdk_screen_get_root_window(screen));
+- xevent.xbutton.subwindow = gdk_x11_window_get_xid(plug_window);
+- xevent.xbutton.time = gdk_event->time;
+- xevent.xbutton.x = x;
+- xevent.xbutton.y = y;
+- xevent.xbutton.x_root = gdk_event->x_root;
+- xevent.xbutton.y_root = gdk_event->y_root;
+- xevent.xbutton.state = gdk_event->state;
+- xevent.xbutton.button = button;
+- xevent.xbutton.same_screen = True;
+-
+- gdk_error_trap_push();
+-
+- XSendEvent(dpy, xevent.xbutton.window, True, ButtonPressMask, &xevent);
+-
+- xevent.xbutton.type = ButtonRelease;
+- xevent.xbutton.state |= button_mask;
+- XSendEvent(dpy, xevent.xbutton.window, True, ButtonReleaseMask, &xevent);
+-
+- gdk_display_sync(gdk_screen_get_display(screen));
+- gdk_error_trap_pop();
+-
+- return TRUE; // event handled
+-}
+-
+-static void wrap_gtk_plug_embedded(GtkPlug* plug) {
+- GdkWindow* socket_window = gtk_plug_get_socket_window(plug);
+- if (socket_window) {
+- if (gtk_check_version(2, 18, 7) != nullptr // older
+- && g_object_get_data(G_OBJECT(socket_window),
+- "moz-existed-before-set-window")) {
+- // Add missing reference for
+- // https://bugzilla.gnome.org/show_bug.cgi?id=607061
+- g_object_ref(socket_window);
+- }
+-
+- // Ensure the window exists to make this GtkPlug behave like an
+- // in-process GtkPlug for Flash Player. (Bugs 561308 and 539138).
+- gtk_widget_realize(GTK_WIDGET(plug));
+- }
+-
+- if (*real_gtk_plug_embedded) {
+- (*real_gtk_plug_embedded)(plug);
+- }
+-}
+-
+-//
+-// The next four constants are knobs that can be tuned. They trade
+-// off potential UI lag from delayed event processing with CPU time.
+-//
+-static const gint kNestedLoopDetectorPriority = G_PRIORITY_HIGH_IDLE;
+-// 90ms so that we can hopefully break livelocks before the user
+-// notices UI lag (100ms)
+-static const guint kNestedLoopDetectorIntervalMs = 90;
+-
+-static const gint kBrowserEventPriority = G_PRIORITY_HIGH_IDLE;
+-static const guint kBrowserEventIntervalMs = 10;
+-
+-// static
+-gboolean PluginModuleChild::DetectNestedEventLoop(gpointer data) {
+- PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data);
+-
+- MOZ_ASSERT(0 != pmc->mNestedLoopTimerId, "callback after descheduling");
+- MOZ_ASSERT(pmc->mTopLoopDepth < g_main_depth(),
+- "not canceled before returning to main event loop!");
+-
+- PLUGIN_LOG_DEBUG(("Detected nested glib event loop"));
+-
+- // just detected a nested loop; start a timer that will
+- // periodically rpc-call back into the browser and process some
+- // events
+- pmc->mNestedLoopTimerId = g_timeout_add_full(
+- kBrowserEventPriority, kBrowserEventIntervalMs,
+- PluginModuleChild::ProcessBrowserEvents, data, nullptr);
+- // cancel the nested-loop detection timer
+- return FALSE;
+-}
+-
+-// static
+-gboolean PluginModuleChild::ProcessBrowserEvents(gpointer data) {
+- PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data);
+-
+- MOZ_ASSERT(pmc->mTopLoopDepth < g_main_depth(),
+- "not canceled before returning to main event loop!");
+-
+- pmc->CallProcessSomeEvents();
+-
+- return TRUE;
+-}
+-
+-void PluginModuleChild::EnteredCxxStack() {
+- MOZ_ASSERT(0 == mNestedLoopTimerId, "previous timer not descheduled");
+-
+- mNestedLoopTimerId = g_timeout_add_full(
+- kNestedLoopDetectorPriority, kNestedLoopDetectorIntervalMs,
+- PluginModuleChild::DetectNestedEventLoop, this, nullptr);
+-
+-#ifdef DEBUG
+- mTopLoopDepth = g_main_depth();
+-#endif
+-}
+-
+-void PluginModuleChild::ExitedCxxStack() {
+- MOZ_ASSERT(0 < mNestedLoopTimerId, "nested loop timeout not scheduled");
+-
+- g_source_remove(mNestedLoopTimerId);
+- mNestedLoopTimerId = 0;
+-}
+-
+-#endif
+-
+ mozilla::ipc::IPCResult PluginModuleChild::RecvSetParentHangTimeout(
+ const uint32_t& aSeconds) {
+ #ifdef XP_WIN
+@@ -550,44 +339,6 @@ bool PluginModuleChild::ShouldContinueFromReplyTimeout() {
+ }
- typedef void (*GObjectDisposeFn)(GObject*);
- typedef gboolean (*GtkWidgetScrollEventFn)(GtkWidget*, GdkEventScroll*);
-@@ -565,7 +578,7 @@ PluginModuleChild::ShouldContinueFromReplyTimeout()
- bool
- PluginModuleChild::InitGraphics()
- {
+ bool PluginModuleChild::InitGraphics() {
-#if defined(MOZ_WIDGET_GTK)
-+#if (MOZ_WIDGET_GTK == 2)
- // Work around plugins that don't interact well with GDK
- // client-side windows.
- PR_SetEnv("GDK_NATIVE_WINDOWS=1");
-@@ -1089,7 +1102,7 @@ _getvalue(NPP aNPP,
- switch (aVariable) {
- // Copied from nsNPAPIPlugin.cpp
- case NPNVToolkit:
+- // Work around plugins that don't interact well with GDK
+- // client-side windows.
+- PR_SetEnv("GDK_NATIVE_WINDOWS=1");
+-
+- gtk_init(0, 0);
+-
+- // GtkPlug is a static class so will leak anyway but this ref makes sure.
+- gpointer gtk_plug_class = g_type_class_ref(GTK_TYPE_PLUG);
+-
+- // The dispose method is a good place to hook into the destruction process
+- // because the reference count should be 1 the last time dispose is
+- // called. (Toggle references wouldn't detect if the reference count
+- // might be higher.)
+- GObjectDisposeFn* dispose = &G_OBJECT_CLASS(gtk_plug_class)->dispose;
+- MOZ_ASSERT(*dispose != wrap_gtk_plug_dispose, "InitGraphics called twice");
+- real_gtk_plug_dispose = *dispose;
+- *dispose = wrap_gtk_plug_dispose;
+-
+- // If we ever stop setting GDK_NATIVE_WINDOWS, we'll also need to
+- // gtk_widget_add_events GDK_SCROLL_MASK or GDK client-side windows will
+- // not tell us about the scroll events that it intercepts. With native
+- // windows, this is called when GDK intercepts the events; if GDK doesn't
+- // intercept the events, then the X server will instead send them directly
+- // to an ancestor (embedder) window.
+- GtkWidgetScrollEventFn* scroll_event =
+- &GTK_WIDGET_CLASS(gtk_plug_class)->scroll_event;
+- if (!*scroll_event) {
+- *scroll_event = gtk_plug_scroll_event;
+- }
+-
+- GtkPlugEmbeddedFn* embedded = &GTK_PLUG_CLASS(gtk_plug_class)->embedded;
+- real_gtk_plug_embedded = *embedded;
+- *embedded = wrap_gtk_plug_embedded;
+-
+-#else
+- // may not be necessary on all platforms
+-#endif
+ #ifdef MOZ_X11
+ // Do this after initializing GDK, or GDK will install its own handler.
+ InstallX11ErrorHandler();
+@@ -998,10 +749,6 @@ NPError _getvalue(NPP aNPP, NPNVariable aVariable, void* aValue) {
+ switch (aVariable) {
+ // Copied from nsNPAPIPlugin.cpp
+ case NPNVToolkit:
-#if defined(MOZ_WIDGET_GTK)
-+#if (MOZ_WIDGET_GTK == 2)
- *static_cast<NPNToolkitType*>(aValue) = NPNVGtk2;
- return NPERR_NO_ERROR;
- #endif
-@@ -1113,7 +1126,7 @@ _getvalue(NPP aNPP,
- case NPNVSupportsWindowless:
- *(NPBool*)aValue = true;
- return NPERR_NO_ERROR;
+- *static_cast<NPNToolkitType*>(aValue) = NPNVGtk2;
+- return NPERR_NO_ERROR;
+-#endif
+ return NPERR_GENERIC_ERROR;
+
+ case NPNVjavascriptEnabledBool:
+@@ -1024,16 +771,6 @@ NPError _getvalue(NPP aNPP, NPNVariable aVariable, void* aValue) {
+ case NPNVSupportsWindowless:
+ *(NPBool*)aValue = true;
+ return NPERR_NO_ERROR;
+-#if defined(MOZ_WIDGET_GTK)
+- case NPNVxDisplay: {
+- if (!aNPP) {
+- return NPERR_INVALID_INSTANCE_ERROR;
+- }
+- return InstCast(aNPP)->NPN_GetValue(aVariable, aValue);
+- }
+- case NPNVxtAppContext:
+- return NPERR_GENERIC_ERROR;
+-#endif
+ default: {
+ if (aNPP) {
+ return InstCast(aNPP)->NPN_GetValue(aVariable, aValue);
+diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h
+index 3e0eace74861..ad83fecceb3d 100644
+--- a/dom/plugins/ipc/PluginModuleChild.h
++++ b/dom/plugins/ipc/PluginModuleChild.h
+@@ -211,14 +211,6 @@ class PluginModuleChild : public PPluginModuleChild {
+ bool InitGraphics();
+ void DeinitGraphics();
+
-#if defined(MOZ_WIDGET_GTK)
-+#if (MOZ_WIDGET_GTK == 2)
- case NPNVxDisplay: {
- if (!aNPP) {
- return NPERR_INVALID_INSTANCE_ERROR;
+- static gboolean DetectNestedEventLoop(gpointer data);
+- static gboolean ProcessBrowserEvents(gpointer data);
+-
+- virtual void EnteredCxxStack() override;
+- virtual void ExitedCxxStack() override;
+-#endif
+-
+ PRLibrary* mLibrary;
+ nsCString mPluginFilename; // UTF8
+ int mQuirks;
--
-2.11.1
+2.20.0
diff --git a/packages/net-www/nightly/files/gtk2less.patch b/packages/net-www/nightly/files/gtk2less.patch
index daa3a6d..25f7c85 100644
--- a/packages/net-www/nightly/files/gtk2less.patch
+++ b/packages/net-www/nightly/files/gtk2less.patch
@@ -1,139 +1,422 @@
-From d744f1f548f7e17f3562c96a6f33e778a3e73197 Mon Sep 17 00:00:00 2001
+From 5ac45581ae5c1cb42a3bc4748fcfae5f67f6ae56 Mon Sep 17 00:00:00 2001
From: Quentin Glidic <sardemff7+git@sardemff7.net>
-Date: Mon, 18 Jul 2016 13:32:15 +0200
-Subject: [PATCH] Less GKT+2
+Date: Wed, 12 Dec 2018 21:47:34 +0100
+Subject: [PATCH] Less GTK+2
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
---
- dom/plugins/ipc/PluginInstanceChild.cpp | 6 +++---
- dom/plugins/ipc/PluginInstanceChild.h | 4 ++--
- dom/plugins/ipc/PluginModuleChild.cpp | 25 +++++++++++++++++++------
- 3 files changed, 24 insertions(+), 11 deletions(-)
+ dom/plugins/ipc/PluginInstanceChild.cpp | 27 +--
+ dom/plugins/ipc/PluginInstanceChild.h | 7 -
+ dom/plugins/ipc/PluginModuleChild.cpp | 263 ------------------------
+ dom/plugins/ipc/PluginModuleChild.h | 8 -
+ 4 files changed, 1 insertion(+), 304 deletions(-)
diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp
-index ba75651b1e49..ab1a04b0b9ac 100644
+index 76b0a14636e8..4e7e26a967e7 100644
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
-@@ -47,7 +47,7 @@ using namespace mozilla::gfx;
+@@ -46,14 +46,7 @@ using namespace mozilla::gfx;
using namespace mozilla::widget;
using namespace std;
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
+-
+-#include <gtk/gtk.h>
+-#include <gdk/gdkx.h>
+-#include <gdk/gdk.h>
+-#include "gtk2xtbin.h"
+-
+-#elif defined(OS_WIN)
++#if defined(OS_WIN)
- #include <gtk/gtk.h>
- #include <gdk/gdkx.h>
-@@ -194,7 +194,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
+ #include <windows.h>
+ #include <windowsx.h>
+@@ -194,11 +187,7 @@ PluginInstanceChild::PluginInstanceChild(
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
- mWindow.ws_info = &mWsInfo;
- memset(&mWsInfo, 0, sizeof(mWsInfo));
+ mWindow.ws_info = &mWsInfo;
+ memset(&mWsInfo, 0, sizeof(mWsInfo));
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
- mWsInfo.display = nullptr;
- #else
- mWsInfo.display = DefaultXDisplay();
-@@ -1270,7 +1270,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
- bool
- PluginInstanceChild::Initialize()
- {
+- mWsInfo.display = nullptr;
+-#else
+ mWsInfo.display = DefaultXDisplay();
+-#endif
+ #endif // MOZ_X11 && XP_UNIX && !XP_MACOSX
+ #if defined(OS_WIN)
+ InitPopupMenuHook();
+@@ -1221,20 +1210,6 @@ mozilla::ipc::IPCResult PluginInstanceChild::AnswerNPP_SetWindow(
+ }
+
+ bool PluginInstanceChild::Initialize() {
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
- if (mWsInfo.display) {
- // Already initialized
- return true;
+- if (mWsInfo.display) {
+- // Already initialized
+- return true;
+- }
+-
+- // Request for windowless plugins is set in newp(), before this call.
+- if (mWindow.type == NPWindowTypeWindow) {
+- return false;
+- }
+-
+- mWsInfo.display = DefaultXDisplay();
+-#endif
+-
+ #if defined(XP_MACOSX) && defined(__i386__)
+ // If an i386 Mac OS X plugin has selected the Carbon event model then
+ // we have to fail. We do not support putting Carbon event model plugins
diff --git a/dom/plugins/ipc/PluginInstanceChild.h b/dom/plugins/ipc/PluginInstanceChild.h
-index 1836cec193a8..19abeeb0e9bf 100644
+index abdca763321a..455db166cb55 100644
--- a/dom/plugins/ipc/PluginInstanceChild.h
+++ b/dom/plugins/ipc/PluginInstanceChild.h
-@@ -35,7 +35,7 @@
+@@ -34,10 +34,6 @@
#include <map>
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
- #include "gtk2xtbin.h"
- #endif
+-#include "gtk2xtbin.h"
+-#endif
+-
+ class gfxASurface;
-@@ -447,7 +447,7 @@ private:
+ namespace mozilla {
+@@ -377,9 +373,6 @@ class PluginInstanceChild : public PPluginInstanceChild {
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
- NPSetWindowCallbackStruct mWsInfo;
+ NPSetWindowCallbackStruct mWsInfo;
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
- XtClient mXtClient;
- #endif
+- XtClient mXtClient;
+-#endif
#elif defined(OS_WIN)
+ HWND mPluginWindowHWND;
+ WNDPROC mPluginWndProc;
diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp
-index f86149eac5d1..7068cd5bd138 100644
+index 5c0bc18b1977..a57ab3248616 100644
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
-@@ -11,7 +11,7 @@
+@@ -12,10 +12,6 @@
#include "mozilla/ipc/MessageChannel.h"
-#ifdef MOZ_WIDGET_GTK
-+#if (MOZ_WIDGET_GTK == 2)
- #include <gtk/gtk.h>
- #endif
+-#include <gtk/gtk.h>
+-#endif
+-
+ #include "nsIFile.h"
-@@ -127,7 +127,7 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome)
- , mInitializeFunc(0)
+ #include "pratom.h"
+@@ -99,9 +95,6 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome)
#if defined(OS_WIN) || defined(OS_MACOSX)
- , mGetEntryPointsFunc(0)
+ ,
+ mGetEntryPointsFunc(0)
-#elif defined(MOZ_WIDGET_GTK)
-+#elif (MOZ_WIDGET_GTK == 2)
- , mNestedLoopTimerId(0)
+- ,
+- mNestedLoopTimerId(0)
#endif
#ifdef OS_WIN
-@@ -316,7 +316,20 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
- return true;
+ ,
+@@ -330,210 +323,6 @@ bool PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
+ return true;
}
-#if defined(MOZ_WIDGET_GTK)
-+
-+#if (MOZ_WIDGET_GTK == 3)
-+
-+void
-+PluginModuleChild::EnteredCxxStack()
-+{
-+}
-+
-+void
-+PluginModuleChild::ExitedCxxStack()
-+{
-+}
-+
-+#elif (MOZ_WIDGET_GTK == 2)
+-
+-typedef void (*GObjectDisposeFn)(GObject*);
+-typedef gboolean (*GtkWidgetScrollEventFn)(GtkWidget*, GdkEventScroll*);
+-typedef void (*GtkPlugEmbeddedFn)(GtkPlug*);
+-
+-static GObjectDisposeFn real_gtk_plug_dispose;
+-static GtkPlugEmbeddedFn real_gtk_plug_embedded;
+-
+-static void undo_bogus_unref(gpointer data, GObject* object,
+- gboolean is_last_ref) {
+- if (!is_last_ref) // recursion in g_object_ref
+- return;
+-
+- g_object_ref(object);
+-}
+-
+-static void wrap_gtk_plug_dispose(GObject* object) {
+- // Work around Flash Player bug described in bug 538914.
+- //
+- // This function is called during gtk_widget_destroy and/or before
+- // the object's last reference is removed. A reference to the
+- // object is held during the call so the ref count should not drop
+- // to zero. However, Flash Player tries to destroy the GtkPlug
+- // using g_object_unref instead of gtk_widget_destroy. The
+- // reference that Flash is removing actually belongs to the
+- // GtkPlug. During real_gtk_plug_dispose, the GtkPlug removes its
+- // reference.
+- //
+- // A toggle ref is added to prevent premature deletion of the object
+- // caused by Flash Player's extra unref, and to detect when there are
+- // unexpectedly no other references.
+- g_object_add_toggle_ref(object, undo_bogus_unref, nullptr);
+- (*real_gtk_plug_dispose)(object);
+- g_object_remove_toggle_ref(object, undo_bogus_unref, nullptr);
+-}
+-
+-static gboolean gtk_plug_scroll_event(GtkWidget* widget,
+- GdkEventScroll* gdk_event) {
+- if (!gtk_widget_is_toplevel(widget)) // in same process as its GtkSocket
+- return FALSE; // event not handled; propagate to GtkSocket
+-
+- GdkWindow* socket_window = gtk_plug_get_socket_window(GTK_PLUG(widget));
+- if (!socket_window) return FALSE;
+-
+- // Propagate the event to the embedder.
+- GdkScreen* screen = gdk_window_get_screen(socket_window);
+- GdkWindow* plug_window = gtk_widget_get_window(widget);
+- GdkWindow* event_window = gdk_event->window;
+- gint x = gdk_event->x;
+- gint y = gdk_event->y;
+- unsigned int button;
+- unsigned int button_mask = 0;
+- XEvent xevent;
+- Display* dpy = GDK_WINDOW_XDISPLAY(socket_window);
+-
+- /* Translate the event coordinates to the plug window,
+- * which should be aligned with the socket window.
+- */
+- while (event_window != plug_window) {
+- gint dx, dy;
+-
+- gdk_window_get_position(event_window, &dx, &dy);
+- x += dx;
+- y += dy;
+-
+- event_window = gdk_window_get_parent(event_window);
+- if (!event_window) return FALSE;
+- }
+-
+- switch (gdk_event->direction) {
+- case GDK_SCROLL_UP:
+- button = 4;
+- button_mask = Button4Mask;
+- break;
+- case GDK_SCROLL_DOWN:
+- button = 5;
+- button_mask = Button5Mask;
+- break;
+- case GDK_SCROLL_LEFT:
+- button = 6;
+- break;
+- case GDK_SCROLL_RIGHT:
+- button = 7;
+- break;
+- default:
+- return FALSE; // unknown GdkScrollDirection
+- }
+-
+- memset(&xevent, 0, sizeof(xevent));
+- xevent.xbutton.type = ButtonPress;
+- xevent.xbutton.window = gdk_x11_window_get_xid(socket_window);
+- xevent.xbutton.root =
+- gdk_x11_window_get_xid(gdk_screen_get_root_window(screen));
+- xevent.xbutton.subwindow = gdk_x11_window_get_xid(plug_window);
+- xevent.xbutton.time = gdk_event->time;
+- xevent.xbutton.x = x;
+- xevent.xbutton.y = y;
+- xevent.xbutton.x_root = gdk_event->x_root;
+- xevent.xbutton.y_root = gdk_event->y_root;
+- xevent.xbutton.state = gdk_event->state;
+- xevent.xbutton.button = button;
+- xevent.xbutton.same_screen = True;
+-
+- gdk_error_trap_push();
+-
+- XSendEvent(dpy, xevent.xbutton.window, True, ButtonPressMask, &xevent);
+-
+- xevent.xbutton.type = ButtonRelease;
+- xevent.xbutton.state |= button_mask;
+- XSendEvent(dpy, xevent.xbutton.window, True, ButtonReleaseMask, &xevent);
+-
+- gdk_display_sync(gdk_screen_get_display(screen));
+- gdk_error_trap_pop();
+-
+- return TRUE; // event handled
+-}
+-
+-static void wrap_gtk_plug_embedded(GtkPlug* plug) {
+- GdkWindow* socket_window = gtk_plug_get_socket_window(plug);
+- if (socket_window) {
+- if (gtk_check_version(2, 18, 7) != nullptr // older
+- && g_object_get_data(G_OBJECT(socket_window),
+- "moz-existed-before-set-window")) {
+- // Add missing reference for
+- // https://bugzilla.gnome.org/show_bug.cgi?id=607061
+- g_object_ref(socket_window);
+- }
+-
+- // Ensure the window exists to make this GtkPlug behave like an
+- // in-process GtkPlug for Flash Player. (Bugs 561308 and 539138).
+- gtk_widget_realize(GTK_WIDGET(plug));
+- }
+-
+- if (*real_gtk_plug_embedded) {
+- (*real_gtk_plug_embedded)(plug);
+- }
+-}
+-
+-//
+-// The next four constants are knobs that can be tuned. They trade
+-// off potential UI lag from delayed event processing with CPU time.
+-//
+-static const gint kNestedLoopDetectorPriority = G_PRIORITY_HIGH_IDLE;
+-// 90ms so that we can hopefully break livelocks before the user
+-// notices UI lag (100ms)
+-static const guint kNestedLoopDetectorIntervalMs = 90;
+-
+-static const gint kBrowserEventPriority = G_PRIORITY_HIGH_IDLE;
+-static const guint kBrowserEventIntervalMs = 10;
+-
+-// static
+-gboolean PluginModuleChild::DetectNestedEventLoop(gpointer data) {
+- PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data);
+-
+- MOZ_ASSERT(0 != pmc->mNestedLoopTimerId, "callback after descheduling");
+- MOZ_ASSERT(pmc->mTopLoopDepth < g_main_depth(),
+- "not canceled before returning to main event loop!");
+-
+- PLUGIN_LOG_DEBUG(("Detected nested glib event loop"));
+-
+- // just detected a nested loop; start a timer that will
+- // periodically rpc-call back into the browser and process some
+- // events
+- pmc->mNestedLoopTimerId = g_timeout_add_full(
+- kBrowserEventPriority, kBrowserEventIntervalMs,
+- PluginModuleChild::ProcessBrowserEvents, data, nullptr);
+- // cancel the nested-loop detection timer
+- return FALSE;
+-}
+-
+-// static
+-gboolean PluginModuleChild::ProcessBrowserEvents(gpointer data) {
+- PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data);
+-
+- MOZ_ASSERT(pmc->mTopLoopDepth < g_main_depth(),
+- "not canceled before returning to main event loop!");
+-
+- pmc->CallProcessSomeEvents();
+-
+- return TRUE;
+-}
+-
+-void PluginModuleChild::EnteredCxxStack() {
+- MOZ_ASSERT(0 == mNestedLoopTimerId, "previous timer not descheduled");
+-
+- mNestedLoopTimerId = g_timeout_add_full(
+- kNestedLoopDetectorPriority, kNestedLoopDetectorIntervalMs,
+- PluginModuleChild::DetectNestedEventLoop, this, nullptr);
+-
+-#ifdef DEBUG
+- mTopLoopDepth = g_main_depth();
+-#endif
+-}
+-
+-void PluginModuleChild::ExitedCxxStack() {
+- MOZ_ASSERT(0 < mNestedLoopTimerId, "nested loop timeout not scheduled");
+-
+- g_source_remove(mNestedLoopTimerId);
+- mNestedLoopTimerId = 0;
+-}
+-
+-#endif
+-
+ mozilla::ipc::IPCResult PluginModuleChild::RecvSetParentHangTimeout(
+ const uint32_t& aSeconds) {
+ #ifdef XP_WIN
+@@ -550,44 +339,6 @@ bool PluginModuleChild::ShouldContinueFromReplyTimeout() {
+ }
- typedef void (*GObjectDisposeFn)(GObject*);
- typedef gboolean (*GtkWidgetScrollEventFn)(GtkWidget*, GdkEventScroll*);
-@@ -565,7 +578,7 @@ PluginModuleChild::ShouldContinueFromReplyTimeout()
- bool
- PluginModuleChild::InitGraphics()
- {
+ bool PluginModuleChild::InitGraphics() {
-#if defined(MOZ_WIDGET_GTK)
-+#if (MOZ_WIDGET_GTK == 2)
- // Work around plugins that don't interact well with GDK
- // client-side windows.
- PR_SetEnv("GDK_NATIVE_WINDOWS=1");
-@@ -1089,7 +1102,7 @@ _getvalue(NPP aNPP,
- switch (aVariable) {
- // Copied from nsNPAPIPlugin.cpp
- case NPNVToolkit:
+- // Work around plugins that don't interact well with GDK
+- // client-side windows.
+- PR_SetEnv("GDK_NATIVE_WINDOWS=1");
+-
+- gtk_init(0, 0);
+-
+- // GtkPlug is a static class so will leak anyway but this ref makes sure.
+- gpointer gtk_plug_class = g_type_class_ref(GTK_TYPE_PLUG);
+-
+- // The dispose method is a good place to hook into the destruction process
+- // because the reference count should be 1 the last time dispose is
+- // called. (Toggle references wouldn't detect if the reference count
+- // might be higher.)
+- GObjectDisposeFn* dispose = &G_OBJECT_CLASS(gtk_plug_class)->dispose;
+- MOZ_ASSERT(*dispose != wrap_gtk_plug_dispose, "InitGraphics called twice");
+- real_gtk_plug_dispose = *dispose;
+- *dispose = wrap_gtk_plug_dispose;
+-
+- // If we ever stop setting GDK_NATIVE_WINDOWS, we'll also need to
+- // gtk_widget_add_events GDK_SCROLL_MASK or GDK client-side windows will
+- // not tell us about the scroll events that it intercepts. With native
+- // windows, this is called when GDK intercepts the events; if GDK doesn't
+- // intercept the events, then the X server will instead send them directly
+- // to an ancestor (embedder) window.
+- GtkWidgetScrollEventFn* scroll_event =
+- &GTK_WIDGET_CLASS(gtk_plug_class)->scroll_event;
+- if (!*scroll_event) {
+- *scroll_event = gtk_plug_scroll_event;
+- }
+-
+- GtkPlugEmbeddedFn* embedded = &GTK_PLUG_CLASS(gtk_plug_class)->embedded;
+- real_gtk_plug_embedded = *embedded;
+- *embedded = wrap_gtk_plug_embedded;
+-
+-#else
+- // may not be necessary on all platforms
+-#endif
+ #ifdef MOZ_X11
+ // Do this after initializing GDK, or GDK will install its own handler.
+ InstallX11ErrorHandler();
+@@ -998,10 +749,6 @@ NPError _getvalue(NPP aNPP, NPNVariable aVariable, void* aValue) {
+ switch (aVariable) {
+ // Copied from nsNPAPIPlugin.cpp
+ case NPNVToolkit:
-#if defined(MOZ_WIDGET_GTK)
-+#if (MOZ_WIDGET_GTK == 2)
- *static_cast<NPNToolkitType*>(aValue) = NPNVGtk2;
- return NPERR_NO_ERROR;
- #endif
-@@ -1113,7 +1126,7 @@ _getvalue(NPP aNPP,
- case NPNVSupportsWindowless:
- *(NPBool*)aValue = true;
- return NPERR_NO_ERROR;
+- *static_cast<NPNToolkitType*>(aValue) = NPNVGtk2;
+- return NPERR_NO_ERROR;
+-#endif
+ return NPERR_GENERIC_ERROR;
+
+ case NPNVjavascriptEnabledBool:
+@@ -1024,16 +771,6 @@ NPError _getvalue(NPP aNPP, NPNVariable aVariable, void* aValue) {
+ case NPNVSupportsWindowless:
+ *(NPBool*)aValue = true;
+ return NPERR_NO_ERROR;
+-#if defined(MOZ_WIDGET_GTK)
+- case NPNVxDisplay: {
+- if (!aNPP) {
+- return NPERR_INVALID_INSTANCE_ERROR;
+- }
+- return InstCast(aNPP)->NPN_GetValue(aVariable, aValue);
+- }
+- case NPNVxtAppContext:
+- return NPERR_GENERIC_ERROR;
+-#endif
+ default: {
+ if (aNPP) {
+ return InstCast(aNPP)->NPN_GetValue(aVariable, aValue);
+diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h
+index 3e0eace74861..ad83fecceb3d 100644
+--- a/dom/plugins/ipc/PluginModuleChild.h
++++ b/dom/plugins/ipc/PluginModuleChild.h
+@@ -211,14 +211,6 @@ class PluginModuleChild : public PPluginModuleChild {
+ bool InitGraphics();
+ void DeinitGraphics();
+
-#if defined(MOZ_WIDGET_GTK)
-+#if (MOZ_WIDGET_GTK == 2)
- case NPNVxDisplay: {
- if (!aNPP) {
- return NPERR_INVALID_INSTANCE_ERROR;
+- static gboolean DetectNestedEventLoop(gpointer data);
+- static gboolean ProcessBrowserEvents(gpointer data);
+-
+- virtual void EnteredCxxStack() override;
+- virtual void ExitedCxxStack() override;
+-#endif
+-
+ PRLibrary* mLibrary;
+ nsCString mPluginFilename; // UTF8
+ int mQuirks;
--
-2.11.1
+2.20.0