1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

Revert "LibJS: Get rid of unnecessary work from canonical_numeric_index_string"

This reverts commit 3a184f7841.

This broke a number of test262 tests under "TypedArrayConstructors".
The issue is that the CanonicalNumericIndexString AO should not fail
for inputs like "1.1", despite them not being integral indices.
This commit is contained in:
Andreas Kling 2022-02-13 15:35:15 +01:00
parent b193351a99
commit 4b412e8fee
9 changed files with 105 additions and 61 deletions

View file

@ -2501,7 +2501,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> @class_name@::legacy_pla
if (interface.supports_indexed_properties()) {
// ...and P is an array index, then:
get_own_property_generator.append(R"~~~(
if (IDL::is_an_array_index(property_name)) {
if (IDL::is_an_array_index(global_object, property_name)) {
// 1. Let index be the result of calling ToUint32(P).
u32 index = property_name.as_number();
@ -2776,7 +2776,7 @@ JS::ThrowCompletionOr<bool> @class_name@::internal_set(JS::PropertyKey const& pr
if (interface.indexed_property_setter.has_value()) {
// ...and P is an array index, then:
scoped_generator.append(R"~~~(
if (IDL::is_an_array_index(property_name)) {
if (IDL::is_an_array_index(global_object, property_name)) {
// 1. Invoke the indexed property setter on O with P and V.
TRY(invoke_indexed_property_setter(global_object, impl(), property_name, value));
@ -2821,14 +2821,14 @@ JS::ThrowCompletionOr<bool> @class_name@::internal_set(JS::PropertyKey const& pr
JS::ThrowCompletionOr<bool> @class_name@::internal_define_own_property(JS::PropertyKey const& property_name, JS::PropertyDescriptor const& property_descriptor)
{
[[maybe_unused]] auto& vm = this->vm();
[[maybe_unused]] auto& global_object = this->global_object();
auto& global_object = this->global_object();
)~~~");
// 1. If O supports indexed properties...
if (interface.supports_indexed_properties()) {
// ...and P is an array index, then:
scoped_generator.append(R"~~~(
if (IDL::is_an_array_index(property_name)) {
if (IDL::is_an_array_index(global_object, property_name)) {
// 1. If the result of calling IsDataDescriptor(Desc) is false, then return false.
if (!property_descriptor.is_data_descriptor())
return false;
@ -2940,14 +2940,14 @@ JS::ThrowCompletionOr<bool> @class_name@::internal_define_own_property(JS::Prope
scoped_generator.append(R"~~~(
JS::ThrowCompletionOr<bool> @class_name@::internal_delete(JS::PropertyKey const& property_name)
{
[[maybe_unused]] auto& global_object = this->global_object();
auto& global_object = this->global_object();
)~~~");
// 1. If O supports indexed properties...
if (interface.supports_indexed_properties()) {
// ...and P is an array index, then:
scoped_generator.append(R"~~~(
if (IDL::is_an_array_index(property_name)) {
if (IDL::is_an_array_index(global_object, property_name)) {
// 1. Let index be the result of calling ToUint32(P).
u32 index = property_name.as_number();