Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ext/web): use a non-resource stream for textDecoderStreamCleansUpOnCancel #21181

Merged
merged 4 commits into from
Nov 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
No need for a timer
  • Loading branch information
mmastrac committed Nov 13, 2023
commit 2bdb7390826b1782a1e550a35d3ecd29a066363d
9 changes: 3 additions & 6 deletions cli/tests/unit/text_encoding_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,13 @@ Deno.test(
permissions: { read: true },
},
async function textDecoderStreamCleansUpOnCancel() {
let timeout: number | undefined = undefined;
let cancelled = false;
const readable = new ReadableStream({
start: (controller) => {
controller.enqueue(new Uint8Array(12));
// This will never be called
timeout = setTimeout(() => controller.close());
},
cancel: () => {
clearTimeout(timeout);
timeout = undefined;
cancelled = true;
},
}).pipeThrough(new TextDecoderStream());
const chunks = [];
Expand All @@ -350,6 +347,6 @@ Deno.test(
}
assertEquals(chunks.length, 1);
assertEquals(chunks[0].length, 12);
assertStrictEquals(timeout, undefined);
assertStrictEquals(cancelled, true);
},
);