buffer-full-inspect-buffer-during-callback.html (1412B)
1 <!DOCTYPE HTML> 2 <html> 3 <head onload> 4 <meta charset="utf-8" /> 5 <title>This test validates the buffer doesn't contain more entries than it should inside onresourcetimingbufferfull callback.</title> 6 <link rel="author" title="Google" href="http://www.google.com/" /> 7 <link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performance-setresourcetimingbuffersize"/> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="resources/resource-loaders.js"></script> 11 <script src="resources/buffer-full-utilities.js"></script> 12 </head> 13 <body> 14 <script> 15 promise_test(async t => { 16 performance.addEventListener('resourcetimingbufferfull', t.step_func(() => { 17 assert_equals(performance.getEntriesByType("resource").length, 1, 18 "resource timing buffer in resourcetimingbufferfull is the size of the limit"); 19 load.xhr_sync(scriptResources[2]); 20 performance.setResourceTimingBufferSize(3); 21 assert_equals(performance.getEntriesByType("resource").length, 1, 22 "A sync request must not be added to the primary buffer just yet, because it is full"); 23 })); 24 await forceBufferFullEvent(); 25 await waitForNextTask(); 26 checkEntries(3); 27 }, "Test that entries in the secondary buffer are not exposed during the callback and before they are copied to the primary buffer"); 28 </script> 29 </body> 30 </html>