<!DOCTYPE HTML>
<button>Launch</button>
<script>
let button = document.querySelector("button");
button.addEventListener("click", function(e) {
  let newWindow = window.open("", "", "newWindow");
  newWindow.document.write(`<!DOCTYPE HTML>
    <button>click me!</button>
    <script>
      let button = document.querySelector("button");
      button.addEventListener("click", function(e) {
        document.documentElement.requestFullscreen();
        setTimeout(() => {
          while(true) {
            // slowdown event loop
          };
        }, 1);
        location.href = "https://example.org/browser/dom/base/test/fullscreen/dummy_page.html";
      });
    <\/script>`);
});
</script>
