Bug 1497681 [wpt PR 13437] - Fix flakiness in resource_timing_buffer_full_250, a=testonly
☠☠ backed out by 09dd66ffc95a ☠ ☠
authorNicolas Pena <npm@chromium.org>
Mon, 15 Oct 2018 17:16:27 +0000
changeset 500064 13fb36fc139f40c2b0935fa5a63f290f44fa6181
parent 500063 5cd95aa54d95ab6c1f5d5dcf5143f79ee06a9312
child 500065 4c371bd8765fc77ed27c8288e9e3617f968917cd
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1497681, 13437, 626703, 883837, 1265901, 598896
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1497681 [wpt PR 13437] - Fix flakiness in resource_timing_buffer_full_250, a=testonly Automatic update from web-platform-testsFix flakiness in resource_timing_buffer_full_250 This CL uses document fragments to append scripts faster. Also, we do not need to wait until onload of one script to begin appending the next. Bug: 626703, 883837 Change-Id: I0bc010640793d6a7113d404f2838fd5cfe88ab25 Reviewed-on: https://chromium-review.googlesource.com/c/1265901 Reviewed-by: Timothy Dresser <tdresser@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Cr-Commit-Position: refs/heads/master@{#598896} -- wpt-commits: ed3b742cd294a5d39d40bc4f8271e9ebe864245f wpt-pr: 13437
testing/web-platform/tests/resource-timing/resource_timing_buffer_full_eventually.html
--- a/testing/web-platform/tests/resource-timing/resource_timing_buffer_full_eventually.html
+++ b/testing/web-platform/tests/resource-timing/resource_timing_buffer_full_eventually.html
@@ -11,21 +11,29 @@
 <script>
     const t = async_test("Finite resource timing entries buffer size");
     performance.onresourcetimingbufferfull = t.step_func_done(function() {
     });
     window.onload = t.step_func(
         function() {
             // Scripts appended in JS to ensure setResourceTimingBufferSize is called before.
             let counter = performance.getEntriesByType("resource").length;
-            function appendScript() {
-                const src = "resources/empty.js?" + counter;
-                const script = document.createElement('script');
-                script.type = 'text/javascript';
-                script.onload = function() { ++counter; appendScript()};
-                script.src = src;
-                document.body.appendChild(script);
+            function appendScripts() {
+                const documentFragment = document.createDocumentFragment();
+                // Add 100 elements at a time to avoid page reflow every time.
+                let numScriptsAccumulated = 0;
+                while (numScriptsAccumulated < 100) {
+                    const src = "resources/empty.js?" + counter;
+                    const script = document.createElement('script');
+                    script.type = 'text/javascript';
+                    script.src = src;
+                    documentFragment.appendChild(script);
+                    ++counter;
+                    ++numScriptsAccumulated;
+                }
+                document.body.appendChild(documentFragment);
+                t.step_timeout(appendScripts, 20);
             }
-            appendScript();
+            appendScripts();
         });
 </script>
 </body>
 </html>