From 486775f9fe4fafb15df2d8fbe3276c796595eeec Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 2 Sep 2022 22:47:28 +0100 Subject: [PATCH] LibJS: Fix incorrect check in ValidateAndApplyPropertyDescriptor This is an editorial change in the ECMA-262 spec. See: https://github.com/tc39/ecma262/commit/f0e4ae8 --- Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index 60bbeb9921..429fb63eef 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -282,8 +282,8 @@ bool validate_and_apply_property_descriptor(Object* object, PropertyKey const& p if (!descriptor.is_generic_descriptor() && (descriptor.is_accessor_descriptor() != current->is_accessor_descriptor())) return false; - // d. If IsAccessorDescriptor(Desc) is true, then - if (descriptor.is_accessor_descriptor()) { + // d. If IsAccessorDescriptor(current) is true, then + if (current->is_accessor_descriptor()) { // i. If Desc has a [[Get]] field and SameValue(Desc.[[Get]], current.[[Get]]) is false, return false. if (descriptor.get.has_value() && *descriptor.get != *current->get) return false; @@ -293,8 +293,7 @@ bool validate_and_apply_property_descriptor(Object* object, PropertyKey const& p return false; } // e. Else if current.[[Writable]] is false, then - // FIXME: `current` is not guaranteed to be a data descriptor at this point and may not have a [[Writable]] field (see https://github.com/tc39/ecma262/issues/2761) - else if (current->is_data_descriptor() && !*current->writable) { + else if (!*current->writable) { // i. If Desc has a [[Writable]] field and Desc.[[Writable]] is true, return false. if (descriptor.writable.has_value() && *descriptor.writable) return false;