mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:42:43 +00:00 
			
		
		
		
	 4abdb68655
			
		
	
	
		4abdb68655
		
	
	
	
	
		
			
			This constructor was easily confused with a copy constructor, and it was possible to accidentally copy-construct Objects in at least one way that we dicovered (via generic ThrowCompletionOr construction). This patch adds a mandatory ConstructWithPrototypeTag parameter to the constructor to disambiguate it.
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			723 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			723 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <AK/TypeCasts.h>
 | |
| #include <LibJS/Runtime/Realm.h>
 | |
| #include <LibWeb/Bindings/PlatformObject.h>
 | |
| #include <LibWeb/HTML/Window.h>
 | |
| 
 | |
| namespace Web::Bindings {
 | |
| 
 | |
| PlatformObject::PlatformObject(JS::Realm& realm)
 | |
|     : JS::Object(realm, nullptr)
 | |
| {
 | |
| }
 | |
| 
 | |
| PlatformObject::PlatformObject(JS::Object& prototype)
 | |
|     : JS::Object(ConstructWithPrototypeTag::Tag, prototype)
 | |
| {
 | |
| }
 | |
| 
 | |
| PlatformObject::~PlatformObject() = default;
 | |
| 
 | |
| JS::Realm& PlatformObject::realm() const
 | |
| {
 | |
|     return shape().realm();
 | |
| }
 | |
| 
 | |
| HTML::Window& PlatformObject::global_object() const
 | |
| {
 | |
|     return verify_cast<HTML::Window>(realm().global_object());
 | |
| }
 | |
| 
 | |
| }
 |