1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

LibJS: Remove String.prototype.length

A string's length property is supposed to be a regular non-writable,
non-enumerable, non-configurable property on the StringObject instead.
This commit is contained in:
Linus Groh 2021-06-06 16:46:14 +01:00 committed by Andreas Kling
parent fc2673d111
commit 8d7ec28924
5 changed files with 11 additions and 12 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -25,6 +26,13 @@ StringObject::~StringObject()
{
}
void StringObject::initialize(GlobalObject& global_object)
{
auto& vm = this->vm();
Object::initialize(global_object);
define_property(vm.names.length, Value(m_string.string().length()), 0);
}
void StringObject::visit_edges(Cell::Visitor& visitor)
{
Object::visit_edges(visitor);