Skip to content

Truly independent web browser

1.2 KB
Raw Blame
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
    body { margin: 0; }
    iframe { position: absolute; left: 20px; top: 20px; width: 200px; height: 120px; border: 0; }
    canvas { position: absolute; left: 520px; top: 20px; }
    #over-both { position: absolute; left: 100px; top: 60px; width: 600px; height: 40px; background: rgba(255, 255, 255, 0.5); }
</style>
<iframe id="frame" srcdoc="<body style='margin: 0; background: blue'></body>"></iframe>
<canvas id="canvas" width="200" height="120"></canvas>
<div id="over-both"></div>
<script>
    promiseTest(async () => {
        await new Promise(resolve => {
            // The initial about:blank document is complete too, before the srcdoc document replaces it.
            if (frame.contentDocument && frame.contentDocument.URL === "about:srcdoc" && frame.contentDocument.readyState === "complete") {
                resolve();
                return;
            }
            frame.onload = resolve;
        });
        const context = canvas.getContext("2d");
        context.fillStyle = "blue";
        context.fillRect(0, 0, canvas.width, canvas.height);
        await animationFrame();

        println(internals.dumpDisplayList());
    });
</script>