mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
LibJS: Remove impossible check from Array's native length getter/setter
Since the object rewrite native property getters/setters are always called with the owning object as the this_value, which in this case is an Array object, and as such this checks are always false.
This commit is contained in:
parent
6787e86a3a
commit
e915155ca4
Notes:
sideshowbarker
2024-07-18 10:19:00 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/e915155ca45 Pull-request: https://github.com/SerenityOS/serenity/pull/8478 Reviewed-by: https://github.com/linusg
@ -81,14 +81,6 @@ JS_DEFINE_NATIVE_GETTER(Array::length_getter)
|
||||
if (!this_object)
|
||||
return {};
|
||||
|
||||
// TODO: could be incorrect if receiver/this_value is fixed or changed
|
||||
if (!this_object->is_array()) {
|
||||
auto value = this_object->internal_get(vm.names.length.to_string_or_symbol(), this_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
return value;
|
||||
}
|
||||
|
||||
return Value(this_object->indexed_properties().array_like_size());
|
||||
}
|
||||
|
||||
@ -98,14 +90,6 @@ JS_DEFINE_NATIVE_SETTER(Array::length_setter)
|
||||
if (!this_object)
|
||||
return;
|
||||
|
||||
// TODO: could be incorrect if receiver/this_value is fixed or changed
|
||||
if (!this_object->is_array()) {
|
||||
this_object->define_property(vm.names.length.to_string_or_symbol(), value, default_attributes);
|
||||
if (vm.exception())
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
auto length = value.to_number(global_object);
|
||||
if (vm.exception())
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user