lib: fix TODO in freeze_intrinsics

PR-URL: https://github.com/nodejs/node/pull/43472
Reviewed-By: Guy Bedford <guybedford@gmail.com>
This commit is contained in:
Antoine du Hamel authored and Michaël Zasso committed 2022-07-12 07:41:40 +02:00
1 parent f9c30abcdc
commit deaf4bb5cd
1 file changed
+2 -10
+2 -10
View File
@@ -428,16 +428,8 @@ module.exports = function() {
const descs = ObjectGetOwnPropertyDescriptors(obj);
enqueue(proto);
ArrayPrototypeForEach(ReflectOwnKeys(descs), (name) => {
// TODO: Uncurried form
// TODO: getOwnPropertyDescriptors is guaranteed to return well-formed
// descriptors, but they still inherit from Object.prototype. If
// someone has poisoned Object.prototype to add 'value' or 'get'
// properties, then a simple 'if ("value" in desc)' or 'desc.value'
// test could be confused. We use hasOwnProperty to be sure about
// whether 'value' is present or not, which tells us for sure that
// this is a data property.
const desc = descs[name];
if ('value' in desc) {
if (ObjectPrototypeHasOwnProperty(desc, 'value')) {
// todo uncurried form
enqueue(desc.value);
} else {
@@ -489,7 +481,7 @@ module.exports = function() {
* objects succeed if otherwise possible.
*/
function enableDerivedOverride(obj, prop, desc) {
if ('value' in desc && desc.configurable) {
if (ObjectPrototypeHasOwnProperty(desc, 'value') && desc.configurable) {
const value = desc.value;
function getter() {