| OLD | NEW |
| (Empty) | |
| 1 <!doctype html> |
| 2 <meta charset=utf-8> |
| 3 <title>multiple calls to requestIdleCallback</title> |
| 4 <script src=/resources/testharness.js></script> |
| 5 <script src=/resources/testharnessreport.js></script> |
| 6 <div id="log"></div> |
| 7 <script> |
| 8 async_test(function (t) { |
| 9 assert_false(document.hidden, "document.hidden must exist and be false to ru
n this test properly"); |
| 10 var counter = 0; |
| 11 function f(c) { |
| 12 assert_equals(counter, c); |
| 13 if (counter === 99) { |
| 14 t.done(); |
| 15 } |
| 16 |
| 17 ++counter; |
| 18 } |
| 19 for (var i = 0; i < 100; ++i) { |
| 20 let j = i; |
| 21 window.requestIdleCallback(t.step_func(function () { f(j) })); |
| 22 } |
| 23 }, "requestIdleCallback callbacks should be invoked in order (called iterative
ly)"); |
| 24 |
| 25 async_test(function (t) { |
| 26 assert_false(document.hidden, "document.hidden must exist and be false to ru
n this test properly"); |
| 27 var counter = 0; |
| 28 |
| 29 function f(c) { |
| 30 assert_equals(counter, c); |
| 31 if (counter === 99) { |
| 32 t.done(); |
| 33 } |
| 34 |
| 35 ++counter; |
| 36 window.requestIdleCallback(t.step_func(function () { f(c + 1) })); |
| 37 } |
| 38 |
| 39 window.requestIdleCallback(t.step_func(function () { f(0) })); |
| 40 }, "requestIdleCallback callbacks should be invoked in order (called recursive
ly)"); |
| 41 </script> |
| OLD | NEW |