| <div style="height: 1000px;"></div> |
| <script src="../../resources/js-test-pre.js"></script> |
| description("Test that requestAnimationFrame gets the right throttling in an iframe when when it's outside the viewport."); |
| internals.setOutsideViewportThrottlingEnabled(true); |
| var iframeFramesPerSecond = 0; |
| window.onmessage = function(e){ |
| if (e.data == 'subFrameRAFMessage') { |
| const frame = document.createElement("iframe"); |
| frame.src = "resources/frame-with-animation-2.html"; |
| frame.onload = function() { |
| function doWork(timestamp) { |
| if (timestamp - start < 1000) { |
| window.requestAnimationFrame(doWork); |
| shouldBeTrue("framesPerSecond > 0"); |
| // The OutsideViewport throttling = 10_s. subFrameRAFMessage |
| // should not ever be received during the first second. |
| shouldBeTrue("iframeFramesPerSecond == 0"); |
| window.requestAnimationFrame(doWork); |
| document.body.appendChild(frame); |
| <script src="../../resources/js-test-post.js"></script> |