Skip to content

Commit

Permalink
process: use defineProperty instead of assignment
Browse files Browse the repository at this point in the history
PR-URL: #43907
Fixes: #43496
Refs: endojs/endo#576
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
  • Loading branch information
erights authored and targos committed Aug 1, 2022
1 parent 3c85e0c commit 15da462
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/internal/process/per_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const {
Float64Array,
NumberMAX_SAFE_INTEGER,
ObjectFreeze,
ObjectDefineProperty,
ReflectApply,
RegExpPrototypeTest,
SafeArrayIterator,
Expand Down Expand Up @@ -371,9 +372,15 @@ function buildAllowedFlags() {
return SetPrototypeValues(this[kInternal].set);
}
}
NodeEnvironmentFlagsSet.prototype.keys =
NodeEnvironmentFlagsSet.prototype[SymbolIterator] =
NodeEnvironmentFlagsSet.prototype.values;
const flagSetValues = NodeEnvironmentFlagsSet.prototype.values;
ObjectDefineProperty(NodeEnvironmentFlagsSet.prototype, SymbolIterator, {
__proto__: null,
value: flagSetValues,
});
ObjectDefineProperty(NodeEnvironmentFlagsSet.prototype, 'keys', {
__proto__: null,
value: flagSetValues,
});

ObjectFreeze(NodeEnvironmentFlagsSet.prototype.constructor);
ObjectFreeze(NodeEnvironmentFlagsSet.prototype);
Expand Down

0 comments on commit 15da462

Please sign in to comment.