mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:42:43 +00:00 
			
		
		
		
	LibJS+LibWeb: Use Object::set_prototype() in more places
This commit is contained in:
		
							parent
							
								
									84c9f3e0d0
								
							
						
					
					
						commit
						ba6e4c7ae1
					
				
					 5 changed files with 5 additions and 10 deletions
				
			
		|  | @ -1568,8 +1568,7 @@ namespace Web::Bindings { | ||||||
| @wrapper_class@::@wrapper_class@(JS::GlobalObject& global_object, @fully_qualified_name@& impl) | @wrapper_class@::@wrapper_class@(JS::GlobalObject& global_object, @fully_qualified_name@& impl) | ||||||
|     : @wrapper_base_class@(global_object, impl) |     : @wrapper_base_class@(global_object, impl) | ||||||
| { | { | ||||||
|     auto success = internal_set_prototype_of(&static_cast<WindowObject&>(global_object).ensure_web_prototype<@prototype_class@>("@name@")).release_value(); |     set_prototype(&static_cast<WindowObject&>(global_object).ensure_web_prototype<@prototype_class@>("@name@")); | ||||||
|     VERIFY(success); |  | ||||||
| } | } | ||||||
| )~~~"); | )~~~"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -82,7 +82,7 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object) | ||||||
|             break; |             break; | ||||||
|         case FunctionKind::Generator: |         case FunctionKind::Generator: | ||||||
|             // prototype is "g1.prototype" in figure-2 (https://tc39.es/ecma262/img/figure-2.png)
 |             // prototype is "g1.prototype" in figure-2 (https://tc39.es/ecma262/img/figure-2.png)
 | ||||||
|             (void)prototype->internal_set_prototype_of(global_object.generator_object_prototype()); |             set_prototype(global_object.generator_object_prototype()); | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|         define_direct_property(vm.names.prototype, prototype, Attribute::Writable); |         define_direct_property(vm.names.prototype, prototype, Attribute::Writable); | ||||||
|  |  | ||||||
|  | @ -142,8 +142,7 @@ void GlobalObject::initialize_global_object() | ||||||
| 
 | 
 | ||||||
|     static_cast<ObjectPrototype*>(m_object_prototype)->initialize(*this); |     static_cast<ObjectPrototype*>(m_object_prototype)->initialize(*this); | ||||||
| 
 | 
 | ||||||
|     auto success = Object::internal_set_prototype_of(m_object_prototype).release_value(); |     Object::set_prototype(m_object_prototype); | ||||||
|     VERIFY(success); |  | ||||||
| 
 | 
 | ||||||
|     // This must be initialized before allocating AggregateErrorPrototype, which uses ErrorPrototype as its prototype.
 |     // This must be initialized before allocating AggregateErrorPrototype, which uses ErrorPrototype as its prototype.
 | ||||||
|     m_error_prototype = heap().allocate<ErrorPrototype>(*this, *this); |     m_error_prototype = heap().allocate<ErrorPrototype>(*this, *this); | ||||||
|  |  | ||||||
|  | @ -48,9 +48,7 @@ Object::Object(ConstructWithoutPrototypeTag, GlobalObject& global_object) | ||||||
| Object::Object(Object& prototype) | Object::Object(Object& prototype) | ||||||
| { | { | ||||||
|     m_shape = prototype.global_object().empty_object_shape(); |     m_shape = prototype.global_object().empty_object_shape(); | ||||||
|     // FIXME: Factor out step 9 into a simple prototype setter and use that
 |     set_prototype(&prototype); | ||||||
|     auto success = internal_set_prototype_of(&prototype).release_value(); |  | ||||||
|     VERIFY(success); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Object::Object(Shape& shape) | Object::Object(Shape& shape) | ||||||
|  |  | ||||||
|  | @ -54,8 +54,7 @@ void WindowObject::initialize_global_object() | ||||||
| { | { | ||||||
|     Base::initialize_global_object(); |     Base::initialize_global_object(); | ||||||
| 
 | 
 | ||||||
|     auto success = Object::internal_set_prototype_of(&ensure_web_prototype<EventTargetPrototype>("EventTarget")).release_value(); |     Object::set_prototype(&ensure_web_prototype<EventTargetPrototype>("EventTarget")); | ||||||
|     VERIFY(success); |  | ||||||
| 
 | 
 | ||||||
|     // FIXME: These should be native accessors, not properties
 |     // FIXME: These should be native accessors, not properties
 | ||||||
|     define_direct_property("window", this, JS::Attribute::Enumerable); |     define_direct_property("window", this, JS::Attribute::Enumerable); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Linus Groh
						Linus Groh