mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	 8a3c66d8a6
			
		
	
	
		8a3c66d8a6
		
	
	
	
	
		
			
			These are not associated with a javascript realm, so to avoid confusion about which realm these need to be created in, make all of these objects a GC::Cell, and deal with the fallout.
		
			
				
	
	
		
			35 lines
		
	
	
	
		
			805 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
	
		
			805 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibJS/Runtime/Realm.h>
 | |
| #include <LibWeb/ContentSecurityPolicy/Directives/Directive.h>
 | |
| #include <LibWeb/ContentSecurityPolicy/Directives/DirectiveFactory.h>
 | |
| #include <LibWeb/ContentSecurityPolicy/Directives/SerializedDirective.h>
 | |
| 
 | |
| namespace Web::ContentSecurityPolicy::Directives {
 | |
| 
 | |
| GC_DEFINE_ALLOCATOR(Directive);
 | |
| 
 | |
| Directive::Directive(String name, Vector<String> value)
 | |
|     : m_name(move(name))
 | |
|     , m_value(move(value))
 | |
| {
 | |
| }
 | |
| 
 | |
| GC::Ref<Directive> Directive::clone(GC::Heap& heap) const
 | |
| {
 | |
|     return create_directive(heap, m_name, m_value);
 | |
| }
 | |
| 
 | |
| SerializedDirective Directive::serialize() const
 | |
| {
 | |
|     return SerializedDirective {
 | |
|         .name = m_name,
 | |
|         .value = m_value,
 | |
|     };
 | |
| }
 | |
| 
 | |
| }
 |