<!DOCTYPE html>
<html class="reftest-wait">
<style>
    #test {
        background-color: green;
        width: 100px;
        height: 100px;
    }
</style>
<div id="test"></div>
<script>
test.addEventListener("webkitfullscreenchange", () => {
    test.style.backgroundColor = "red";
});
test.addEventListener("fullscreenchange", () => {
    if (document.fullscreenElement)
        document.exitFullscreen();
    else
        document.documentElement.classList.remove("reftest-wait");
});
if (window.internals) {
    internals.withUserGesture(() => {
        test.requestFullscreen();
    });
}
</script>
</html>
