Debian Codegraph @

testing/web-platform/mozilla/tests/web-animations/web-animations-no-infinite-refresh.html

raw
1 <!doctype html>
2 <script src=/resources/testharness.js></script>
3 <script src=/resources/testharnessreport.js></script>
4 <title>Test that a pending animation doesn't keep vsync running forever</title>
5 <body>
6 <script>
7 function ensureVsyncDisabled() {
8 let wu = SpecialPowers.wrap(window).windowUtils;
9 return new Promise(resolve => {
10 function check() {
11 if (wu.refreshDriverHasPendingTick) {
12 requestIdleCallback(check, {timeout:300});
13 } else {
14 resolve();
15 }
16 }
17 check();
18 })
19 }
20
21 promise_test(async function() {
22 await ensureVsyncDisabled();
23 let doc = new DOMParser().parseFromString("<div>", "text/html");
24 let anim = doc.querySelector("div").animate(null);
25 assert_true(anim.pending, "Animation should be pending");
26 anim.timeline = document.timeline;
27
28 await ensureVsyncDisabled();
29 assert_true(true, "Vsync should be disabled");
30 });
31 </script>