Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /domparsing/move-head-during-prepend-before-close-crash.html - WPT Dashboard Interop Dashboard
<!doctype html>
<html class="test-wait">
<meta charset="utf-8" />
<title>Closing streamHTML on documentElement while head is detached</title>
<body>
<script>
(async () => {
try {
if (!("streamHTML" in document.documentElement)) {
return;
}
// Previously a crash repro when streamPrependHTML() was allowed on the
// html element and head was removed before close(); now throws
// HierarchyRequestError.
try {
const writer = document.documentElement.streamPrependHTML().getWriter();
document.head?.remove();
await writer.close();
} catch (e) {}
const writer = document.documentElement.streamHTML().getWriter();
await writer.write("<head></head>");
document.head?.remove();
await writer.close();
} finally {
document.documentElement.classList.remove("test-wait");
}
})();
</script>
</body>
</html>