diff --git a/Libraries/LibWeb/Bindings/PlatformObject.cpp b/Libraries/LibWeb/Bindings/PlatformObject.cpp index a014d4d237a..21db9d458ab 100644 --- a/Libraries/LibWeb/Bindings/PlatformObject.cpp +++ b/Libraries/LibWeb/Bindings/PlatformObject.cpp @@ -296,7 +296,7 @@ JS::ThrowCompletionOr PlatformObject::internal_define_own_property(JS::Pro precomputed_get_own_property = &get_own_property_result; } } - if (m_legacy_platform_object_flags->has_legacy_override_built_ins_interface_extended_attribute || precomputed_get_own_property->has_value()) { + if (m_legacy_platform_object_flags->has_legacy_override_built_ins_interface_extended_attribute || !precomputed_get_own_property->has_value()) { // 1. If creating is false and O does not implement an interface with a named property setter, then return false. if (!creating && !m_legacy_platform_object_flags->has_named_property_setter) return false; diff --git a/Tests/LibWeb/Text/expected/htmlcollection-property-set-existing.txt b/Tests/LibWeb/Text/expected/htmlcollection-property-set-existing.txt new file mode 100644 index 00000000000..24f848531c8 --- /dev/null +++ b/Tests/LibWeb/Text/expected/htmlcollection-property-set-existing.txt @@ -0,0 +1,2 @@ +[Pass] Object.defineProperty(HTMLCollection, key, value) throws +[Pass] "use strict"; HTMLCollection[key] setter throws diff --git a/Tests/LibWeb/Text/expected/wpt-import/dom/collections/HTMLCollection-supported-property-names.txt b/Tests/LibWeb/Text/expected/wpt-import/dom/collections/HTMLCollection-supported-property-names.txt new file mode 100644 index 00000000000..c21f10fd960 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/dom/collections/HTMLCollection-supported-property-names.txt @@ -0,0 +1,11 @@ +Harness status: OK + +Found 6 tests + +6 Pass +Pass Object.getOwnPropertyNames on HTMLCollection +Pass Object.getOwnPropertyNames on HTMLCollection with non-HTML namespace +Pass Object.getOwnPropertyNames on HTMLCollection with expando object +Pass Trying to set an expando that would shadow an already-existing named property +Pass Trying to set an expando that shadows a named property that gets added later +Pass Trying to set a non-configurable expando that shadows a named property that gets added later \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/htmlcollection-property-set-existing.html b/Tests/LibWeb/Text/input/htmlcollection-property-set-existing.html new file mode 100644 index 00000000000..2c7eceebb75 --- /dev/null +++ b/Tests/LibWeb/Text/input/htmlcollection-property-set-existing.html @@ -0,0 +1,23 @@ + + + + + + diff --git a/Tests/LibWeb/Text/input/wpt-import/dom/collections/HTMLCollection-supported-property-names.html b/Tests/LibWeb/Text/input/wpt-import/dom/collections/HTMLCollection-supported-property-names.html new file mode 100644 index 00000000000..6286e369bf0 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/dom/collections/HTMLCollection-supported-property-names.html @@ -0,0 +1,135 @@ + + + + + + +
+ + + + + + + + + + + + + + + + + +