Fix crashing fast-clicking WK2 tests on iOS
[WebKit-https.git] / LayoutTests / css3 / touch-action / touch-action-manipulation-fast-clicks.html
index b6519e7923514b071f2972f299f16d3c9de3caaa..5bcc9a9072206e880e5a34fa95064d252b75fcbe 100644 (file)
@@ -7,14 +7,21 @@
     <script src="../../resources/js-test-pre.js"></script>
     <script id="ui-script" type="text/plain">
         (function() {
-            function performTap() {
-                uiController.singleTapAtPoint(200, 200, performTap);
+            var count = 0;
+            function fireSuccessiveTaps() {
+                if (count < 3)
+                    uiController.singleTapAtPoint(200, 200, fireSuccessiveTaps);
+                else
+                    uiController.uiScriptComplete("");
+
+                count++;
             }
-            performTap();
+            fireSuccessiveTaps();
         })();
     </script>
 
     <script>
+    var scriptCompleted = false;
     var clickCount = 0;
     if (window.testRunner)
         testRunner.waitUntilDone();
 
     function runTest() {
         if (testRunner.runUIScript)
-            testRunner.runUIScript(getUIScript(), function(result) { });
+            testRunner.runUIScript(getUIScript(), function(result) {
+                scriptCompleted = true;
+                if (clickCount == 3)
+                    testRunner.notifyDone();
+            });
     }
     function handleClicked() {
         clickCount++;
         document.body.appendChild(document.createTextNode("Click!"));
         document.body.appendChild(document.createElement("br"));
-        if (clickCount == 3)
+        if (clickCount == 3 && scriptCompleted)
             testRunner.notifyDone();
     }
     </script>