NavigationParams.h 3.4 KB

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