summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authordavidot <david.tuin@gmail.com>2021-06-21 16:58:39 +0200
committerLinus Groh <mail@linusgroh.de>2021-06-22 20:49:28 +0100
commit91de1135a5918ed29cad58aa8fc8b04a2f5b3ab2 (patch)
tree90f04ff2ff961243cf4900a58b7a50dae1a9de16 /Userland/Libraries
parent733e8472fa107a6d855ed3090d112bd7f33ee161 (diff)
downloadserenity-91de1135a5918ed29cad58aa8fc8b04a2f5b3ab2.zip
LibJS: Fix a number of regressions in the test262 tests
In get_own_properties: Entries which are deleted while iterating need to be skipped In PropertyDescriptor::from_dictionary If the getter/setter is undefined it should still mark it as present
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Object.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp
index 9ba3728e07..01db33c21c 100644
--- a/Userland/Libraries/LibJS/Runtime/Object.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Object.cpp
@@ -57,11 +57,17 @@ PropertyDescriptor PropertyDescriptor::from_dictionary(VM& vm, const Object& obj
return {};
if (getter.is_function())
descriptor.getter = &getter.as_function();
+ if (!getter.is_empty())
+ descriptor.attributes.set_has_getter();
+
auto setter = object.get(vm.names.set);
if (vm.exception())
return {};
if (setter.is_function())
descriptor.setter = &setter.as_function();
+ if (!setter.is_empty())
+ descriptor.attributes.set_has_setter();
+
return descriptor;
}
@@ -326,11 +332,18 @@ MarkedValueList Object::get_own_properties(PropertyKind kind, bool only_enumerab
if (kind == PropertyKind::Key) {
properties.append(property.key.to_value(vm()));
} else if (kind == PropertyKind::Value) {
- properties.append(get(property.key));
+ Value v = get(property.key);
+ // Value may just have been deleted
+ if (!v.is_empty())
+ properties.append(v);
} else {
+ Value val = get(property.key);
+ if (val.is_empty())
+ return;
+
auto* entry_array = Array::create(global_object());
entry_array->define_property(0, property.key.to_value(vm()));
- entry_array->define_property(1, get(property.key));
+ entry_array->define_property(1, val);
properties.append(entry_array);
}
};