| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2023-03-02 23:26:35 +00:00
										 |  |  |  * Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org> | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-02 23:26:35 +00:00
										 |  |  | #include <AK/String.h>
 | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | #include <AK/Vector.h>
 | 
					
						
							| 
									
										
										
										
											2025-02-26 15:46:41 +00:00
										 |  |  | #include <LibGC/CellAllocator.h>
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  | #include <LibGC/Ptr.h>
 | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | #include <LibJS/Forward.h>
 | 
					
						
							|  |  |  | #include <LibJS/Heap/Cell.h>
 | 
					
						
							| 
									
										
										
										
											2025-02-26 15:46:41 +00:00
										 |  |  | #include <LibRequests/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | #include <LibWeb/Fetch/Infrastructure/ConnectionTimingInfo.h>
 | 
					
						
							| 
									
										
										
										
											2025-02-26 15:46:41 +00:00
										 |  |  | #include <LibWeb/HTML/Scripting/SerializedEnvironmentSettingsObject.h>
 | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | #include <LibWeb/HighResolutionTime/DOMHighResTimeStamp.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::Fetch::Infrastructure { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://fetch.spec.whatwg.org/#fetch-timing-info
 | 
					
						
							|  |  |  | class FetchTimingInfo : public JS::Cell { | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC_CELL(FetchTimingInfo, JS::Cell); | 
					
						
							|  |  |  |     GC_DECLARE_ALLOCATOR(FetchTimingInfo); | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     [[nodiscard]] static GC::Ref<FetchTimingInfo> create(JS::VM&); | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp start_time() const { return m_start_time; } | 
					
						
							|  |  |  |     void set_start_time(HighResolutionTime::DOMHighResTimeStamp start_time) { m_start_time = start_time; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp redirect_start_time() const { return m_redirect_start_time; } | 
					
						
							|  |  |  |     void set_redirect_start_time(HighResolutionTime::DOMHighResTimeStamp redirect_start_time) { m_redirect_start_time = redirect_start_time; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp redirect_end_time() const { return m_redirect_end_time; } | 
					
						
							|  |  |  |     void set_redirect_end_time(HighResolutionTime::DOMHighResTimeStamp redirect_end_time) { m_redirect_end_time = redirect_end_time; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp post_redirect_start_time() const { return m_post_redirect_start_time; } | 
					
						
							|  |  |  |     void set_post_redirect_start_time(HighResolutionTime::DOMHighResTimeStamp post_redirect_start_time) { m_post_redirect_start_time = post_redirect_start_time; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp final_service_worker_start_time() const { return m_final_service_worker_start_time; } | 
					
						
							|  |  |  |     void set_final_service_worker_start_time(HighResolutionTime::DOMHighResTimeStamp final_service_worker_start_time) { m_final_service_worker_start_time = final_service_worker_start_time; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp final_network_request_start_time() const { return m_final_network_request_start_time; } | 
					
						
							|  |  |  |     void set_final_network_request_start_time(HighResolutionTime::DOMHighResTimeStamp final_network_request_start_time) { m_final_network_request_start_time = final_network_request_start_time; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp final_network_response_start_time() const { return m_final_network_response_start_time; } | 
					
						
							|  |  |  |     void set_final_network_response_start_time(HighResolutionTime::DOMHighResTimeStamp final_network_response_start_time) { m_final_network_response_start_time = final_network_response_start_time; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-26 15:46:41 +00:00
										 |  |  |     [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp first_interim_network_response_start_time() const { return m_first_interim_network_response_start_time; } | 
					
						
							|  |  |  |     void set_first_interim_network_response_start_time(HighResolutionTime::DOMHighResTimeStamp first_interim_network_response_start_time) { m_first_interim_network_response_start_time = first_interim_network_response_start_time; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  |     [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp end_time() const { return m_end_time; } | 
					
						
							|  |  |  |     void set_end_time(HighResolutionTime::DOMHighResTimeStamp end_time) { m_end_time = end_time; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-23 09:15:35 -07:00
										 |  |  |     [[nodiscard]] Optional<ConnectionTimingInfo> const& final_connection_timing_info() const { return m_final_connection_timing_info; } | 
					
						
							|  |  |  |     void set_final_connection_timing_info(ConnectionTimingInfo final_connection_timing_info) { m_final_connection_timing_info = move(final_connection_timing_info); } | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-02 23:26:35 +00:00
										 |  |  |     [[nodiscard]] Vector<String>& server_timing_headers() { return m_server_timing_headers; } | 
					
						
							|  |  |  |     [[nodiscard]] Vector<String> const& server_timing_headers() const { return m_server_timing_headers; } | 
					
						
							|  |  |  |     void set_server_timing_headers(Vector<String> server_timing_headers) { m_server_timing_headers = move(server_timing_headers); } | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     [[nodiscard]] bool render_blocking() const { return m_render_blocking; } | 
					
						
							|  |  |  |     void set_render_blocking(bool render_blocking) { m_render_blocking = render_blocking; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-26 15:46:41 +00:00
										 |  |  |     void update_final_timings(Requests::RequestTimingInfo const& final_timings, HTML::CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | private: | 
					
						
							|  |  |  |     FetchTimingInfo(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual void visit_edges(JS::Cell::Visitor&) override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-start-time
 | 
					
						
							|  |  |  |     // start time (default 0)
 | 
					
						
							|  |  |  |     //     A DOMHighResTimeStamp.
 | 
					
						
							|  |  |  |     HighResolutionTime::DOMHighResTimeStamp m_start_time { 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-redirect-start-time
 | 
					
						
							|  |  |  |     // redirect start time (default 0)
 | 
					
						
							|  |  |  |     //     A DOMHighResTimeStamp.
 | 
					
						
							|  |  |  |     HighResolutionTime::DOMHighResTimeStamp m_redirect_start_time { 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-redirect-end-time
 | 
					
						
							|  |  |  |     // redirect end time (default 0)
 | 
					
						
							|  |  |  |     //     A DOMHighResTimeStamp.
 | 
					
						
							|  |  |  |     HighResolutionTime::DOMHighResTimeStamp m_redirect_end_time { 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-post-redirect-start-time
 | 
					
						
							|  |  |  |     // post-redirect start time (default 0)
 | 
					
						
							|  |  |  |     //     A DOMHighResTimeStamp.
 | 
					
						
							|  |  |  |     HighResolutionTime::DOMHighResTimeStamp m_post_redirect_start_time { 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-final-service-worker-start-time
 | 
					
						
							|  |  |  |     // final service worker start time (default 0)
 | 
					
						
							|  |  |  |     //     A DOMHighResTimeStamp.
 | 
					
						
							|  |  |  |     HighResolutionTime::DOMHighResTimeStamp m_final_service_worker_start_time { 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-final-network-request-start-time
 | 
					
						
							|  |  |  |     // final network-request start time (default 0)
 | 
					
						
							|  |  |  |     //     A DOMHighResTimeStamp.
 | 
					
						
							|  |  |  |     HighResolutionTime::DOMHighResTimeStamp m_final_network_request_start_time { 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-26 15:46:41 +00:00
										 |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-first-interim-network-response-start-time
 | 
					
						
							|  |  |  |     // first interim network-response start time (default 0)
 | 
					
						
							|  |  |  |     //     A DOMHighResTimeStamp.
 | 
					
						
							|  |  |  |     HighResolutionTime::DOMHighResTimeStamp m_first_interim_network_response_start_time { 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-final-network-response-start-time
 | 
					
						
							|  |  |  |     // final network-response start time (default 0)
 | 
					
						
							|  |  |  |     //     A DOMHighResTimeStamp.
 | 
					
						
							|  |  |  |     HighResolutionTime::DOMHighResTimeStamp m_final_network_response_start_time { 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-end-time
 | 
					
						
							|  |  |  |     // end time (default 0)
 | 
					
						
							|  |  |  |     //     A DOMHighResTimeStamp.
 | 
					
						
							|  |  |  |     HighResolutionTime::DOMHighResTimeStamp m_end_time { 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-final-connection-timing-info
 | 
					
						
							|  |  |  |     // final connection timing info (default null)
 | 
					
						
							|  |  |  |     //     Null or a connection timing info.
 | 
					
						
							| 
									
										
										
										
											2025-01-23 09:15:35 -07:00
										 |  |  |     Optional<ConnectionTimingInfo> m_final_connection_timing_info; | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-server-timing-headers
 | 
					
						
							|  |  |  |     // server-timing headers (default « »)
 | 
					
						
							|  |  |  |     //     A list of strings.
 | 
					
						
							| 
									
										
										
										
											2023-03-02 23:26:35 +00:00
										 |  |  |     Vector<String> m_server_timing_headers; | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // https://fetch.spec.whatwg.org/#fetch-timing-info-render-blocking
 | 
					
						
							|  |  |  |     // render-blocking (default false)
 | 
					
						
							|  |  |  |     //     A boolean.
 | 
					
						
							|  |  |  |     bool m_render_blocking { false }; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  | GC::Ref<FetchTimingInfo> create_opaque_timing_info(JS::VM&, FetchTimingInfo const& timing_info); | 
					
						
							| 
									
										
										
										
											2022-10-13 19:20:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | } |