NavigationParams.h 3.1 KB

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