diff --git a/lib/internal/freeze_intrinsics.js b/lib/internal/freeze_intrinsics.js index cb1d28f4b0feb4..508b071c7c0f88 100644 --- a/lib/internal/freeze_intrinsics.js +++ b/lib/internal/freeze_intrinsics.js @@ -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() {