Skip to content

Commit

Permalink
lib: fix TODO in freeze_intrinsics
Browse files Browse the repository at this point in the history
PR-URL: #43472
Reviewed-By: Guy Bedford <guybedford@gmail.com>
  • Loading branch information
aduh95 authored and targos committed Jul 12, 2022
1 parent f9c30ab commit deaf4bb
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/internal/freeze_intrinsics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit deaf4bb

Please sign in to comment.