Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /streams/transferable/gc-crash.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class="test-wait">
<script src="/common/gc.js"></script>
<script type="module">
const b = new ReadableStream({
start(c) {
c.enqueue({}) // the value we will transfer
},
})
const transferred = structuredClone(b, { transfer: [b] })
// Here we request a read, triggering a message transfer
transferred.getReader().read()
// And immediately trigger GC without waiting for the read,
// causing the actual transfer to be done after GC
await garbageCollect()
document.documentElement.classList.remove("test-wait")
</script>