Skip to content

Commit a65ed3e

Browse files
actions-botgithub-actions[bot]
authored andcommitted
build: update distribution
1 parent c2b7389 commit a65ed3e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

dist/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31563,8 +31563,9 @@ const hasFinalizationRegistry = globalThis.FinalizationRegistry && process.versi
3156331563
let registry
3156431564

3156531565
if (hasFinalizationRegistry) {
31566-
registry = new FinalizationRegistry((stream) => {
31567-
if (!stream.locked && !isDisturbed(stream) && !isErrored(stream)) {
31566+
registry = new FinalizationRegistry((weakRef) => {
31567+
const stream = weakRef.deref()
31568+
if (stream && !stream.locked && !isDisturbed(stream) && !isErrored(stream)) {
3156831569
stream.cancel('Response object has been garbage collected').catch(noop)
3156931570
}
3157031571
})
@@ -32055,7 +32056,12 @@ function fromInnerResponse (innerResponse, guard) {
3205532056
setHeadersGuard(response[kHeaders], guard)
3205632057

3205732058
if (hasFinalizationRegistry && innerResponse.body?.stream) {
32058-
registry.register(response, innerResponse.body.stream)
32059+
// If the target (response) is reclaimed, the cleanup callback may be called at some point with
32060+
// the held value provided for it (innerResponse.body.stream). The held value can be any value:
32061+
// a primitive or an object, even undefined. If the held value is an object, the registry keeps
32062+
// a strong reference to it (so it can pass it to the cleanup callback later). Reworded from
32063+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
32064+
registry.register(response, new WeakRef(innerResponse.body.stream))
3205932065
}
3206032066

3206132067
return response

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy