Title: [264609] trunk
Revision
264609
Author
[email protected]
Date
2020-07-20 12:47:49 -0700 (Mon, 20 Jul 2020)

Log Message

[ iOS macOS ] http/tests/resourceLoadStatistics/grandfathering-database.html is a rare flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=213553
<rdar://problem/64696432>

Reviewed by Darin Adler.

Tools:

Registering to receive an ITP statistics processing callback should be
synchronous, otherwise processing could happen before ITP has
registered that it should be reported to the test runner.

To avoid this mistake in the future, this patch removes the
async version of this call from TestInvocation.cpp, because it should
never be used.

* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
       (WTR::TestRunner::installStatisticsDidModifyDataRecordsCallback):
Update this function to look like
installStatisticsDidScanDataRecordsCallback. It is simpler to let ITP
know to send the callback response when installing the callback
instead of requiring a separate function call.

(WTR::TestRunner::installStatisticsDidScanDataRecordsCallback):
Register for a callback synchronously.

* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
Remove setStatisticsNotifyPagesWhenDataRecordsWereScanned from the idl
file so it does not accidentally get called in a layout test in the
future.

LayoutTests:

Remove unnecessary calls to register for a statistics processing
callback, now that it is done synchronously as a part of the installing function.

* http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html:
* http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html:
* http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html:
* http/tests/resourceLoadStatistics/count-third-party-script-loads.html:
* http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-database.html:
* http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html:
* http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database.html:
* http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script.html:
* http/tests/resourceLoadStatistics/many-inserts-only-insert-once.html:

* http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown-database.html:
* http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown.html:
* http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown-database.html:
* http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown.html:
The testing contents should be part of the callback for setEnableFeature
to ensure setup finishes before the test is run.

* http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-database.html:
* http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout-database.html:
* http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html:
* http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html:
* http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction-database.html:
* http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction.html:
* http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-database.html:
* http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads.html:
* http/tests/resourceLoadStatistics/resources/util.js:
(setEnableFeature):
This call is unnecessary as the parameters are cleared in
WKWebsiteDataStoreStatisticsResetToConsistentState.

* http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html:
* http/tests/webAPIStatistics/font-load-data-collection.html:
* http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html:
* http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html:
* http/tests/websocket/connection-refusal-in-frame-resource-load-statistics.html:
* platform/ios-wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264608 => 264609)


