NavigationParams.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
  8. #include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
  9. #include <LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicy.h>
  10. #include <LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicyEnforcementResult.h>
  11. #include <LibWeb/HTML/HistoryHandlingBehavior.h>
  12. #include <LibWeb/HTML/Navigable.h>
  13. #include <LibWeb/HTML/Origin.h>
  14. #include <LibWeb/HTML/PolicyContainers.h>
  15. #include <LibWeb/HTML/SandboxingFlagSet.h>
  16. namespace Web::HTML {
  17. // https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigation-params
  18. struct NavigationParams {
  19. // null or a navigation ID
  20. Optional<String> id;
  21. // the navigable to be navigated
  22. JS::Handle<Navigable> navigable;
  23. // null or a request that started the navigation
  24. JS::GCPtr<Fetch::Infrastructure::Request> request;
  25. // a response that ultimately was navigated to (potentially a network error)
  26. JS::GCPtr<Fetch::Infrastructure::Response> response;
  27. // null or a fetch controller
  28. JS::GCPtr<Fetch::Infrastructure::FetchController> fetch_controller { nullptr };
  29. // null or an algorithm accepting a Document, once it has been created
  30. Function<void(DOM::Document&)> commit_early_hints { nullptr };
  31. // a cross-origin opener policy enforcement result, used for reporting and potentially for causing a browsing context group switch
  32. CrossOriginOpenerPolicyEnforcementResult coop_enforcement_result;
  33. // null or an environment reserved for the new Document
  34. Fetch::Infrastructure::Request::ReservedClientType reserved_environment;
  35. // an origin to use for the new Document
  36. Origin origin;
  37. // a policy container to use for the new Document
  38. PolicyContainer policy_container;
  39. // a sandboxing flag set to impose on the new Document
  40. SandboxingFlagSet final_sandboxing_flag_set = {};
  41. // a cross-origin opener policy to use for the new Document
  42. CrossOriginOpenerPolicy cross_origin_opener_policy;
  43. // FIXME: a NavigationTimingType used for creating the navigation timing entry for the new Document
  44. // a URL or null used to populate the new Document's about base URL
  45. Optional<URL> about_base_url;
  46. };
  47. // https://html.spec.whatwg.org/multipage/browsing-the-web.html#non-fetch-scheme-navigation-params
  48. struct NonFetchSchemeNavigationParams {
  49. // null or a navigation ID
  50. Optional<String> id;
  51. // the navigable to be navigated
  52. JS::Handle<Navigable> navigable;
  53. // a URL
  54. URL url;
  55. // the target snapshot params's sandboxing flags present during navigation
  56. SandboxingFlagSet target_snapshot_sandboxing_flags = {};
  57. // a copy of the source snapshot params's has transient activation boolean present during activation
  58. bool source_snapshot_has_transient_activation = { false };
  59. // an origin possibly for use in a user-facing prompt to confirm the invocation of an external software package
  60. Origin initiator_origin;
  61. // FIXME: a NavigationTimingType used for creating the navigation timing entry for the new Document
  62. };
  63. }