| <script src="../../resources/js-test-pre.js"></script> |
| var callbackFired = false; |
| function firstRequestAnimationFrame() { |
| return new Promise(resolve => { |
| window.requestAnimationFrame(() => { |
| window.cancelAnimationFrame(secondCallbackId); |
| function secondRequestAnimationFrame() { |
| return new Promise(resolve => { |
| secondCallbackId = window.requestAnimationFrame(() => { |
| setTimeout(resolve, 100); |
| description("Tests one requestAnimationFrame callback cancelling a second"); |
| window.jsTestIsAsync = true; |
| Promise.all([firstRequestAnimationFrame(), secondRequestAnimationFrame()]).then(() => { |
| shouldBeFalse("callbackFired"); |
| shouldBeTrue("cancelFired"); |
| <script src="../../resources/js-test-post.js"></script> |