From c8322b0826c5b8dbcd3ccd4f78c193376dd231d7 Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Sun, 25 Dec 2022 01:04:08 +0700 Subject: [PATCH] allow gc disposed resources before disposing all resources of stack --- .../core-js/modules/esnext.async-disposable-stack.constructor.js | 1 + packages/core-js/modules/esnext.disposable-stack.constructor.js | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/core-js/modules/esnext.async-disposable-stack.constructor.js b/packages/core-js/modules/esnext.async-disposable-stack.constructor.js index 5d985fbe74e4..48b158ff534d 100644 --- a/packages/core-js/modules/esnext.async-disposable-stack.constructor.js +++ b/packages/core-js/modules/esnext.async-disposable-stack.constructor.js @@ -73,6 +73,7 @@ defineBuiltIns(AsyncDisposableStackPrototype, { var loop = function () { if (i) { var disposeMethod = stack[--i]; + stack[i] = null; try { Promise.resolve(disposeMethod()).then(loop, handleError); } catch (error) { diff --git a/packages/core-js/modules/esnext.disposable-stack.constructor.js b/packages/core-js/modules/esnext.disposable-stack.constructor.js index 0c6eb7dda4b1..b4bf9b156549 100644 --- a/packages/core-js/modules/esnext.disposable-stack.constructor.js +++ b/packages/core-js/modules/esnext.disposable-stack.constructor.js @@ -57,6 +57,7 @@ defineBuiltIns(DisposableStackPrototype, { var suppressed; while (i) { var disposeMethod = stack[--i]; + stack[i] = null; try { disposeMethod(); } catch (errorResult) {