Skip to content

Commit

Permalink
vm: freeze dependencySpecifiers array
Browse files Browse the repository at this point in the history
PR-URL: #49720
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
  • Loading branch information
aduh95 authored Oct 8, 2023
1 parent 54bb691 commit 4038cf0
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 4038cf0

Please sign in to comment.