Skip to content

Commit

Permalink
vm: freeze dependencySpecifiers array
Browse files Browse the repository at this point in the history
PR-URL: nodejs#49720
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
  • Loading branch information
aduh95 authored and alexfernandez committed Nov 1, 2023
1 parent 8399e87 commit 1dedee6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/internal/vm/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
ArrayPrototypeIndexOf,
ArrayPrototypeSome,
ObjectDefineProperty,
ObjectFreeze,
ObjectGetPrototypeOf,
ObjectSetPrototypeOf,
ReflectApply,
Expand Down Expand Up @@ -340,9 +341,7 @@ class SourceTextModule extends Module {
if (this[kWrap] === undefined) {
throw new ERR_VM_MODULE_NOT_MODULE();
}
if (this[kDependencySpecifiers] === undefined) {
this[kDependencySpecifiers] = this[kWrap].getStaticDependencySpecifiers();
}
this[kDependencySpecifiers] ??= ObjectFreeze(this[kWrap].getStaticDependencySpecifiers());
return this[kDependencySpecifiers];
}

Expand Down

0 comments on commit 1dedee6

Please sign in to comment.