Skip to content

Commit 1dedee6

Browse files
aduh95alexfernandez
authored andcommitted
vm: freeze dependencySpecifiers array
PR-URL: nodejs#49720 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
1 parent 8399e87 commit 1dedee6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/internal/vm/module.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const {
77
ArrayPrototypeIndexOf,
88
ArrayPrototypeSome,
99
ObjectDefineProperty,
10+
ObjectFreeze,
1011
ObjectGetPrototypeOf,
1112
ObjectSetPrototypeOf,
1213
ReflectApply,
@@ -340,9 +341,7 @@ class SourceTextModule extends Module {
340341
if (this[kWrap] === undefined) {
341342
throw new ERR_VM_MODULE_NOT_MODULE();
342343
}
343-
if (this[kDependencySpecifiers] === undefined) {
344-
this[kDependencySpecifiers] = this[kWrap].getStaticDependencySpecifiers();
345-
}
344+
this[kDependencySpecifiers] ??= ObjectFreeze(this[kWrap].getStaticDependencySpecifiers());
346345
return this[kDependencySpecifiers];
347346
}
348347

0 commit comments

Comments
 (0)