Index: LayoutTests/fast/events/touch/gesture/gesture-tap-div-removed.html |
diff --git a/LayoutTests/fast/events/touch/gesture/gesture-tap-div-removed.html b/LayoutTests/fast/events/touch/gesture/gesture-tap-div-removed.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dd3052a7e227bb9cd84cb0439fa1b8e231221274 |
--- /dev/null |
+++ b/LayoutTests/fast/events/touch/gesture/gesture-tap-div-removed.html |
@@ -0,0 +1,76 @@ |
+<!DOCTYPE HTML> |
+<script src="../../../../resources/js-test.js"></script> |
+<style> |
+#target { |
+ position: absolute; |
+ right: 10px; |
+ top: 10px; |
+ border: 1px solid blue; |
+} |
+</style> |
+<div id=target> |
+ Tap me |
+</div> |
+<script> |
+ |
+if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+function eventLogger(e) { |
+ debug("Received " + e.type + " on " + (e.currentTarget.id || e.currentTarget.nodeName)); |
+} |
+ |
+function logAndRemove(e) { |
+ eventLogger(e); |
+ e.currentTarget.parentNode.removeChild(e.currentTarget); |
+ debug("Removed element"); |
+ e = null; |
+ gc(); |
+} |
+ |
+function logAndFail(e) { |
+ eventLogger(e); |
+ testFailed("Received unexpected event."); |
+} |
+ |
+function getTargetPoint() { |
+ // Note that we don't want any reference to the node to escape this function |
+ // so that it's elligble for garbage collection. |
+ var target = document.getElementById('target'); |
+ target.addEventListener('mousemove', logAndRemove); |
+ target.addEventListener('mousedown', eventLogger); |
+ target.addEventListener('mouseup', eventLogger); |
+ target.addEventListener('click', eventLogger); |
+ document.addEventListener('mousemove', eventLogger); |
+ document.addEventListener('mousedown', logAndFail); |
+ document.addEventListener('mouseup', logAndFail); |
+ document.addEventListener('click', logAndFail); |
+ |
+ var rect = target.getBoundingClientRect(); |
+ return { |
+ x: rect.left + rect.width / 2, |
+ y: rect.top + rect.height / 2 |
+ }; |
+} |
+ |
+onload = function() { |
+ description("Verifies that deleting the element being tapped during the event sequence doesn't cause any problems. Succeeds if the expected events are delivered to the div and we don't crash."); |
Zeeshan Qureshi
2014/06/26 21:20:50
It might be helpful to mention that we expect the
Rick Byers
2014/06/26 21:29:01
Done.
|
+ |
+ var point = getTargetPoint(); |
+ |
+ if (!window.eventSender) { |
+ debug("This test requires eventSender"); |
+ return; |
+ } |
+ |
+ debug("Sending GestureTapDown"); |
+ eventSender.gestureTapDown(point.x, point.y); |
+ |
+ debug("Sending GestureShowPress"); |
+ eventSender.gestureShowPress(point.x, point.y); |
+ |
+ debug("Sending GestureTap"); |
+ eventSender.gestureTap(point.x, point.y); |
+} |
+ |
+</script> |