Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Long Animation Frame Timing: basic</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/utils.js"></script>
<body>
<h1>Long Animation Frame: user callbacks</h1>
<div id="log"></div>
<script>
test_self_user_callback(t =>
t.step_timeout(() => busy_wait()), "TimerHandler:setTimeout");
test_self_user_callback(() => {
const interval = setInterval(() => {
busy_wait();
clearInterval(interval);
}, 10);
}, "TimerHandler:setInterval");
test_self_user_callback(() =>
requestAnimationFrame(() => busy_wait()), "FrameRequestCallback");
test_self_user_callback(t => {
const element = document.createElement("div");
document.body.appendChild(element);
t.add_cleanup(() => element.remove());
new ResizeObserver((entries, observer) => {
busy_wait(very_long_frame_duration);
observer.disconnect();
}).observe(element);
}, "ResizeObserverCallback");
test_self_user_callback(t => {
const element = document.createElement("div");
element.innerText = "123";
t.add_cleanup(() => element.remove());
new IntersectionObserver((entries, observer) => {
busy_wait(very_long_frame_duration);
observer.disconnect();
}).observe(element);
document.body.appendChild(element);
}, "IntersectionObserverCallback");
test_self_user_callback(t =>
scheduler.postTask(() => busy_wait()), "SchedulerPostTaskCallback");
test_self_user_callback(t => {
new PerformanceObserver(() => busy_wait()).observe(
{type: "navigation", buffered: true});
}, "PerformanceObserverCallback");
</script>
</body>