From 7b8004c34e29dc2473dfd94793ea27fe206e3c65 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Tue, 19 Jul 2022 20:39:35 -0700 Subject: [PATCH 1/4] fix: avoid override by assignment --- lib/internal/process/per_thread.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index 631348dcd3af69..ebe4ddcd3c786b 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -15,6 +15,7 @@ const { Float64Array, NumberMAX_SAFE_INTEGER, ObjectFreeze, + ObjectDefineProperty, ReflectApply, RegExpPrototypeExec, SafeArrayIterator, @@ -371,9 +372,13 @@ 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, { + value: flagSetValues + }); + ObjectDefineProperty(NodeEnvironmentFlagsSet.prototype, 'keys', { + value: flagSetValues + }); ObjectFreeze(NodeEnvironmentFlagsSet.prototype.constructor); ObjectFreeze(NodeEnvironmentFlagsSet.prototype); From 04bc784621f4d2f0bb78af009d3bb1e0eff79c12 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Tue, 19 Jul 2022 20:54:05 -0700 Subject: [PATCH 2/4] fix: lint --- lib/internal/process/per_thread.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index ebe4ddcd3c786b..14aac2ffe36816 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -374,9 +374,11 @@ function buildAllowedFlags() { } const flagSetValues = NodeEnvironmentFlagsSet.prototype.values; ObjectDefineProperty(NodeEnvironmentFlagsSet.prototype, SymbolIterator, { + __proto__: null, value: flagSetValues }); ObjectDefineProperty(NodeEnvironmentFlagsSet.prototype, 'keys', { + __proto__: null, value: flagSetValues }); From 7b8f1ba640bf90d0aa600d14670545643a2e222f Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Wed, 20 Jul 2022 14:01:14 -0700 Subject: [PATCH 3/4] lint rules wants trailing commas Co-authored-by: Antoine du Hamel --- lib/internal/process/per_thread.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index 14aac2ffe36816..38db6560bcc05c 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -375,7 +375,7 @@ function buildAllowedFlags() { const flagSetValues = NodeEnvironmentFlagsSet.prototype.values; ObjectDefineProperty(NodeEnvironmentFlagsSet.prototype, SymbolIterator, { __proto__: null, - value: flagSetValues + value: flagSetValues, }); ObjectDefineProperty(NodeEnvironmentFlagsSet.prototype, 'keys', { __proto__: null, From db45fa63202564d8a574a99e92285ebbe70d02b1 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Wed, 20 Jul 2022 14:01:33 -0700 Subject: [PATCH 4/4] lint rules wants trailing commas Co-authored-by: Antoine du Hamel --- lib/internal/process/per_thread.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index 38db6560bcc05c..c2be274659e6c7 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -379,7 +379,7 @@ function buildAllowedFlags() { }); ObjectDefineProperty(NodeEnvironmentFlagsSet.prototype, 'keys', { __proto__: null, - value: flagSetValues + value: flagSetValues, }); ObjectFreeze(NodeEnvironmentFlagsSet.prototype.constructor);