mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibJS: Object::initialize() overrides must always call base class
This commit is contained in:
parent
cc5cba90db
commit
2fe4285693
Notes:
sideshowbarker
2024-07-19 05:31:27 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2fe4285693d
26 changed files with 52 additions and 26 deletions
|
@ -46,8 +46,9 @@ ArrayPrototype::ArrayPrototype(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void ArrayPrototype::initialize(Interpreter&, GlobalObject&)
|
||||
void ArrayPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
|
||||
define_native_function("filter", filter, 1, attr);
|
||||
|
|
|
@ -39,8 +39,9 @@ BigIntConstructor::BigIntConstructor(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void BigIntConstructor::initialize(Interpreter&, GlobalObject& global_object)
|
||||
void BigIntConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
define_property("prototype", global_object.bigint_prototype(), 0);
|
||||
define_property("length", Value(1), Attribute::Configurable);
|
||||
|
||||
|
|
|
@ -37,8 +37,9 @@ BigIntPrototype::BigIntPrototype(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void BigIntPrototype::initialize(Interpreter&, GlobalObject&)
|
||||
void BigIntPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function("toString", to_string, 0, attr);
|
||||
define_native_function("toLocaleString", to_locale_string, 0, attr);
|
||||
|
|
|
@ -38,8 +38,9 @@ BooleanConstructor::BooleanConstructor(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void BooleanConstructor::initialize(Interpreter&, GlobalObject& global_object)
|
||||
void BooleanConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
define_property("prototype", Value(global_object.boolean_prototype()), 0);
|
||||
define_property("length", Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -37,8 +37,9 @@ BooleanPrototype::BooleanPrototype(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void BooleanPrototype::initialize(Interpreter&, GlobalObject&)
|
||||
void BooleanPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
BooleanObject::initialize(interpreter, global_object);
|
||||
define_native_function("toString", to_string, 0, Attribute::Writable | Attribute::Configurable);
|
||||
define_native_function("valueOf", value_of, 0, Attribute::Writable | Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -39,8 +39,9 @@ BoundFunction::BoundFunction(GlobalObject& global_object, Function& target_funct
|
|||
{
|
||||
}
|
||||
|
||||
void BoundFunction::initialize(Interpreter&, GlobalObject&)
|
||||
void BoundFunction::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Function::initialize(interpreter, global_object);
|
||||
define_property("length", Value(m_length), Attribute::Configurable);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,9 @@ ConsoleObject::ConsoleObject(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void ConsoleObject::initialize(Interpreter&, GlobalObject&)
|
||||
void ConsoleObject::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
define_native_function("log", log);
|
||||
define_native_function("debug", debug);
|
||||
define_native_function("info", info);
|
||||
|
|
|
@ -39,8 +39,9 @@ DateConstructor::DateConstructor(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void DateConstructor::initialize(Interpreter&, GlobalObject& global_object)
|
||||
void DateConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
define_property("prototype", global_object.date_prototype(), 0);
|
||||
define_property("length", Value(7), Attribute::Configurable);
|
||||
|
||||
|
|
|
@ -53,8 +53,9 @@ DatePrototype::DatePrototype(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void DatePrototype::initialize(Interpreter&, GlobalObject&)
|
||||
void DatePrototype::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function("getDate", get_date, 0, attr);
|
||||
define_native_function("getDay", get_day, 0, attr);
|
||||
|
|
|
@ -36,8 +36,9 @@ ErrorConstructor::ErrorConstructor(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void ErrorConstructor::initialize(Interpreter&, GlobalObject& global_object)
|
||||
void ErrorConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
define_property("prototype", global_object.error_prototype(), 0);
|
||||
define_property("length", Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
@ -67,8 +68,9 @@ Value ErrorConstructor::construct(Interpreter& interpreter)
|
|||
: NativeFunction(*global_object.function_prototype()) \
|
||||
{ \
|
||||
} \
|
||||
void ConstructorName::initialize(Interpreter&, GlobalObject& global_object) \
|
||||
void ConstructorName::initialize(Interpreter& interpreter, GlobalObject& global_object) \
|
||||
{ \
|
||||
NativeFunction::initialize(interpreter, global_object); \
|
||||
define_property("prototype", global_object.snake_name##_prototype(), 0); \
|
||||
define_property("length", Value(1), Attribute::Configurable); \
|
||||
} \
|
||||
|
|
|
@ -40,8 +40,9 @@ ErrorPrototype::ErrorPrototype(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void ErrorPrototype::initialize(Interpreter&, GlobalObject&)
|
||||
void ErrorPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_property("name", name_getter, name_setter, attr);
|
||||
define_native_property("message", message_getter, nullptr, attr);
|
||||
|
|
|
@ -40,8 +40,9 @@ FunctionConstructor::FunctionConstructor(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void FunctionConstructor::initialize(Interpreter&, GlobalObject& global_object)
|
||||
void FunctionConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
define_property("prototype", global_object.function_prototype(), 0);
|
||||
define_property("length", Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -43,8 +43,9 @@ FunctionPrototype::FunctionPrototype(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void FunctionPrototype::initialize(Interpreter&, GlobalObject&)
|
||||
void FunctionPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function("apply", apply, 2, attr);
|
||||
define_native_function("bind", bind, 1, attr);
|
||||
|
|
|
@ -42,8 +42,9 @@ JSONObject::JSONObject(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void JSONObject::initialize(Interpreter&, GlobalObject&)
|
||||
void JSONObject::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function("stringify", stringify, 3, attr);
|
||||
define_native_function("parse", parse, 2, attr);
|
||||
|
|
|
@ -39,8 +39,9 @@ MathObject::MathObject(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void MathObject::initialize(Interpreter&, GlobalObject&)
|
||||
void MathObject::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function("abs", abs, 1, attr);
|
||||
define_native_function("random", random, 0, attr);
|
||||
|
|
|
@ -42,8 +42,9 @@ NumberConstructor::NumberConstructor(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void NumberConstructor::initialize(Interpreter&, GlobalObject& global_object)
|
||||
void NumberConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function("isFinite", is_finite, 1, attr);
|
||||
define_native_function("isInteger", is_integer, 1, attr);
|
||||
|
|
|
@ -40,8 +40,9 @@ ObjectConstructor::ObjectConstructor(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void ObjectConstructor::initialize(Interpreter&, GlobalObject& global_object)
|
||||
void ObjectConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
define_property("prototype", global_object.object_prototype(), 0);
|
||||
define_property("length", Value(1), Attribute::Configurable);
|
||||
|
||||
|
|
|
@ -39,8 +39,9 @@ ObjectPrototype::ObjectPrototype(GlobalObject&)
|
|||
{
|
||||
}
|
||||
|
||||
void ObjectPrototype::initialize(Interpreter&, GlobalObject&)
|
||||
void ObjectPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
// This must be called after the constructor has returned, so that the below code
|
||||
// can find the ObjectPrototype through normal paths.
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
|
|
|
@ -38,8 +38,9 @@ ProxyConstructor::ProxyConstructor(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void ProxyConstructor::initialize(Interpreter&, GlobalObject& global_object)
|
||||
void ProxyConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
define_property("prototype", global_object.proxy_prototype(), 0);
|
||||
define_property("length", Value(2), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -80,8 +80,9 @@ ReflectObject::ReflectObject(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void ReflectObject::initialize(Interpreter&, GlobalObject&)
|
||||
void ReflectObject::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function("apply", apply, 3, attr);
|
||||
define_native_function("construct", construct, 2, attr);
|
||||
|
|
|
@ -37,8 +37,9 @@ RegExpConstructor::RegExpConstructor(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void RegExpConstructor::initialize(Interpreter&, GlobalObject& global_object)
|
||||
void RegExpConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
define_property("prototype", global_object.regexp_prototype(), 0);
|
||||
define_property("length", Value(2), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ ScriptFunction::ScriptFunction(GlobalObject& global_object, const FlyString& nam
|
|||
|
||||
void ScriptFunction::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Function::initialize(interpreter, global_object);
|
||||
if (!m_is_arrow_function)
|
||||
define_property("prototype", Object::create_empty(interpreter, global_object), 0);
|
||||
define_native_property("length", length_getter, nullptr, Attribute::Configurable);
|
||||
|
|
|
@ -40,8 +40,9 @@ StringConstructor::StringConstructor(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void StringConstructor::initialize(Interpreter&, GlobalObject& global_object)
|
||||
void StringConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
define_property("prototype", global_object.string_prototype(), 0);
|
||||
define_property("length", Value(1), Attribute::Configurable);
|
||||
|
||||
|
|
|
@ -64,8 +64,9 @@ StringPrototype::StringPrototype(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void StringPrototype::initialize(Interpreter&, GlobalObject&)
|
||||
void StringPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
StringObject::initialize(interpreter, global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
|
||||
define_native_property("length", length_getter, nullptr, 0);
|
||||
|
|
|
@ -39,6 +39,7 @@ SymbolConstructor::SymbolConstructor(GlobalObject& global_object)
|
|||
|
||||
void SymbolConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
NativeFunction::initialize(interpreter, global_object);
|
||||
define_property("prototype", global_object.symbol_prototype(), 0);
|
||||
define_property("length", Value(0), Attribute::Configurable);
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ SymbolPrototype::SymbolPrototype(GlobalObject& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
void SymbolPrototype::initialize(Interpreter&, GlobalObject&)
|
||||
void SymbolPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(interpreter, global_object);
|
||||
define_native_property("description", description_getter, nullptr, Attribute::Configurable);
|
||||
|
||||
define_native_function("toString", to_string, 0, Attribute::Writable | Attribute::Configurable);
|
||||
define_native_function("valueOf", value_of, 0, Attribute::Writable | Attribute::Configurable);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue