mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-13 18:37:37 +02:00
The insertion steps for iframes were following an old version of the spec, where it was checking if the iframe was "in a document tree", which doesn't cross shadow root boundaries. The spec has since been updated to check the shadow including root instead. This is now needed for Cloudflare Turnstile iframe widgets to appear, as they are now inserted into a shadow root. (cherry picked from commit 4dd14d812f73377cb1efa5a8e8a114912a90b5af)
26 lines
843 B
HTML
26 lines
843 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
asyncTest((done) => {
|
|
const div = document.createElement("div");
|
|
const shadowRoot = div.attachShadow({ mode: "closed" });
|
|
|
|
const iframe = document.createElement("iframe");
|
|
|
|
window.addEventListener("message", (messageEvent) => {
|
|
println(`Received a message: '${messageEvent.data}'`);
|
|
println(`Was it from the shadow root iframe? ${messageEvent.source === iframe.contentWindow}`);
|
|
done();
|
|
});
|
|
|
|
iframe.srcdoc = `
|
|
\u003cscript\u003e
|
|
window.parent.postMessage("Hello from iframe in the shadow root of the just inserted div!");
|
|
\u003c/script\u003e
|
|
`;
|
|
shadowRoot.appendChild(iframe);
|
|
|
|
document.body.appendChild(div);
|
|
});
|
|
</script>
|