mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
LibJS: Fix Object.getOwnPropertyDescriptor() attributes for numeric property
We were getting the attributes of the existing value and then immediately assigned the default attributes instead.
This commit is contained in:
parent
09f8d52b00
commit
614bad86bc
Notes:
sideshowbarker
2024-07-18 19:19:54 +09:00
2 changed files with 11 additions and 3 deletions
|
@ -387,7 +387,6 @@ Optional<PropertyDescriptor> Object::get_own_property_descriptor(const PropertyN
|
|||
return {};
|
||||
value = existing_value.value().value;
|
||||
attributes = existing_value.value().attributes;
|
||||
attributes = default_attributes;
|
||||
} else {
|
||||
auto metadata = shape().lookup(property_name.to_string_or_symbol());
|
||||
if (!metadata.has_value())
|
||||
|
|
|
@ -46,11 +46,13 @@ test("setter property", () => {
|
|||
test("defined property", () => {
|
||||
let o = {};
|
||||
|
||||
Object.defineProperty(o, "foo", {
|
||||
const attributes = {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
value: 10,
|
||||
});
|
||||
};
|
||||
Object.defineProperty(o, "foo", attributes);
|
||||
Object.defineProperty(o, 1, attributes);
|
||||
|
||||
expect(o).not.toHaveConfigurableProperty("foo");
|
||||
expect(o).not.toHaveEnumerableProperty("foo");
|
||||
|
@ -58,4 +60,11 @@ test("defined property", () => {
|
|||
expect(o).toHaveValueProperty("foo", 10);
|
||||
expect(o).not.toHaveGetterProperty("foo");
|
||||
expect(o).not.toHaveSetterProperty("foo");
|
||||
|
||||
expect(o).not.toHaveConfigurableProperty(1);
|
||||
expect(o).not.toHaveEnumerableProperty(1);
|
||||
expect(o).toHaveWritableProperty(1);
|
||||
expect(o).toHaveValueProperty(1, 10);
|
||||
expect(o).not.toHaveGetterProperty(1);
|
||||
expect(o).not.toHaveSetterProperty(1);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue