mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb: Make iframe insertion steps check the shadow including root
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.
This commit is contained in:
parent
6df4e5f5e7
commit
4dd14d812f
Notes:
github-actions[bot]
2024-11-13 13:40:57 +00:00
Author: https://github.com/Lubrsi
Commit: 4dd14d812f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2310
3 changed files with 46 additions and 10 deletions
|
@ -0,0 +1,25 @@
|
|||
<!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>
|
Loading…
Add table
Add a link
Reference in a new issue