-
Notifications
You must be signed in to change notification settings - Fork 530
Open
Description
This is different from #6020: that one is about firing the unhandledrejection event too early for rejections that get handled, this one is about a scenario where leaking rejections don't ever get handled.
For example on the testcase from nodejs/node#58247:
const useFrom = Array.fromAsync // switch to false and it works
let c = 0
globalThis.addEventListener('rejectionhandled', (e) => {
console.log('rejections', --c)
})
globalThis.addEventListener('unhandledrejection', (e) => {
console.log('rejections', ++c)
})
const valid = new Uint8Array([120, 156, 75, 4, 0, 0, 98, 0, 98]) // deflate('a')
const empty = new Uint8Array(1)
const invalid = new Uint8Array([...valid, ...empty])
const double = new Uint8Array([...valid, ...valid])
for (const chunks of [[valid], [invalid], [valid, empty], [valid, valid], [double]]) {
try {
const stream = new Blob(chunks).stream().pipeThrough(new DecompressionStream('deflate'))
console.log(await (useFrom ? Array.fromAsync(stream) : new Response(stream).blob()))
} catch (e) {
console.error(e)
}
}
await new Promise((resolve) => setTimeout(resolve, 200))Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels