Skip to content

Truly independent web browser

987 B
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<div id="box" style="width: 10px; height: 10px; background: green"></div>
<script>
    // A rendering update's recording flies beside the tasks after it, and the event loop takes it in between two tasks
    // once it has finished.
    asyncTest(async done => {
        const state = await whileRecordingInFlight(() => {
            box.style.backgroundColor = "blue";
        }, state => state);
        println(`state in the next task: ${state}`);
        // The event loop takes the recording in at the first task after the Paint thread has finished it, however
        // long that takes.
        while (internals.frameSchedulerState() !== "idle")
            await nextTask();
        println(`state once released: ${internals.frameSchedulerState()}`);
        await twoFrames();
        println(`color: ${getComputedStyle(box).backgroundColor}`);
        done();
    });
</script>