backout Bug 1414204 because of regressions, r=backout
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 03 Jan 2018 18:42:37 +0200
changeset 449397 4ee98f9838ef094cf6c3818dea94e8da62bf65eb
parent 449396 3ab31d78bc2153a115d7e9a155a92a093659e8ab
child 449398 a53f97560b8fd38fdcac5436225afb38e705a215
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1414204
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
backout Bug 1414204 because of regressions, r=backout
testing/mochitest/tests/SimpleTest/EventUtils.js
--- a/testing/mochitest/tests/SimpleTest/EventUtils.js
+++ b/testing/mochitest/tests/SimpleTest/EventUtils.js
@@ -2165,55 +2165,54 @@ function synthesizeDragOver(aSrcElement,
     aWindow = window;
   }
   if (!aDestWindow) {
     aDestWindow = aWindow;
   }
 
   const obs = _EU_Cc["@mozilla.org/observer-service;1"].getService(_EU_Ci.nsIObserverService);
   const ds = _EU_Cc["@mozilla.org/widget/dragservice;1"].getService(_EU_Ci.nsIDragService);
+  var sess = ds.getCurrentSession();
 
   // This method runs before other callbacks, and acts as a way to inject the
   // initial drag data into the DataTransfer.
   function fillDrag(event) {
-    ds.startDragSession();
-
     if (aDragData) {
       for (var i = 0; i < aDragData.length; i++) {
         var item = aDragData[i];
         for (var j = 0; j < item.length; j++) {
           event.dataTransfer.mozSetDataAt(item[j].type, item[j].data, i);
         }
       }
     }
     event.dataTransfer.dropEffect = aDropEffect || "move";
     event.preventDefault();
   }
 
   function trapDrag(subject, topic) {
     if (topic == "on-datatransfer-available") {
-      var sess = ds.getCurrentSession();
       sess.dataTransfer = _EU_maybeUnwrap(_EU_maybeWrap(subject).mozCloneForEvent("drop"));
       sess.dataTransfer.dropEffect = subject.dropEffect;
-      obs.removeObserver(trapDrag, "on-datatransfer-available");
     }
   }
 
   // need to use real mouse action
-  aWindow.addEventListener("dragstart", fillDrag, { capture: true, once: true });
+  aWindow.addEventListener("dragstart", fillDrag, true);
   obs.addObserver(trapDrag, "on-datatransfer-available");
   synthesizeMouseAtCenter(aSrcElement, { type: "mousedown" }, aWindow);
 
   var rect = aSrcElement.getBoundingClientRect();
   var x = rect.width / 2;
   var y = rect.height / 2;
   synthesizeMouse(aSrcElement, x, y, { type: "mousemove" }, aWindow);
   synthesizeMouse(aSrcElement, x+10, y+10, { type: "mousemove" }, aWindow);
+  aWindow.removeEventListener("dragstart", fillDrag, true);
+  obs.removeObserver(trapDrag, "on-datatransfer-available");
 
-  var dataTransfer = ds.getCurrentSession().dataTransfer;
+  var dataTransfer = sess.dataTransfer;
 
   // The EventStateManager will fire our dragenter event if it needs to.
   var event = createDragEventObject("dragover", aDestElement, aDestWindow,
                                     dataTransfer, aDragEvent);
   var result = sendDragEvent(event, aDestElement, aDestWindow);
 
   return [result, dataTransfer];
 }
@@ -2279,25 +2278,29 @@ function synthesizeDrop(aSrcElement, aDe
 {
   if (!aWindow) {
     aWindow = window;
   }
   if (!aDestWindow) {
     aDestWindow = aWindow;
   }
 
+  var ds = _EU_Cc["@mozilla.org/widget/dragservice;1"]
+           .getService(_EU_Ci.nsIDragService);
+
+  ds.startDragSession();
+
   try {
     var [result, dataTransfer] = synthesizeDragOver(aSrcElement, aDestElement,
                                                     aDragData, aDropEffect,
                                                     aWindow, aDestWindow,
                                                     aDragEvent);
     return synthesizeDropAfterDragOver(result, dataTransfer, aDestElement,
                                        aDestWindow, aDragEvent);
   } finally {
-    var ds = _EU_Cc["@mozilla.org/widget/dragservice;1"].getService(_EU_Ci.nsIDragService);
     ds.endDragSession(true, _parseModifiers(aDragEvent));
   }
 }
 
 var PluginUtils =
 {
   withTestPlugin : function(callback)
   {