Skip to content

Commit d5bd0db

Browse files
committed
src: fix vm bug for configurable globalThis
Fixes: nodejs#47799
1 parent d4eb03f commit d5bd0db

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/node_contextify.cc

+7-3
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,15 @@ void ContextifyContext::PropertyDefinerCallback(
609609
bool read_only =
610610
static_cast<int>(attributes) &
611611
static_cast<int>(PropertyAttribute::ReadOnly);
612+
bool dont_delete =
613+
static_cast<int>(attributes) &
614+
static_cast<int>(PropertyAttribute::DontDelete);
612615

613-
// If the property is set on the global as read_only, don't change it on
614-
// the global or sandbox.
615-
if (is_declared && read_only)
616+
// If the property is set on the global as neither writable nor
617+
// configurable, don't change it on the global or sandbox.
618+
if (is_declared && read_only && dont_delete) {
616619
return;
620+
}
617621

618622
Local<Object> sandbox = ctx->sandbox();
619623

0 commit comments

Comments
 (0)