summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/streams/transferable/gc-crash.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/streams/transferable/gc-crash.html')
-rw-r--r--testing/web-platform/tests/streams/transferable/gc-crash.html17
1 files changed, 17 insertions, 0 deletions
diff --git a/testing/web-platform/tests/streams/transferable/gc-crash.html b/testing/web-platform/tests/streams/transferable/gc-crash.html
new file mode 100644
index 0000000000..0d331e6be0
--- /dev/null
+++ b/testing/web-platform/tests/streams/transferable/gc-crash.html
@@ -0,0 +1,17 @@
+<!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>