<!DOCTYPE html>
<title>Tests one requestAnimationFrame callback cancelling a second</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
async_test(t => {
var secondCallbackId;
var callbackFired = false;
var cancelFired = false;
window.requestAnimationFrame(function() {
cancelFired = true;
window.cancelAnimationFrame(secondCallbackId);
});
secondCallbackId = window.requestAnimationFrame(function() {
callbackFired = true;
});
requestAnimationFrame(function() {
t.step(function() {
assert_false(callbackFired);
assert_true(cancelFired);
});
t.done();
});
}, "Test cancelling a rAF callback from within a second");
</script>