Title: [259985] trunk/LayoutTests
Revision
259985
Author
[email protected]
Date
2020-04-12 12:04:48 -0700 (Sun, 12 Apr 2020)

Log Message

fast/dom/timer-throttling-hidden-page.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=210355
<rdar://problem/61462972>

Reviewed by Sam Weinig.

The test was changing the page's visiblity to 'hidden' using testRunner.setPageVisibility("hidden")
in the first timer call and then expecting that by the 5th timer iteration, the page would actually
be hidden for timer throtting to kick in. While this happen to work most of the time, this would
cause flakiness because testRunner.setPageVisibility("hidden") involves an async IPC to the
UIProcess and then an IPC back to the WebProcess to update the page's activity state.

To address the issue, we now listen for the 'visibilitychange' event and only start the test / timer
once document.hidden actually returns true.

* fast/dom/timer-throttling-hidden-page.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (259984 => 259985)


--- trunk/LayoutTests/ChangeLog	2020-04-12 18:32:07 UTC (rev 259984)
+++ trunk/LayoutTests/ChangeLog	2020-04-12 19:04:48 UTC (rev 259985)
@@ -1,3 +1,22 @@
+2020-04-12  Chris Dumez  <[email protected]>
+
+        fast/dom/timer-throttling-hidden-page.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=210355
+        <rdar://problem/61462972>
+
+        Reviewed by Sam Weinig.
+
+        The test was changing the page's visiblity to 'hidden' using testRunner.setPageVisibility("hidden")
+        in the first timer call and then expecting that by the 5th timer iteration, the page would actually
+        be hidden for timer throtting to kick in. While this happen to work most of the time, this would
+        cause flakiness because testRunner.setPageVisibility("hidden") involves an async IPC to the
+        UIProcess and then an IPC back to the WebProcess to update the page's activity state.
+
+        To address the issue, we now listen for the 'visibilitychange' event and only start the test / timer
+        once document.hidden actually returns true.
+
+        * fast/dom/timer-throttling-hidden-page.html:
+
 2020-04-11  Jack Lee  <[email protected]>
 
         Infinite loop in InsertListCommand::doApply()

Modified: trunk/LayoutTests/fast/dom/timer-throttling-hidden-page.html (259984 => 259985)


--- trunk/LayoutTests/fast/dom/timer-throttling-hidden-page.html	2020-04-12 18:32:07 UTC (rev 259984)
+++ trunk/LayoutTests/fast/dom/timer-throttling-hidden-page.html	2020-04-12 19:04:48 UTC (rev 259985)
@@ -1,12 +1,11 @@
 <html>
 <body>
-    <script src=""
+    <script src=""
     <script>
         description('Tests that DOM timers gets throttled on hidden pages once they reach the max nesting level');
         jsTestIsAsync = true;
 
         let timerCount = 0;
-        let isPageVisible = true;
         const timeoutInterval = 10;
         const maxNestingLevel = 5;
         let timerHandle = 0;
@@ -16,7 +15,7 @@
             ++timerCount;
 
             timerHandle = setTimeout(testTimer, timeoutInterval);
-            if (!isPageVisible && timerCount >= maxNestingLevel) {
+            if (timerCount >= maxNestingLevel) {
                 shouldBeTrue("internals.isTimerThrottled(timerHandle)");
                 testRunner.resetPageVisibility();
                 clearTimeout(timerHandle);
@@ -24,11 +23,6 @@
                 return;
             } else
                 shouldBeFalse("internals.isTimerThrottled(timerHandle)");
-
-            if (timerCount == 1) {
-                testRunner.setPageVisibility("hidden");
-                isPageVisible = false;
-            }
         }
 
         function runTest()
@@ -43,9 +37,14 @@
             shouldBeFalse("internals.isTimerThrottled(timerHandle)");
         }
         _onload_ = function() {
-            runTest();
+            document._onvisibilitychange_ = () => {
+                if (!document.hidden)
+                    return;
+                document._onvisibilitychange_ = null;
+                runTest();
+            };
+            testRunner.setPageVisibility("hidden");
         };
     </script>
-    <script src=""
 </body>
 </html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to