--- trunk/LayoutTests/ChangeLog	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/ChangeLog	2020-07-20 19:47:49 UTC (rev 264609)
@@ -1,3 +1,51 @@
+2020-07-20  Kate Cheney  <[email protected]>
+
+        [ iOS macOS ] http/tests/resourceLoadStatistics/grandfathering-database.html is a rare flaky timeout
+        https://bugs.webkit.org/show_bug.cgi?id=213553
+        <rdar://problem/64696432>
+
+        Reviewed by Darin Adler.
+
+        Remove unnecessary calls to register for a statistics processing
+        callback, now that it is done synchronously as a part of the installing function.
+
+        * http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html:
+        * http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html:
+        * http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html:
+        * http/tests/resourceLoadStatistics/count-third-party-script-loads.html:
+        * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-database.html:
+        * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html:
+        * http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database.html:
+        * http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script.html:
+        * http/tests/resourceLoadStatistics/many-inserts-only-insert-once.html:
+
+        * http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown-database.html:
+        * http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown.html:
+        * http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown-database.html:
+        * http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown.html:
+        The testing contents should be part of the callback for setEnableFeature
+        to ensure setup finishes before the test is run.
+
+        * http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-database.html:
+        * http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout-database.html:
+        * http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html:
+        * http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html:
+        * http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction-database.html:
+        * http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction.html:
+        * http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-database.html:
+        * http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads.html:
+        * http/tests/resourceLoadStatistics/resources/util.js:
+        (setEnableFeature):
+        This call is unnecessary as the parameters are cleared in
+        WKWebsiteDataStoreStatisticsResetToConsistentState.
+
+        * http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html:
+        * http/tests/webAPIStatistics/font-load-data-collection.html:
+        * http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html:
+        * http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html:
+        * http/tests/websocket/connection-refusal-in-frame-resource-load-statistics.html:
+        * platform/ios-wk2/TestExpectations:
+
 2020-07-20  Philippe Normand  <[email protected]>
 
         [GStreamer] Add support for canvas captureStream, tests failing since they were added in r213598

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -29,7 +29,6 @@
                     testRunner.waitUntilDone();
                     setEnableFeature(true, function() {
                         testRunner.setUseITPDatabase(true);
-                        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                         testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                         document.location.hash = "LoadWorker";
                         runTest();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -28,7 +28,6 @@
                 if (window.testRunner && window.internals) {
                     testRunner.waitUntilDone();
                     setEnableFeature(true, function() {
-                        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                         testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                         document.location.hash = "LoadWorker";
                         runTest();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -25,7 +25,6 @@
                     testRunner.waitUntilDone();
                     setEnableFeature(true, function() {
                         testRunner.setUseITPDatabase(true);
-                        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                         testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                         document.location.hash = "step1";
                         runTest();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -24,7 +24,6 @@
                 if (window.testRunner && window.internals) {
                     testRunner.waitUntilDone();
                     setEnableFeature(true, function() {
-                        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                         testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                         document.location.hash = "step1";
                         runTest();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-database.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-database.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-database.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -31,7 +31,6 @@
                 });
                 break;
             case "localhost:8000":
-                testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                 testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                 if (!testRunner.statisticsNotifyObserver())
                     timerHandle = setTimeout(finishTest, 100);

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -31,7 +31,6 @@
                 });
                 break;
             case "localhost:8000":
-                testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                 testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                 if (!testRunner.statisticsNotifyObserver())
                     timerHandle = setTimeout(finishTest, 100);

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -25,7 +25,6 @@
                     testRunner.waitUntilDone();
                     setEnableFeature(true, function() {
                         testRunner.setUseITPDatabase(true);
-                        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                         testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                         document.location.hash = "step1";
                         runTest();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -24,7 +24,6 @@
                 if (window.testRunner && window.internals) {
                     testRunner.waitUntilDone();
                     setEnableFeature(true, function() {
-                        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                         testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                         document.location.hash = "step1";
                         runTest();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/many-inserts-only-insert-once.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/many-inserts-only-insert-once.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/many-inserts-only-insert-once.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -66,7 +66,6 @@
 
     if (window.testRunner) {
         setEnableFeature(true, function() {
-            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
             setUpStatisticsAndContinue();
         });
     }

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown-database.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown-database.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown-database.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -15,45 +15,43 @@
     if (window.testRunner && window.internals) {
         testRunner.setUseITPDatabase(true);
         setEnableFeature(true, function() {
-            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-        });
-    }
+            testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
+                if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
+                    testFailed("Host did not get set as prevalent resource.");
 
-    testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
-        if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
-            testFailed("Host did not get set as prevalent resource.");
+                testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() {
+                    if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                        testFailed("Host did not get cleared of user interaction.");
 
-        testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() {
-            if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
-                testFailed("Host did not get cleared of user interaction.");
+                    testInput = document.getElementById("testInput");
 
-            testInput = document.getElementById("testInput");
+                    testRunner.installStatisticsDidModifyDataRecordsCallback(function() {
+                        shouldBeEqualToString("testInput.value", "a");
 
-            testRunner.installStatisticsDidModifyDataRecordsCallback(function() {
-                shouldBeEqualToString("testInput.value", "a");
+                        if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                            testFailed("Origin did not get user interaction credit.");
+                        else
+                            testPassed("Origin was granted user interaction.");
 
-                if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
-                    testFailed("Origin did not get user interaction credit.");
-                else
-                    testPassed("Origin was granted user interaction.");
+                        setTimeout(function() {
+                            testFrame.src = ""
+                            setTimeout(function() {
+                                setEnableFeature(false, finishJSTest);
+                            }, 0);
+                        }, 0);
+                    });
+                    testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
+                    testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
+                    testRunner.statisticsProcessStatisticsAndDataRecords();
 
-                setTimeout(function() {
-                    testFrame.src = ""
-                    setTimeout(function() {
-                        setEnableFeature(false, finishJSTest);
-                    }, 0);
-                }, 0);
+                    debug("Simulate user typing letter 'a' into the field.");
+                    testInput.focus();
+                    if (window.eventSender)
+                        eventSender.keyDown("a");
+                });
             });
-            testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-            testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
-            testRunner.statisticsProcessStatisticsAndDataRecords();
-
-            debug("Simulate user typing letter 'a' into the field.");
-            testInput.focus();
-            if (window.eventSender)
-                eventSender.keyDown("a");
         });
-    });
+    }
 }
 </script>
 <iframe id="testFrame" src=""

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -14,45 +14,43 @@
 
     if (window.testRunner && window.internals) {
         setEnableFeature(true, function() {
-            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-        });
-    }
+            testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
+                if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
+                    testFailed("Host did not get set as prevalent resource.");
 
-    testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
-        if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
-            testFailed("Host did not get set as prevalent resource.");
+                testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() {
+                    if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                        testFailed("Host did not get cleared of user interaction.");
 
-        testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() {
-            if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
-                testFailed("Host did not get cleared of user interaction.");
+                    testInput = document.getElementById("testInput");
 
-            testInput = document.getElementById("testInput");
+                    testRunner.installStatisticsDidModifyDataRecordsCallback(function() {
+                        shouldBeEqualToString("testInput.value", "a");
 
-            testRunner.installStatisticsDidModifyDataRecordsCallback(function() {
-                shouldBeEqualToString("testInput.value", "a");
+                        if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                            testFailed("Origin did not get user interaction credit.");
+                        else
+                            testPassed("Origin was granted user interaction.");
 
-                if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
-                    testFailed("Origin did not get user interaction credit.");
-                else
-                    testPassed("Origin was granted user interaction.");
+                        setTimeout(function() {
+                            testFrame.src = ""
+                            setTimeout(function() {
+                                setEnableFeature(false, finishJSTest);
+                            }, 0);
+                        }, 0);
+                    });
+                    testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
+                    testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
+                    testRunner.statisticsProcessStatisticsAndDataRecords();
 
-                setTimeout(function() {
-                    testFrame.src = ""
-                    setTimeout(function() {
-                        setEnableFeature(false, finishJSTest);
-                    }, 0);
-                }, 0);
+                    debug("Simulate user typing letter 'a' into the field.");
+                    testInput.focus();
+                    if (window.eventSender)
+                        eventSender.keyDown("a");
+                });
             });
-            testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-            testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
-            testRunner.statisticsProcessStatisticsAndDataRecords();
-
-            debug("Simulate user typing letter 'a' into the field.");
-            testInput.focus();
-            if (window.eventSender)
-                eventSender.keyDown("a");
         });
-    });
+    }
 }
 </script>
 <iframe id="testFrame" src=""

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown-database.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown-database.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown-database.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -15,39 +15,38 @@
     if (window.testRunner && window.internals) {
         testRunner.setUseITPDatabase(true);
         setEnableFeature(true, function() {
-            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-        });
-    }
+            testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
+                if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
+                    testFailed("Host did not get set as prevalent resource.");
 
