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 danielleadams committed Jul 26, 2022
1 parent bbc455c commit 380659d
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,
RegExpPrototypeExec,
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 380659d

Please sign in to comment.