Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<title>
View transition promise reactions in incoming page should resolve before
the rendering continues (rAF, style/layout etc)
</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
const params = new URLSearchParams(location.search);
switch (params.get("mode") || "test") {
case "test":
promise_test(async t => {
const sequence = await new Promise(resolve => {
window.test_finished = s => { resolve(s) };
const popup = window.open("?mode=old");
t.add_cleanup(() => popup.close());
});
assert_array_equals(sequence, ["pagereveal", "updateCallbackDone", "ready", "rAF", "rAF-microtask", "finished"]);
});
break;
case "old":
onload = () => requestAnimationFrame(() => requestAnimationFrame(() => {
location.replace('?mode=new');
}));
break;
case "new":
const sequence = [];
requestAnimationFrame(() => {
sequence.push("rAF");
Promise.resolve().then(() => {
sequence.push("rAF-microtask");
});
});
addEventListener('pagereveal', event => {
sequence.push("pagereveal");
event.viewTransition.ready.then(() => {
sequence.push("ready");
});
event.viewTransition.updateCallbackDone.then(() => {
sequence.push("updateCallbackDone");
});
event.viewTransition.finished.then(() => {
sequence.push("finished");
window.opener.test_finished(sequence);
});
});
}
</script>
<style>
@view-transition {
navigation: auto;
}
</style>