| 29 | } |
| 30 | |
| 31 | void 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 |
| 54 | ThrowCompletionOr<bool> ObjectPrototype::internal_set_prototype_of(Object* prototype) |
nothing calls this directly
no test coverage detected