Debian Codegraph @

testing/web-platform/tests/streams/transferable/gc-crash.html

raw
1 <!DOCTYPE html>
2 <html class="test-wait">
3 <script src="/common/gc.js"></script>
4 <script type="module">
5 const b = new ReadableStream({
6 start(c) {
7 c.enqueue({}) // the value we will transfer
8 },
9 })
10 const transferred = structuredClone(b, { transfer: [b] })
11 // Here we request a read, triggering a message transfer
12 transferred.getReader().read()
13 // And immediately trigger GC without waiting for the read,
14 // causing the actual transfer to be done after GC
15 await garbageCollect()
16 document.documentElement.classList.remove("test-wait")
17 </script>