summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/streams/piping/general-addition.any.js
blob: cf4aa9bea6a1a45e38e00614bb15547e6a9ab33c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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");