mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:22:46 +00:00 
			
		
		
		
	 f1367e0e4c
			
		
	
	
		f1367e0e4c
		
	
	
	
	
		
			
			This will let us remove the helpers from Window that simply defer to the Intrinsics that are hanging off the [[HostDefined]] slot on the realm
		
			
				
	
	
		
			38 lines
		
	
	
	
		
			859 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
	
		
			859 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/Weakable.h>
 | |
| #include <LibJS/Heap/GCPtr.h>
 | |
| #include <LibJS/Runtime/Object.h>
 | |
| #include <LibWeb/Forward.h>
 | |
| 
 | |
| namespace Web::Bindings {
 | |
| 
 | |
| #define WEB_PLATFORM_OBJECT(class_, base_class) \
 | |
|     JS_OBJECT(class_, base_class)
 | |
| 
 | |
| // https://webidl.spec.whatwg.org/#dfn-platform-object
 | |
| class PlatformObject
 | |
|     : public JS::Object
 | |
|     , public Weakable<PlatformObject> {
 | |
|     JS_OBJECT(PlatformObject, JS::Object);
 | |
| 
 | |
| public:
 | |
|     virtual ~PlatformObject() override;
 | |
| 
 | |
|     JS::Realm& realm() const;
 | |
| 
 | |
|     // FIXME: This should return a type that works in both window and worker contexts.
 | |
|     HTML::Window& global_object() const;
 | |
| 
 | |
| protected:
 | |
|     explicit PlatformObject(JS::Realm&);
 | |
|     explicit PlatformObject(JS::Object& prototype);
 | |
| };
 | |
| 
 | |
| }
 |