-    testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
-        if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
-            testFailed("Host did not get set as prevalent resource.");
+                testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() {
+                    if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                        testFailed("Host did not get cleared of user interaction.");
 
-        testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() {
-            if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
-                testFailed("Host did not get cleared of user interaction.");
+                    testRunner.installStatisticsDidModifyDataRecordsCallback(function() {
 
-            testRunner.installStatisticsDidModifyDataRecordsCallback(function() {
+                        if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                            testPassed("Origin did not get user interaction credit.");
 
-                if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
-                    testPassed("Origin did not get user interaction credit.");
+                        setTimeout(function() {
+                            testFrame.src = ""
+                            setTimeout(function() {
+                                setEnableFeature(false, finishJSTest);
+                            }, 0);
+                        }, 0);
+                    });
+                    testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
+                    testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
+                    testRunner.statisticsProcessStatisticsAndDataRecords();
 
-                setTimeout(function() {
-                    testFrame.src = ""
-                    setTimeout(function() {
-                        setEnableFeature(false, finishJSTest);
-                    }, 0);
-                }, 0);
+                    debug("Simulate an unhandled user key press.");
+                    if (window.eventSender)
+                        eventSender.keyDown("a", ["metaKey"]);
+                });
             });
-            testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-            testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
-            testRunner.statisticsProcessStatisticsAndDataRecords();
+        });
+    }
 
-            debug("Simulate an unhandled user key press.");
-            if (window.eventSender)
-                eventSender.keyDown("a", ["metaKey"]);
-        });
-    });
 }
 </script>
 <iframe id="testFrame" src=""

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -14,39 +14,37 @@
 
     if (window.testRunner && window.internals) {
         setEnableFeature(true, function() {
-            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-        });
-    }
+            testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
+                if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
+                    testFailed("Host did not get set as prevalent resource.");
 
-    testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
-        if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
-            testFailed("Host did not get set as prevalent resource.");
+                testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() {
+                    if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                        testFailed("Host did not get cleared of user interaction.");
 
-        testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() {
-            if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
-                testFailed("Host did not get cleared of user interaction.");
+                    testRunner.installStatisticsDidModifyDataRecordsCallback(function() {
 
-            testRunner.installStatisticsDidModifyDataRecordsCallback(function() {
+                        if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                            testPassed("Origin did not get user interaction credit.");
 
-                if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
-                    testPassed("Origin did not get user interaction credit.");
+                        setTimeout(function() {
+                            testFrame.src = ""
+                            setTimeout(function() {
+                                setEnableFeature(false, finishJSTest);
+                            }, 0);
+                        }, 0);
+                    });
+                    testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
+                    testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
+                    testRunner.statisticsProcessStatisticsAndDataRecords();
 
-                setTimeout(function() {
-                    testFrame.src = ""
-                    setTimeout(function() {
-                        setEnableFeature(false, finishJSTest);
-                    }, 0);
-                }, 0);
+                    debug("Simulate an unhandled user key press.");
+                    if (window.eventSender)
+                        eventSender.keyDown("a", ["metaKey"]);
+                });
             });
