summaryrefslogtreecommitdiff
path: root/mozilla-1463753.patch
diff options
context:
space:
mode:
Diffstat (limited to 'mozilla-1463753.patch')
-rw-r--r--mozilla-1463753.patch127
1 files changed, 127 insertions, 0 deletions
diff --git a/mozilla-1463753.patch b/mozilla-1463753.patch
new file mode 100644
index 0000000..4e83fd4
--- /dev/null
+++ b/mozilla-1463753.patch
@@ -0,0 +1,127 @@
+
+# HG changeset patch
+# User Martin Stransky <stransky@redhat.com>
+# Date 1527155477 -7200
+# Node ID 172827af80fa02953e0c7723c0dee915c411c286
+# Parent a5c04fe7278db916b3efd5f06a5f2a9da0d64ad2
+Bug 1463753 - [DragAndDrop] Update mTarget(Wayland)DragContext unconditionally and check its validity after that, r=jhorak
+
+MozReview-Commit-ID: KiNaPDDVvLu
+
+diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp
+--- a/widget/gtk/nsDragService.cpp
++++ b/widget/gtk/nsDragService.cpp
+@@ -1043,21 +1043,21 @@ nsDragService::IsDataFlavorSupported(con
+ }
+
+ // check the target context vs. this flavor, one at a time
+ GList *tmp = nullptr;
+ if (mTargetDragContext) {
+ tmp = gdk_drag_context_list_targets(mTargetDragContext);
+ }
+ #ifdef MOZ_WAYLAND
+- else {
++ else if (mTargetWaylandDragContext) {
+ tmp = mTargetWaylandDragContext->GetTargets();
+ }
++ GList *tmp_head = tmp;
+ #endif
+- GList *tmp_head = tmp;
+
+ for (; tmp; tmp = tmp->next) {
+ /* Bug 331198 */
+ GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
+ gchar *name = nullptr;
+ name = gdk_atom_name(atom);
+ MOZ_LOG(sDragLm, LogLevel::Debug,
+ ("checking %s against %s\n", name, aDataFlavor));
+@@ -1095,21 +1095,23 @@ nsDragService::IsDataFlavorSupported(con
+ MOZ_LOG(sDragLm, LogLevel::Debug,
+ ("good! ( it's text plain and we're checking \
+ against text/unicode or application/x-moz-file)\n"));
+ *_retval = true;
+ }
+ g_free(name);
+ }
+
++#ifdef MOZ_WAYLAND
+ // mTargetWaylandDragContext->GetTargets allocates the list
+ // so we need to free it here.
+- if (!mTargetDragContext) {
++ if (!mTargetDragContext && tmp_head) {
+ g_list_free(tmp_head);
+ }
++#endif
+
+ return NS_OK;
+ }
+
+ void
+ nsDragService::ReplyToDragMotion(GdkDragContext* aDragContext)
+ {
+ MOZ_LOG(sDragLm, LogLevel::Debug,
+@@ -2007,23 +2009,19 @@ nsDragService::RunScheduledTask()
+ // This may be the start of a destination drag session.
+ StartDragSession();
+
+ // mTargetWidget may be nullptr if the window has been destroyed.
+ // (The leave event is not scheduled if a drop task is still scheduled.)
+ // We still reply appropriately to indicate that the drop will or didn't
+ // succeeed.
+ mTargetWidget = mTargetWindow->GetMozContainerWidget();
+- if (mTargetDragContext) {
+- mTargetDragContext.steal(mPendingDragContext);
+- }
++ mTargetDragContext.steal(mPendingDragContext);
+ #ifdef MOZ_WAYLAND
+- else {
+- mTargetWaylandDragContext = mPendingWaylandDragContext.forget();
+- }
++ mTargetWaylandDragContext = mPendingWaylandDragContext.forget();
+ #endif
+ mTargetTime = mPendingTime;
+
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#drag-and-drop-processing-model
+ // (as at 27 December 2010) indicates that a "drop" event should only be
+ // fired (at the current target element) if the current drag operation is
+ // not none. The current drag operation will only be set to a non-none
+ // value during a "dragover" event.
+@@ -2056,17 +2054,17 @@ nsDragService::RunScheduledTask()
+ #endif
+ } else {
+ // Reply to tell the source whether we can drop and what
+ // action would be taken.
+ if (mTargetDragContext) {
+ ReplyToDragMotion(mTargetDragContext);
+ }
+ #ifdef MOZ_WAYLAND
+- else {
++ else if (mTargetWaylandDragContext) {
+ ReplyToDragMotion(mTargetWaylandDragContext);
+ }
+ #endif
+ }
+ }
+ }
+
+ if (task == eDragTaskDrop) {
+@@ -2123,17 +2121,17 @@ nsDragService::UpdateDragAction()
+
+ // default is to do nothing
+ int action = nsIDragService::DRAGDROP_ACTION_NONE;
+ GdkDragAction gdkAction = GDK_ACTION_DEFAULT;
+ if (mTargetDragContext) {
+ gdkAction = gdk_drag_context_get_actions(mTargetDragContext);
+ }
+ #ifdef MOZ_WAYLAND
+- else {
++ else if (mTargetWaylandDragContext) {
+ // We got the selected D&D action from compositor on Wayland.
+ gdkAction = mTargetWaylandDragContext->GetSelectedDragAction();
+ }
+ #endif
+
+ // set the default just in case nothing matches below
+ if (gdkAction & GDK_ACTION_DEFAULT)
+ action = nsIDragService::DRAGDROP_ACTION_MOVE;
+
bgstack15