| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-10-04 13:19:50 +02:00
										 |  |  |  * Copyright (c) 2022, Andreas Kling <andreas@ladybird.org> | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-21 19:57:33 +00:00
										 |  |  | #include <AK/Optional.h>
 | 
					
						
							|  |  |  | #include <LibJS/Heap/CellAllocator.h>
 | 
					
						
							|  |  |  | #include <LibJS/Heap/GCPtr.h>
 | 
					
						
							| 
									
										
										
										
											2024-10-05 15:33:34 +13:00
										 |  |  | #include <LibURL/Origin.h>
 | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | #include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
 | 
					
						
							| 
									
										
										
										
											2024-04-21 19:57:33 +00:00
										 |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2024-09-18 19:48:22 +02:00
										 |  |  | #include <LibWeb/HTML/CrossOrigin/OpenerPolicy.h>
 | 
					
						
							|  |  |  | #include <LibWeb/HTML/CrossOrigin/OpenerPolicyEnforcementResult.h>
 | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | #include <LibWeb/HTML/PolicyContainers.h>
 | 
					
						
							|  |  |  | #include <LibWeb/HTML/SandboxingFlagSet.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::HTML { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigation-params
 | 
					
						
							| 
									
										
										
										
											2024-04-21 19:57:33 +00:00
										 |  |  | struct NavigationParams : JS::Cell { | 
					
						
							|  |  |  |     JS_CELL(NavigationParams, JS::Cell); | 
					
						
							|  |  |  |     JS_DECLARE_ALLOCATOR(NavigationParams); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-13 14:38:39 +03:00
										 |  |  |     // null or a navigation ID
 | 
					
						
							|  |  |  |     Optional<String> id; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  |     // the navigable to be navigated
 | 
					
						
							| 
									
										
										
										
											2024-04-21 19:57:33 +00:00
										 |  |  |     JS::GCPtr<Navigable> navigable; | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  |     // null or a request that started the navigation
 | 
					
						
							| 
									
										
										
										
											2022-10-30 01:52:07 +00:00
										 |  |  |     JS::GCPtr<Fetch::Infrastructure::Request> request; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // a response that ultimately was navigated to (potentially a network error)
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  |     JS::GCPtr<Fetch::Infrastructure::Response> response; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // null or a fetch controller
 | 
					
						
							|  |  |  |     JS::GCPtr<Fetch::Infrastructure::FetchController> fetch_controller { nullptr }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // null or an algorithm accepting a Document, once it has been created
 | 
					
						
							|  |  |  |     Function<void(DOM::Document&)> commit_early_hints { nullptr }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-18 19:48:22 +02:00
										 |  |  |     // an opener policy enforcement result, used for reporting and potentially for causing a browsing context group switch
 | 
					
						
							|  |  |  |     OpenerPolicyEnforcementResult coop_enforcement_result; | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // null or an environment reserved for the new Document
 | 
					
						
							|  |  |  |     Fetch::Infrastructure::Request::ReservedClientType reserved_environment; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // an origin to use for the new Document
 | 
					
						
							| 
									
										
										
										
											2024-10-05 15:33:34 +13:00
										 |  |  |     URL::Origin origin; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // a policy container to use for the new Document
 | 
					
						
							|  |  |  |     PolicyContainer policy_container; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // a sandboxing flag set to impose on the new Document
 | 
					
						
							| 
									
										
										
										
											2023-08-28 11:57:21 +02:00
										 |  |  |     SandboxingFlagSet final_sandboxing_flag_set = {}; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-18 19:48:22 +02:00
										 |  |  |     // an opener policy to use for the new Document
 | 
					
						
							|  |  |  |     OpenerPolicy opener_policy; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  |     // FIXME: a NavigationTimingType used for creating the navigation timing entry for the new Document
 | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  |     // a URL or null used to populate the new Document's about base URL
 | 
					
						
							| 
									
										
										
										
											2024-03-18 16:22:27 +13:00
										 |  |  |     Optional<URL::URL> about_base_url; | 
					
						
							| 
									
										
										
										
											2024-04-21 19:57:33 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void visit_edges(Visitor& visitor) override; | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  | // https://html.spec.whatwg.org/multipage/browsing-the-web.html#non-fetch-scheme-navigation-params
 | 
					
						
							| 
									
										
										
										
											2024-04-21 19:57:33 +00:00
										 |  |  | struct NonFetchSchemeNavigationParams : JS::Cell { | 
					
						
							|  |  |  |     JS_CELL(NonFetchSchemeNavigationParams, JS::Cell); | 
					
						
							|  |  |  |     JS_DECLARE_ALLOCATOR(NonFetchSchemeNavigationParams); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  |     // null or a navigation ID
 | 
					
						
							|  |  |  |     Optional<String> id; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-05 09:20:05 +03:00
										 |  |  |     // the navigable to be navigated
 | 
					
						
							| 
									
										
										
										
											2024-04-21 19:57:33 +00:00
										 |  |  |     JS::GCPtr<Navigable> navigable; | 
					
						
							| 
									
										
										
										
											2023-04-05 09:20:05 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  |     // a URL
 | 
					
						
							| 
									
										
										
										
											2024-03-18 16:22:27 +13:00
										 |  |  |     URL::URL url; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  |     // the target snapshot params's sandboxing flags present during navigation
 | 
					
						
							|  |  |  |     SandboxingFlagSet target_snapshot_sandboxing_flags = {}; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  |     // a copy of the source snapshot params's has transient activation boolean present during activation
 | 
					
						
							|  |  |  |     bool source_snapshot_has_transient_activation = { false }; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  |     // an origin possibly for use in a user-facing prompt to confirm the invocation of an external software package
 | 
					
						
							| 
									
										
										
										
											2024-10-05 15:33:34 +13:00
										 |  |  |     URL::Origin initiator_origin; | 
					
						
							| 
									
										
										
										
											2023-05-02 07:09:05 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-21 13:47:19 -06:00
										 |  |  |     // FIXME: a NavigationTimingType used for creating the navigation timing entry for the new Document
 | 
					
						
							| 
									
										
										
										
											2024-04-21 19:57:33 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void visit_edges(Visitor& visitor) override; | 
					
						
							| 
									
										
										
										
											2022-08-04 21:28:27 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |