aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-02 16:39:16 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-02 16:39:16 -0700
commit132ab63a32e6f767b96e7cd117281de5a4684ce2 (patch)
treeb2b9d6c158f736657cea71783a7dd2ad9aee323b
parentbfd315fc72749ecd98150de110f2a9cc586c7293 (diff)
downloadbun-132ab63a32e6f767b96e7cd117281de5a4684ce2.tar.gz
bun-132ab63a32e6f767b96e7cd117281de5a4684ce2.tar.zst
bun-132ab63a32e6f767b96e7cd117281de5a4684ce2.zip
Add comment
-rw-r--r--src/bun.js/bindings/CommonJSModuleRecord.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bun.js/bindings/CommonJSModuleRecord.cpp b/src/bun.js/bindings/CommonJSModuleRecord.cpp
index dc58e35aa..11cd7b727 100644
--- a/src/bun.js/bindings/CommonJSModuleRecord.cpp
+++ b/src/bun.js/bindings/CommonJSModuleRecord.cpp
@@ -391,6 +391,8 @@ JSC::SourceCode createCommonJSModule(
// to pass to that and it isn't used directly much, so that
// seems harder to do correctly.
{
+ // We must use a global scope extension or else the JSWithScope will be collected unexpectedly.
+ // https://github.com/oven-sh/issues/3161
globalObject->clearGlobalScopeExtension();
JSWithScope* withScope = JSWithScope::create(vm, globalObject, globalObject->globalScope(), scopeExtensionObject);