MCPcopy Create free account
hub / github.com/LadybirdBrowser/ladybird / initialize

Method initialize

Libraries/LibJS/Runtime/ObjectPrototype.cpp:31–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void ObjectPrototype::initialize(Realm& realm)
32{
33 auto& vm = this->vm();
34 Base::initialize(realm);
35 // This must be called after the constructor has returned, so that the below code
36 // can find the ObjectPrototype through normal paths.
37 u8 attr = Attribute::Writable | Attribute::Configurable;
38 define_native_function(realm, vm.names.hasOwnProperty, has_own_property, 1, attr);
39 define_native_function(realm, vm.names.toString, to_string, 0, attr);
40 define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr);
41 define_native_function(realm, vm.names.valueOf, value_of, 0, attr);
42 define_native_function(realm, vm.names.propertyIsEnumerable, property_is_enumerable, 1, attr);
43 define_native_function(realm, vm.names.isPrototypeOf, is_prototype_of, 1, attr);
44
45 // Annex B
46 define_native_function(realm, vm.names.__defineGetter__, define_getter, 2, attr);
47 define_native_function(realm, vm.names.__defineSetter__, define_setter, 2, attr);
48 define_native_function(realm, vm.names.__lookupGetter__, lookup_getter, 1, attr);
49 define_native_function(realm, vm.names.__lookupSetter__, lookup_setter, 1, attr);
50 define_native_accessor(realm, vm.names.__proto__, proto_getter, proto_setter, Attribute::Configurable);
51}
52
53// 10.4.7.1 [[SetPrototypeOf]] ( V ), https://tc39.es/ecma262/#sec-immutable-prototype-exotic-objects-setprototypeof-v
54ThrowCompletionOr<bool> ObjectPrototype::internal_set_prototype_of(Object* prototype)

Callers

nothing calls this directly

Calls 1

initializeFunction · 0.85

Tested by

no test coverage detected