Title: [228065] branches/safari-605-branch/LayoutTests

Diff

Modified: branches/safari-605-branch/LayoutTests/ChangeLog (228064 => 228065)


--- branches/safari-605-branch/LayoutTests/ChangeLog	2018-02-05 02:19:06 UTC (rev 228064)
+++ branches/safari-605-branch/LayoutTests/ChangeLog	2018-02-05 02:19:08 UTC (rev 228065)
@@ -1,5 +1,23 @@
 2018-02-04  Jason Marcell  <jmarc...@apple.com>
 
+        Cherry-pick r227992. rdar://problem/37145465
+
+    2018-02-01  Megan Gardner  <megan_gard...@apple.com>
+
+            Fix race-condition in fast/forms/ios/ipad/select-form-run-twice.html
+            https://bugs.webkit.org/show_bug.cgi?id=182370
+
+            Reviewed by Tim Horton.
+
+            There is the potential for multiple button clicks, due to looping function calls that can cause timed functions to
+            still be running in the next test, causing crashes. Guarding against repeated clicks, and cancelling the timers should
+            clean up this problem.
+
+            * fast/forms/ios/ipad/select-form-run-twice.html:
+            * fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html:
+
+2018-02-04  Jason Marcell  <jmarc...@apple.com>
+
         Cherry-pick r227985. rdar://problem/37145479
 
     2018-02-01  Chris Dumez  <cdu...@apple.com>

Modified: branches/safari-605-branch/LayoutTests/fast/forms/ios/ipad/select-form-run-twice.html (228064 => 228065)


--- branches/safari-605-branch/LayoutTests/fast/forms/ios/ipad/select-form-run-twice.html	2018-02-05 02:19:06 UTC (rev 228064)
+++ branches/safari-605-branch/LayoutTests/fast/forms/ios/ipad/select-form-run-twice.html	2018-02-05 02:19:08 UTC (rev 228065)
@@ -64,33 +64,60 @@
                 })();`
         }
 
+        var firstButtonIsClicked = false;
+        var finalButtonIsClicked = false;
+        var firstButtonTimeoutID;
+        var finalButtonTimeoutID;
+        
         function firstButtonClicked()
         {
-            document.getElementById('nextStep').textContent = 'PASS: hit testing found #nextButton after first select interaction';
-            var selectElement = document.getElementsByTagName('select')[0];
-            var point = getPointInsideElement(selectElement, 10, 10);
-            testRunner.runUIScript(getTapOnSelectUIScript(point.x, point.y, 5), function() {
-                document.getElementById('select-value2').textContent = selectElement.value;
-                    tryTapOnButton('finalTarget');
-            });
+            clearTimeout(firstButtonTimeoutID);
+            if (!firstButtonIsClicked) {
+                firstButtonIsClicked = true;
+                
+                document.getElementById('nextStep').textContent = 'PASS: hit testing found #nextButton after first select interaction';
+                var selectElement = document.getElementsByTagName('select')[0];
+                var point = getPointInsideElement(selectElement, 10, 10);
+                testRunner.runUIScript(getTapOnSelectUIScript(point.x, point.y, 5), function() {
+                    document.getElementById('select-value2').textContent = selectElement.value;
+                        tryTapOnFinalButton();
+                });
+            }
         }
     
         function finalButtonClicked()
         {
-            document.getElementById('result').textContent = 'PASS: hit testing found #finalTarget after select interaction';
-            if (window.testRunner)
-                testRunner.notifyDone();
+            clearTimeout(finalButtonTimeoutID);
+            if (!finalButtonIsClicked) {
+                finalButtonIsClicked = true;
+                document.getElementById('result').textContent = 'PASS: hit testing found #finalTarget after select interaction';
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }
         }
 
-        async function tryTapOnButton(target)
+        async function tryTapOnFirstButton()
         {
-            var point = getPointInsideElement(document.getElementById(target), 10, 10);
-            await tapAtPoint(point.x, point.y);
+            var firstPoint = getPointInsideElement(document.getElementById('firstTarget'), 10, 10);
+            await tapAtPoint(firstPoint.x, firstPoint.y);
             
             // We have to keep retrying, because the dimming view behind the popover animates out,
             // and we currently have no callback when that animation completes.
-            window.setTimeout(tryTapOnButton.bind(this, target), 100);
+            if (!firstButtonIsClicked)
+                firstButtonTimeoutID = window.setTimeout(tryTapOnFirstButton, 100);
         }
+    
+        async function tryTapOnFinalButton()
+        {
+            var finalPoint = getPointInsideElement(document.getElementById('finalTarget'), 10, 10);
+            await tapAtPoint(finalPoint.x, finalPoint.y);
+            
+            // We have to keep retrying, because the dimming view behind the popover animates out,
+            // and we currently have no callback when that animation completes.
+            if (!finalButtonIsClicked)
+                finalButtonTimeoutID = window.setTimeout(tryTapOnFinalButton, 100);
+        }
+    
 
         function doTest()
         {
@@ -105,7 +132,7 @@
                 var point = getPointInsideElement(selectElement, 10, 10);
                 testRunner.runUIScript(getTapOnSelectUIScript(point.x, point.y, 2), function() {
                     document.getElementById('select-value').textContent = selectElement.value;
-                    tryTapOnButton('firstTarget');
+                    tryTapOnFirstButton();
                 });
             });
         }

Modified: branches/safari-605-branch/LayoutTests/fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html (228064 => 228065)


--- branches/safari-605-branch/LayoutTests/fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html	2018-02-05 02:19:06 UTC (rev 228064)
+++ branches/safari-605-branch/LayoutTests/fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html	2018-02-05 02:19:08 UTC (rev 228065)
@@ -30,20 +30,11 @@
         
     </style>
     <script src=""
+    <script src=""
     <script>
         if (window.testRunner)
             testRunner.waitUntilDone();
 
-        function getSingleTapUIScript(x, y)
-        {
-            return `
-                (function() {
-                    uiController.singleTapAtPoint(${x}, ${y}, function() {
-                        uiController.uiScriptComplete('');
-                    });
-                })();`
-        }
-
         function getScrollDownUIScript(x, y)
         {
             return `
@@ -74,22 +65,27 @@
         }
 
         var clicked = false;
+        var timeoutID;
         function buttonClicked()
         {
-            document.getElementById('result').textContent = 'PASS: hit testing found #target after select interaction';
-            if (window.testRunner)
-                testRunner.notifyDone();
+            window.clearTimeout(timeoutID);
+            if (!clicked) {
+                clicked = true;
+                document.getElementById('result').textContent = 'PASS: hit testing found #target after select interaction';
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }
         }
 
-        function tryTapOnButton()
+        async function tryTapOnButton()
         {
             var point = getPointInsideElement(document.getElementById('target'), 10, 10);
-            testRunner.runUIScript(getSingleTapUIScript(point.x, point.y), function() {
-            });
-            
+            await tapAtPoint(point.x, point.y);
+
             // We have to keep retrying, because the dimming view behind the popover animates out,
             // and we currently have no callback when that animation completes.
-            window.setTimeout(tryTapOnButton, 100);
+            if (!clicked)
+                timeoutID = window.setTimeout(tryTapOnButton, 100);
         }
 
         function doTest()
@@ -96,7 +92,6 @@
         {
             if (!window.testRunner)
                 return;
-
             testRunner.waitUntilDone();
             testRunner.dumpAsText();
 
@@ -111,6 +106,7 @@
         }
         
         window.addEventListener('load', doTest, false);
+        
     </script>
 </head>
 <body>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to