1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:37:35 +00:00

LibWeb: Port supported property names from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-11-21 07:39:58 +13:00 committed by Tim Flynn
parent 66ac0d88a3
commit 629f661e3b
19 changed files with 59 additions and 59 deletions

View file

@ -126,8 +126,8 @@ WebIDL::ExceptionOr<void> LegacyPlatformObject::invoke_indexed_property_setter(J
WebIDL::ExceptionOr<void> LegacyPlatformObject::invoke_named_property_setter(DeprecatedString const& property_name, JS::Value value)
{
// 1. Let creating be true if P is not a supported property name, and false otherwise.
Vector<DeprecatedString> supported_property_names = this->supported_property_names();
bool creating = !supported_property_names.contains_slow(property_name);
Vector<String> supported_property_names = this->supported_property_names();
bool creating = !supported_property_names.contains_slow(MUST(String::from_deprecated_string(property_name)));
// FIXME: We do not have this information at this point, so converting the value is left as an exercise to the inheritor of LegacyPlatformObject.
// 2. Let operation be the operation used to declare the indexed property setter.
@ -219,8 +219,8 @@ JS::ThrowCompletionOr<bool> LegacyPlatformObject::internal_define_own_property(J
// 1. Let creating be true if P is not a supported property name, and false otherwise.
// NOTE: This is in it's own variable to enforce the type.
Vector<DeprecatedString> supported_property_names = this->supported_property_names();
bool creating = !supported_property_names.contains_slow(property_name_as_string);
Vector<String> supported_property_names = this->supported_property_names();
bool creating = !supported_property_names.contains_slow(MUST(String::from_deprecated_string(property_name_as_string)));
// 2. If O implements an interface with the [LegacyOverrideBuiltIns] extended attribute or O does not have an own property named P, then:
// NOTE: Own property lookup has to be done manually instead of using Object::has_own_property, as that would use the overridden internal_get_own_property.
@ -348,7 +348,7 @@ JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> LegacyPlatformObject::interna
// 3. If O supports named properties, then for each P of Os supported property names that is visible according to the named property visibility algorithm, append P to keys.
if (supports_named_properties()) {
for (auto& named_property : supported_property_names()) {
if (TRY(WebIDL::is_named_property_exposed_on_object({ this }, named_property)))
if (TRY(WebIDL::is_named_property_exposed_on_object({ this }, named_property.to_deprecated_string())))
keys.append(JS::PrimitiveString::create(vm, named_property));
}
}
@ -381,7 +381,7 @@ WebIDL::ExceptionOr<JS::Value> LegacyPlatformObject::named_item_value(FlyString
return JS::js_undefined();
}
Vector<DeprecatedString> LegacyPlatformObject::supported_property_names() const
Vector<String> LegacyPlatformObject::supported_property_names() const
{
return {};
}

View file

@ -37,7 +37,7 @@ public:
virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const;
virtual WebIDL::ExceptionOr<JS::Value> named_item_value(FlyString const& name) const;
virtual Vector<DeprecatedString> supported_property_names() const;
virtual Vector<String> supported_property_names() const;
virtual bool is_supported_property_index(u32) const;
// NOTE: These will crash if you make has_named_property_setter return true but do not override these methods.