Skip to content

Commit deaf4bb

Browse files
aduh95targos
authored andcommitted
lib: fix TODO in freeze_intrinsics
PR-URL: #43472 Reviewed-By: Guy Bedford <[email protected]>
1 parent f9c30ab commit deaf4bb

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

lib/internal/freeze_intrinsics.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -428,16 +428,8 @@ module.exports = function() {
428428
const descs = ObjectGetOwnPropertyDescriptors(obj);
429429
enqueue(proto);
430430
ArrayPrototypeForEach(ReflectOwnKeys(descs), (name) => {
431-
// TODO: Uncurried form
432-
// TODO: getOwnPropertyDescriptors is guaranteed to return well-formed
433-
// descriptors, but they still inherit from Object.prototype. If
434-
// someone has poisoned Object.prototype to add 'value' or 'get'
435-
// properties, then a simple 'if ("value" in desc)' or 'desc.value'
436-
// test could be confused. We use hasOwnProperty to be sure about
437-
// whether 'value' is present or not, which tells us for sure that
438-
// this is a data property.
439431
const desc = descs[name];
440-
if ('value' in desc) {
432+
if (ObjectPrototypeHasOwnProperty(desc, 'value')) {
441433
// todo uncurried form
442434
enqueue(desc.value);
443435
} else {
@@ -489,7 +481,7 @@ module.exports = function() {
489481
* objects succeed if otherwise possible.
490482
*/
491483
function enableDerivedOverride(obj, prop, desc) {
492-
if ('value' in desc && desc.configurable) {
484+
if (ObjectPrototypeHasOwnProperty(desc, 'value') && desc.configurable) {
493485
const value = desc.value;
494486

495487
function getter() {

0 commit comments

Comments
 (0)