| 
									
										
										
										
											2024-07-16 19:19:57 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2024, Mohamed amine Bounya <mobounya@gmail.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <LibWeb/Fetch/Infrastructure/FetchController.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::Fetch::Infrastructure { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://fetch.spec.whatwg.org/#concept-fetch-record
 | 
					
						
							| 
									
										
										
										
											2025-07-29 21:23:30 +02:00
										 |  |  | class FetchRecord final : public JS::Cell { | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC_CELL(FetchRecord, JS::Cell); | 
					
						
							|  |  |  |     GC_DECLARE_ALLOCATOR(FetchRecord); | 
					
						
							| 
									
										
										
										
											2024-07-16 19:19:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     [[nodiscard]] static GC::Ref<FetchRecord> create(JS::VM&, GC::Ref<Infrastructure::Request>); | 
					
						
							|  |  |  |     [[nodiscard]] static GC::Ref<FetchRecord> create(JS::VM&, GC::Ref<Infrastructure::Request>, GC::Ptr<FetchController>); | 
					
						
							| 
									
										
										
										
											2024-07-16 19:19:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     [[nodiscard]] GC::Ref<Infrastructure::Request> request() const { return m_request; } | 
					
						
							|  |  |  |     void set_request(GC::Ref<Infrastructure::Request> request) { m_request = request; } | 
					
						
							| 
									
										
										
										
											2024-07-16 19:19:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     [[nodiscard]] GC::Ptr<FetchController> fetch_controller() const { return m_fetch_controller; } | 
					
						
							|  |  |  |     void set_fetch_controller(GC::Ptr<FetchController> fetch_controller) { m_fetch_controller = fetch_controller; } | 
					
						
							| 
									
										
										
										
											2024-07-16 19:19:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     explicit FetchRecord(GC::Ref<Infrastructure::Request>); | 
					
						
							|  |  |  |     FetchRecord(GC::Ref<Infrastructure::Request>, GC::Ptr<FetchController>); | 
					
						
							| 
									
										
										
										
											2024-07-16 19:19:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual void visit_edges(Visitor&) override; | 
					
						
							| 
									
										
										
										
											2025-07-29 21:23:30 +02:00
										 |  |  |     virtual void finalize() override; | 
					
						
							| 
									
										
										
										
											2024-07-16 19:19:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#concept-request
 | 
					
						
							|  |  |  |     // A fetch record has an associated request (a request)
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC::Ref<Infrastructure::Request> m_request; | 
					
						
							| 
									
										
										
										
											2024-07-16 19:19:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-controller
 | 
					
						
							|  |  |  |     // A fetch record has an associated controller (a fetch controller or null)
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC::Ptr<FetchController> m_fetch_controller { nullptr }; | 
					
						
							| 
									
										
										
										
											2025-07-29 21:23:30 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     IntrusiveListNode<FetchRecord> m_list_node; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     using List = IntrusiveList<&FetchRecord::m_list_node>; | 
					
						
							| 
									
										
										
										
											2024-07-16 19:19:57 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |