Skip to content

Commit

Permalink
process: use defineProperty instead of assignment
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#43907
Fixes: nodejs/node#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 guangwong committed Oct 10, 2022
1 parent 40130cc commit db6a5f2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/internal/process/per_thread.js
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 db6a5f2

Please sign in to comment.