Skip to content

Truly independent web browser

1.2 KB
Raw Blame
<!DOCTYPE html>
<script src="../include.js"></script>
<script>
    const imageURL = "../wpt-import/images/anim-gr.gif";

    promiseTest(async () => {
        const iframe = document.createElement("iframe");
        const iframeLoaded = new Promise(resolve => iframe.addEventListener("load", resolve, { once: true }));
        iframe.srcdoc = `
            <!DOCTYPE html>
            <style>
                #target {
                    width: 100px;
                    height: 50px;
                    background-image: url("${imageURL}");
                }
            </style>
            <div id="target"></div>
        `;
        document.body.appendChild(iframe);
        await iframeLoaded;

        internals.dumpLayoutTree(iframe.contentDocument);

        let topDocumentHasAnimationState = true;
        try {
            internals.imageAnimationStateForURL(imageURL);
        } catch {
            topDocumentHasAnimationState = false;
        }

        println(`top document has animation state: ${topDocumentHasAnimationState}`);
        println(`iframe document timer active: ${iframe.contentWindow.internals.imageAnimationStateForURL(imageURL).isAnimating}`);
    });
</script>