-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2467 from cloudflare/jsnell/internal-streams-abor…
…t-queue
- Loading branch information
Showing
6 changed files
with
130 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { strictEqual } from 'assert'; | ||
|
||
export const abortInternalStreamsTest = { | ||
async test() { | ||
const { writable } = new IdentityTransformStream(); | ||
|
||
const writer = writable.getWriter(); | ||
|
||
const promise = writer.write(new Uint8Array(10)); | ||
|
||
await writer.abort(); | ||
|
||
// The write promise should abort proactively without waiting for a read, | ||
// indicating that the queue was drained proactively when the abort was | ||
// called. | ||
try { | ||
await promise; | ||
throw new Error('The promise should have been rejected'); | ||
} catch (err) { | ||
strictEqual(err, undefined); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Workerd = import "/workerd/workerd.capnp"; | ||
|
||
const unitTests :Workerd.Config = ( | ||
services = [ | ||
( name = "abort-internal-streams-test", | ||
worker = ( | ||
modules = [ | ||
(name = "worker", esModule = embed "abort-internal-streams-test.js") | ||
], | ||
compatibilityDate = "2024-07-01", | ||
compatibilityFlags = ["nodejs_compat_v2", "internal_writable_stream_abort_clears_queue"], | ||
) | ||
), | ||
], | ||
); |
Oops, something went wrong.