diff options
author | Linus Groh <mail@linusgroh.de> | 2022-09-02 22:47:28 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-09-02 22:47:28 +0100 |
commit | 486775f9fe4fafb15df2d8fbe3276c796595eeec (patch) | |
tree | a94873e29d092283e3b07bd9ac51ccd61aed47e0 /Userland/Libraries/LibJS | |
parent | 455537d31d87146d9a4da77b6e9ebf00b566db0b (diff) | |
download | serenity-486775f9fe4fafb15df2d8fbe3276c796595eeec.zip |
LibJS: Fix incorrect check in ValidateAndApplyPropertyDescriptor
This is an editorial change in the ECMA-262 spec.
See: https://github.com/tc39/ecma262/commit/f0e4ae8
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp | 7 |
1 files 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; |