-            testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
-            testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
-            testRunner.statisticsProcessStatisticsAndDataRecords();
-
-            debug("Simulate an unhandled user key press.");
-            if (window.eventSender)
-                eventSender.keyDown("a", ["metaKey"]);
         });
-    });
+    }
 }
 </script>
 <iframe id="testFrame" src=""

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-database.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-database.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-database.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -57,7 +57,6 @@
         if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
             testRunner.setUseITPDatabase(true);
             setEnableFeature(true, function () {
-                testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                 runTestRunnerTest();
             });
         } else {

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout-database.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout-database.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout-database.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -49,7 +49,6 @@
     if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
         testRunner.setUseITPDatabase(true);
         testRunner.waitUntilDone();
-        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
         setEnableFeature(true, runTestRunnerTest);
     }
 </script>

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -48,7 +48,6 @@
     if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
         testRunner.waitUntilDone();
         setEnableFeature(true, function() {
-            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
             runTestRunnerTest();
          });
     }

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -56,7 +56,6 @@
     function setUpAndRun() {
         if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
             setEnableFeature(true, function () {
-                testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                 runTestRunnerTest();
             });
         } else {

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction-database.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction-database.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction-database.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -51,7 +51,6 @@
         testRunner.waitUntilDone();
         testRunner.setUseITPDatabase(true);
         setEnableFeature(true, function() {
-            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
             runTestRunnerTest();
         });
     }

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -51,7 +51,6 @@
     if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
         testRunner.waitUntilDone();
         setEnableFeature(true, function() {
-            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
             runTestRunnerTest();
         });
     }

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-database.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-database.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-database.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -33,7 +33,6 @@
                     testRunner.waitUntilDone();
                     testRunner.setUseITPDatabase(true);
                     setEnableFeature(true, function() {
-                        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                         testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                         document.location.hash = "step1";
                         runTest();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -26,7 +26,6 @@
                 if (window.testRunner && window.internals) {
                     testRunner.waitUntilDone();
                     setEnableFeature(true, function() {
-                        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                         testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                         document.location.hash = "step1";
                         runTest();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js (264608 => 264609)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js	2020-07-20 19:47:49 UTC (rev 264609)
@@ -9,7 +9,6 @@
         testRunner.statisticsResetToConsistentState(function() {
             testRunner.setStatisticsIsRunningTest(false);
             internals.setResourceLoadStatisticsEnabled(false);
-            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(false);
             completionHandler();
         });
     }

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -19,8 +19,6 @@
     }
 
     function runTestRunnerTest() {
-        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-
         testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
     
         var canvas = document.createElement('canvas');

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -19,8 +19,6 @@
     }
 
     function runTestRunnerTest() {
-        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-
         testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
 
         var body = document.getElementsByTagName('body')[0]

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -19,8 +19,6 @@
     }
 
     function runTestRunnerTest() {
-        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-
         testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
     
         var useragent = navigator.userAgent;

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -19,8 +19,6 @@
     }
 
     function runTestRunnerTest() {
-        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-
         testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
     
         var availTop = screen.availTop;

Modified: trunk/LayoutTests/http/tests/websocket/connection-refusal-in-frame-resource-load-statistics.html (264608 => 264609)


--- trunk/LayoutTests/http/tests/websocket/connection-refusal-in-frame-resource-load-statistics.html	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/http/tests/websocket/connection-refusal-in-frame-resource-load-statistics.html	2020-07-20 19:47:49 UTC (rev 264609)
@@ -37,7 +37,6 @@
             iframeElement.id = "testIframe";
             document.body.appendChild(iframeElement);
 
-            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
             testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
         });
     }

Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (264608 => 264609)


--- trunk/LayoutTests/platform/ios-wk2/TestExpectations	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations	2020-07-20 19:47:49 UTC (rev 264609)
@@ -1768,8 +1768,6 @@
 
 webkit.org/b/213520 perf/htmlcollection-backwards-iteration.html [ Pass Failure ]
 
-webkit.org/b/213553 http/tests/resourceLoadStatistics/grandfathering-database.html [ Pass Timeout ]
-
 webkit.org/b/21365 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/intrinsic_sizes.htm [ Pass Failure ]
 
 webkit.org/b/214084 [ Release ] webrtc/libwebrtc/descriptionGetters.html [ Pass Failure ]

Modified: trunk/Tools/ChangeLog (264608 => 264609)


--- trunk/Tools/ChangeLog	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/Tools/ChangeLog	2020-07-20 19:47:49 UTC (rev 264609)
@@ -1,3 +1,36 @@
+2020-07-20  Kate Cheney  <[email protected]>
+
+        [ iOS macOS ] http/tests/resourceLoadStatistics/grandfathering-database.html is a rare flaky timeout
+        https://bugs.webkit.org/show_bug.cgi?id=213553
+        <rdar://problem/64696432>
+
+        Reviewed by Darin Adler.
+
+        Registering to receive an ITP statistics processing callback should be
+        synchronous, otherwise processing could happen before ITP has
+        registered that it should be reported to the test runner.
+
+        To avoid this mistake in the future, this patch removes the
+        async version of this call from TestInvocation.cpp, because it should
+        never be used.
+
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+       (WTR::TestRunner::installStatisticsDidModifyDataRecordsCallback):
+        Update this function to look like
+        installStatisticsDidScanDataRecordsCallback. It is simpler to let ITP
+        know to send the callback response when installing the callback
+        instead of requiring a separate function call.
+
+        (WTR::TestRunner::installStatisticsDidScanDataRecordsCallback):
+        Register for a callback synchronously.
+
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        Remove setStatisticsNotifyPagesWhenDataRecordsWereScanned from the idl
+        file so it does not accidentally get called in a layout test in the
+        future.
+
 2020-07-20  Dean Jackson  <[email protected]>
 
         Adding James Darpinian to contributors.

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (264608 => 264609)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2020-07-20 19:47:49 UTC (rev 264609)
@@ -329,7 +329,6 @@
     void statisticsProcessStatisticsAndDataRecords();
     void statisticsUpdateCookieBlocking(object completionHandler);
     void statisticsSubmitTelemetry();
-    void setStatisticsNotifyPagesWhenDataRecordsWereScanned(boolean value);
     void setStatisticsIsRunningTest(boolean value);
     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(boolean value);
     void setStatisticsMinimumTimeBetweenDataRecordsRemoval(double seconds);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (264608 => 264609)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2020-07-20 19:47:49 UTC (rev 264609)
@@ -2084,7 +2084,11 @@
 
 void TestRunner::installStatisticsDidModifyDataRecordsCallback(JSValueRef callback)
 {
-    cacheTestRunnerCallback(StatisticsDidModifyDataRecordsCallbackID, callback);
+    if (!!callback) {
+        cacheTestRunnerCallback(StatisticsDidModifyDataRecordsCallbackID, callback);
+        // Setting a callback implies we expect to receive callbacks. So register for them.
+        setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
+    }
 }
 
 void TestRunner::statisticsDidModifyDataRecordsCallback()
@@ -2094,14 +2098,11 @@
 
 void TestRunner::installStatisticsDidScanDataRecordsCallback(JSValueRef callback)
 {
-    cacheTestRunnerCallback(StatisticsDidScanDataRecordsCallbackID, callback);
-
-    bool notifyPagesWhenDataRecordsWereScanned = !!callback;
-
-    // Setting a callback implies we expect to receive callbacks. So register for them.
-    WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("StatisticsNotifyPagesWhenDataRecordsWereScanned"));
-    WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(notifyPagesWhenDataRecordsWereScanned));
-    WKBundlePostMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get());
+    if (!!callback) {
+        cacheTestRunnerCallback(StatisticsDidScanDataRecordsCallbackID, callback);
+        // Setting a callback implies we expect to receive callbacks. So register for them.
+        setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
+    }
 }
 
 void TestRunner::statisticsDidScanDataRecordsCallback()

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (264608 => 264609)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2020-07-20 19:32:38 UTC (rev 264608)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2020-07-20 19:47:49 UTC (rev 264609)
@@ -919,13 +919,6 @@
         return;
     }
 
-    if (WKStringIsEqualToUTF8CString(messageName, "StatisticsNotifyPagesWhenDataRecordsWereScanned")) {
-        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
-        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
-        TestController::singleton().setStatisticsNotifyPagesWhenDataRecordsWereScanned(WKBooleanGetValue(value));
-        return;
-    }
-
     if (WKStringIsEqualToUTF8CString(messageName, "StatisticsClearInMemoryAndPersistentStore")) {
         TestController::singleton().statisticsClearInMemoryAndPersistentStore();
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to