Bug 1250691 - [Devtools][Responsive mode] The "touchend" event should not have the removed touch. r=jryans
authorJulien Wajsberg <felash@gmail.com>
Fri, 26 Feb 2016 09:40:00 -0500
changeset 324035 4972f77869de55becd41d6b726b25fca2f523232
parent 324034 b8e89af2e6f0ba96925b29c295b4c219b8d9551b
child 324238 9da51cb4974e03cdd8fa45a34086fe1033abfeaf
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1250691
milestone47.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
Bug 1250691 - [Devtools][Responsive mode] The "touchend" event should not have the removed touch. r=jryans
devtools/client/responsivedesign/test/touch.html
devtools/shared/touch/simulator-content.js
--- a/devtools/client/responsivedesign/test/touch.html
+++ b/devtools/client/responsivedesign/test/touch.html
@@ -28,11 +28,13 @@
   div.addEventListener("touchmove", function(evt) {
     var touch = evt.changedTouches[0];
     var deltaX = touch.pageX - initX;
     var deltaY = touch.pageY - initY;
     div.style.transform = "translate(" + deltaX + "px, " + deltaY + "px)";
   }, true);
 
   div.addEventListener("touchend", function(evt) {
-    div.style.transform = "none";
+    if (!evt.touches.length) {
+      div.style.transform = "none";
+    }
   }, true);
 </script>
--- a/devtools/shared/touch/simulator-content.js
+++ b/devtools/shared/touch/simulator-content.js
@@ -279,19 +279,26 @@ var simulator = {
     }
 
     let touchEvent = document.createEvent("touchevent");
     let point = document.createTouch(content, target, 0,
                                      evt.pageX, evt.pageY,
                                      evt.screenX, evt.screenY,
                                      evt.clientX, evt.clientY,
                                      1, 1, 0, 0);
+
     let touches = document.createTouchList(point);
     let targetTouches = touches;
     let changedTouches = touches;
+    if (name === "touchend" || name === "touchcancel") {
+      // "touchend" and "touchcancel" events should not have the removed touch
+      // neither in touches nor in targetTouches
+      touches = targetTouches = document.createTouchList();
+    }
+
     touchEvent.initTouchEvent(name, true, true, content, 0,
                               false, false, false, false,
                               touches, targetTouches, changedTouches);
     target.dispatchEvent(touchEvent);
   },
 
   getContent(target) {
     let win = (target && target.ownerDocument)