Fix crashing fast-clicking WK2 tests on iOS
[WebKit-https.git] / LayoutTests / fast / events / ios / viewport-device-width-at-initial-scale-fast-clicks.html
index ff37391fa0b5656c3d2f589014a4ebba62fe3ea7..d20fe9630d1484b6d8dd724a8b926c4b2b3e175a 100644 (file)
@@ -7,18 +7,21 @@
     <script src="../../../resources/js-test-pre.js"></script>
     <script id="ui-script" type="text/plain">
         (function() {
     <script src="../../../resources/js-test-pre.js"></script>
     <script id="ui-script" type="text/plain">
         (function() {
-            uiController.didEndZoomingCallback = function() {
-                uiController.uiScriptComplete("FAIL: Zoomed to scale " + uiController.zoomScale + " when we should only be firing fast clicks.");
-            };
+            var count = 0;
+            function fireSuccessiveTaps() {
+                if (count < 3)
+                    uiController.singleTapAtPoint(200, 200, fireSuccessiveTaps);
+                else
+                    uiController.uiScriptComplete("");
 
 
-            function fireSuccessiveSingleTaps() {
-                uiController.singleTapAtPoint(200, 200, fireSuccessiveSingleTaps);
+                count++;
             }
             }
-            fireSuccessiveSingleTaps();
+            fireSuccessiveTaps();
         })();
     </script>
 
     <script>
         })();
     </script>
 
     <script>
+    var scriptCompleted = false;
     var clickCount = 0;
     if (window.testRunner)
         testRunner.waitUntilDone();
     var clickCount = 0;
     if (window.testRunner)
         testRunner.waitUntilDone();
 
     function runTest() {
         if (testRunner.runUIScript)
 
     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"));
     }
     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>
             testRunner.notifyDone();
     }
     </script>