mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-11-04 07:10:57 +00:00 
			
		
		
		
	
		
			
	
	
		
			53 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			53 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * SPDX-License-Identifier: BSD-2-Clause
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma once
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include <LibJS/Heap/Cell.h>
							 | 
						||
| 
								 | 
							
								#include <LibJS/Script.h>
							 | 
						||
| 
								 | 
							
								#include <LibURL/URL.h>
							 | 
						||
| 
								 | 
							
								#include <LibWeb/Forward.h>
							 | 
						||
| 
								 | 
							
								#include <LibWeb/HTML/Scripting/ImportMap.h>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace Web::HTML {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// https://html.spec.whatwg.org/multipage/webappapis.html#import-map-parse-result
							 | 
						||
| 
								 | 
							
								class ImportMapParseResult
							 | 
						||
| 
								 | 
							
								    : public JS::Cell
							 | 
						||
| 
								 | 
							
								    , public JS::Script::HostDefined {
							 | 
						||
| 
								 | 
							
								    JS_CELL(Script, JS::Cell);
							 | 
						||
| 
								 | 
							
								    JS_DECLARE_ALLOCATOR(ImportMapParseResult);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 | 
							
								    virtual ~ImportMapParseResult() override;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    static JS::NonnullGCPtr<ImportMapParseResult> create(JS::Realm& realm, ByteString const& input, URL::URL base_url);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    [[nodiscard]] Optional<ImportMap> const& import_map() const { return m_import_map; }
							 | 
						||
| 
								 | 
							
								    void set_import_map(ImportMap const& value) { m_import_map = value; }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    [[nodiscard]] JS::Value error_to_rethrow() const { return m_error_to_rethrow; }
							 | 
						||
| 
								 | 
							
								    void set_error_to_rethrow(JS::Value value) { m_error_to_rethrow = value; }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    void register_import_map(Window& global);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								protected:
							 | 
						||
| 
								 | 
							
								    ImportMapParseResult();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    virtual void visit_edges(Visitor&) override;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								private:
							 | 
						||
| 
								 | 
							
								    virtual void visit_host_defined_self(JS::Cell::Visitor&) override;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    // https://html.spec.whatwg.org/multipage/webappapis.html#impr-import-map
							 | 
						||
| 
								 | 
							
								    Optional<ImportMap> m_import_map;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    // https://html.spec.whatwg.org/multipage/webappapis.html#impr-error-to-rethrow
							 | 
						||
| 
								 | 
							
								    JS::Value m_error_to_rethrow;
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |