1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00
ladybird/Tests/LibWeb/Text/input/HTML/document-readyState-is-initially-complete.html
Luke Wilde f638f84185 LibWeb: Make default document readiness be "complete"
This is required by mini Cloudflare invisible challenges, as it will
only run if the readyState is not "loading". If it is "loading", then
it waits for readystatechange to check that it's not "loading" anymore.

Initial about:blank iframes do not go through the full navigation and
thus don't go through HTMLParser::the_end, which sets the ready state
to something other than "loading". Therefore, the challenge would never
run, as readyState would never change.

Seen on https://discord.com/login
2024-11-20 16:20:28 +01:00

14 lines
986 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<script>
test(() => {
println(`readyState of 'new Document()' should be 'complete': '${new Document().readyState}'`);
println(`readyState of 'document.implementation.createHTMLDocument()' should be 'complete': '${document.implementation.createHTMLDocument().readyState}'`);
println(`readyState of 'document.implementation.createDocument()' should be 'complete': '${document.implementation.createDocument('http://www.w3.org/1999/xhtml', '').readyState}'`);
println(`FIXME: readyState of 'new DOMParser().parseFromString('', 'text/html')' should be 'complete': '${new DOMParser().parseFromString('', 'text/html').readyState}'`);
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
println(`readyState of 'iframe.contentDocument' of initial about:blank iframe should be 'complete': '${iframe.contentDocument.readyState}'`);
});
</script>