LibJS: Use FlyString in PropertyKey instead of DeprecatedFlyString

This required dealing with *substantial* fallout.
This commit is contained in:
Andreas Kling 2025-03-18 18:08:02 -05:00 committed by Andreas Kling
parent fc744e3f3f
commit 46a5710238
Notes: github-actions[bot] 2025-03-24 22:28:26 +00:00
110 changed files with 985 additions and 987 deletions

View file

@ -41,7 +41,7 @@ JS::ThrowCompletionOr<bool> PlatformObject::is_named_property_exposed_on_object(
// 1. If P is not a supported property name of O, then return false.
// NOTE: This is in it's own variable to enforce the type.
if (!is_supported_property_name(MUST(String::from_byte_string(property_key.to_string()))))
if (!is_supported_property_name(property_key.to_string()))
return false;
// 2. If O has an own property named P, then return false.
@ -118,7 +118,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> PlatformObject::legacy_p
// 1. If the result of running the named property visibility algorithm with property name P and object O is true, then:
if (TRY(is_named_property_exposed_on_object(property_name))) {
// FIXME: It's unfortunate that this is done twice, once in is_named_property_exposed_on_object and here.
auto property_name_string = MUST(FlyString::from_deprecated_fly_string(property_name.to_string()));
auto property_name_string = property_name.to_string();
// 1. Let operation be the operation used to declare the named property getter.
// 2. Let value be an uninitialized variable.
@ -236,7 +236,7 @@ JS::ThrowCompletionOr<bool> PlatformObject::internal_set(JS::PropertyKey const&
// 2. If O implements an interface with a named property setter and P is a String, then:
if (m_legacy_platform_object_flags->has_named_property_setter && property_name.is_string()) {
// 1. Invoke the named property setter on O with P and V.
TRY(throw_dom_exception_if_needed(vm, [&] { return invoke_named_property_setter(MUST(String::from_byte_string(property_name.as_string())), value); }));
TRY(throw_dom_exception_if_needed(vm, [&] { return invoke_named_property_setter(property_name.as_string(), value); }));
// 2. Return true.
return true;
@ -282,7 +282,7 @@ JS::ThrowCompletionOr<bool> PlatformObject::internal_define_own_property(JS::Pro
// 2. If O supports named properties, O does not implement an interface with the [Global] extended attribute, P is a String, and P is not an unforgeable property name of O, then:
// FIXME: Check if P is not an unforgeable property name of O
if (m_legacy_platform_object_flags->supports_named_properties && !m_legacy_platform_object_flags->has_global_interface_extended_attribute && property_name.is_string()) {
auto const property_name_as_string = MUST(FlyString::from_deprecated_fly_string(property_name.as_string()));
auto const property_name_as_string = property_name.as_string();
// 1. Let creating be true if P is not a supported property name, and false otherwise.
bool creating = !is_supported_property_name(property_name_as_string);
@ -360,7 +360,7 @@ JS::ThrowCompletionOr<bool> PlatformObject::internal_delete(JS::PropertyKey cons
// 4. Otherwise, operation was defined with an identifier:
// 1. Perform method steps of operation with O as this and « P » as the argument values.
// 2. If operation was declared with a return type of boolean and the steps returned false, then return false.
auto did_deletion_fail = TRY(throw_dom_exception_if_needed(vm, [&] { return delete_value(MUST(String::from_byte_string(property_name_string))); }));
auto did_deletion_fail = TRY(throw_dom_exception_if_needed(vm, [&] { return delete_value(property_name_string); }));
if (!m_legacy_platform_object_flags->named_property_deleter_has_identifier)
VERIFY(did_deletion_fail != DidDeletionFail::NotRelevant);
@ -423,7 +423,7 @@ JS::ThrowCompletionOr<GC::RootVector<JS::Value>> PlatformObject::internal_own_pr
// 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 (m_legacy_platform_object_flags->supports_named_properties) {
for (auto& named_property : supported_property_names()) {
if (TRY(is_named_property_exposed_on_object(named_property.to_deprecated_fly_string())))
if (TRY(is_named_property_exposed_on_object(named_property)))
keys.append(JS::PrimitiveString::create(vm, named_property));
}
}