Bug 1414336 - Add a test case to make sure pointercancel isn't fired when content prevents default on touchstart. r=kats.
authorStone Shih <sshih@mozilla.com>
Sat, 13 Jan 2018 07:33:21 +0800
changeset 399241 f80a0db7028491293d85bcfe17f27fa103d33938
parent 399240 f59d5e77eee08dc55839363423036ffd2e4f7c12
child 399242 b584c2d1fb904386cd94f1da1169d115e641fa9a
push id98919
push usersshih@mozilla.com
push dateMon, 15 Jan 2018 05:41:09 +0000
treeherdermozilla-inbound@f80a0db70284 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1414336
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
Bug 1414336 - Add a test case to make sure pointercancel isn't fired when content prevents default on touchstart. r=kats. MozReview-Commit-ID: 93FSsD3bXvA
dom/events/test/pointerevents/mochitest.ini
dom/events/test/pointerevents/test_bug1414336.html
--- a/dom/events/test/pointerevents/mochitest.ini
+++ b/dom/events/test/pointerevents/mochitest.ini
@@ -10,16 +10,20 @@ support-files =
 [test_bug1293174_implicit_pointer_capture_for_touch_1.html]
   support-files = bug1293174_implicit_pointer_capture_for_touch_1.html
 [test_bug1293174_implicit_pointer_capture_for_touch_2.html]
   support-files = bug1293174_implicit_pointer_capture_for_touch_2.html
 [test_bug1303704.html]
 [test_bug1315862.html]
 [test_bug1323158.html]
 [test_bug1403055.html]
+[test_bug1414336.html]
+  support-files =
+    ../../../../gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
+    ../../../../gfx/layers/apz/test/mochitest/apz_test_utils.js
 [test_bug1420589_1.html]
   support-files =
     bug_1420589_iframe1.html
     bug_1420589_iframe2.html
 [test_bug1420589_2.html]
   support-files =
     bug_1420589_iframe1.html
 [test_bug1420589_3.html]
new file mode 100644
--- /dev/null
+++ b/dom/events/test/pointerevents/test_bug1414336.html
@@ -0,0 +1,99 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1414336
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 1414336</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <script type="text/javascript" src="apz_test_native_event_utils.js"></script>
+  <script type="text/javascript" src="apz_test_utils.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <style>
+    #target0 {
+    width: 200px;
+    height: 400px;
+    touch-action: auto;
+    }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1414336">Mozilla Bug 1414336</a>
+<p id="display"></p>
+<div id="target0">
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+  <p>Test bug1414336</p>
+</div>
+<script type="text/javascript">
+/** Test for Bug 1414336 **/
+SimpleTest.waitForExplicitFinish();
+
+waitUntilApzStable().then(() => {
+  let isWindows = (getPlatform() == "windows");
+  SpecialPowers.pushPrefEnv({"set": [["dom.w3c_pointer_events.enabled", true],
+                                     ["apz.test.fails_with_native_injection", isWindows]]}, () => {
+
+    let target0 = window.document.getElementById("target0");
+    let target0_events = ["pointerdown", "pointermove"];
+
+    target0_events.forEach((elem, index, arr) => {
+      target0.addEventListener(elem, (event) => {
+        is(event.type, target0_events[0], "receive " + event.type + " on target0");
+        target0_events.shift();
+      }, { once: true });
+    });
+
+    target0.addEventListener("pointercancel", (event) => {
+      ok(false, "Shouldn't receive pointercancel when content prevents default on touchstart");
+      SimpleTest.finish();
+    }, { once: true });
+
+    target0.addEventListener("touchstart", (event) => {
+      event.preventDefault();
+    }, { once: true });
+
+    target0.addEventListener("pointerup", (event) => {
+      ok(target0_events.length == 0, " should receive " + target0_events + " on target0");
+      SimpleTest.finish();
+    }, { once: true });
+
+    synthesizeNativeTouchDrag(target0, 2, 2, 0, 80);
+  });
+});
+
+</script>
+</body>
+</html>