LibWeb: Import ReadableStreamPipeTo synchronous writing tests

This commit is contained in:
Timothy Flynn 2025-04-14 15:32:24 -04:00 committed by Tim Flynn
parent 8599917188
commit 6f6b39ecec
Notes: github-actions[bot] 2025-04-14 20:57:20 +00:00
3 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,6 @@
Harness status: OK
Found 1 tests
1 Fail
Fail enqueue() must not synchronously call write algorithm

View file

@ -0,0 +1,15 @@
<!doctype html>
<meta charset=utf-8>
<script>
self.GLOBAL = {
isWindow: function() { return true; },
isWorker: function() { return false; },
isShadowRealm: function() { return false; },
};
</script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div id=log></div>
<script src="../../streams/piping/general-addition.any.js"></script>

View file

@ -0,0 +1,15 @@
// META: global=window,worker,shadowrealm
'use strict';
promise_test(async t => {
/** @type {ReadableStreamDefaultController} */
var con;
let synchronous = false;
new ReadableStream({ start(c) { con = c }}, { highWaterMark: 0 }).pipeTo(
new WritableStream({ write() { synchronous = true; } })
)
// wait until start algorithm finishes
await Promise.resolve();
con.enqueue();
assert_false(synchronous, 'write algorithm must not run synchronously');
}, "enqueue() must not synchronously call write algorithm");