NavigationParams.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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/Origin.h>
  12. #include <LibWeb/HTML/PolicyContainers.h>
  13. #include <LibWeb/HTML/SandboxingFlagSet.h>
  14. namespace Web::HTML {
  15. // https://html.spec.whatwg.org/multipage/browsing-the-web.html#history-handling-behavior
  16. enum class HistoryHandlingBehavior {
  17. Default,
  18. EntryUpdate,
  19. Reload,
  20. Replace,
  21. };
  22. // https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigation-params
  23. struct NavigationParams {
  24. // a navigation id
  25. String id;
  26. // null or a request that started the navigation
  27. OwnPtr<Fetch::Infrastructure::Request> request;
  28. // a response that ultimately was navigated to (potentially a network error)
  29. NonnullOwnPtr<Fetch::Infrastructure::Response> response;
  30. // an origin to use for the new Document
  31. Origin origin;
  32. // a policy container to use for the new Document
  33. PolicyContainer policy_container;
  34. // a sandboxing flag set to impose on the new Document
  35. SandboxingFlagSet final_sandboxing_flag_set;
  36. // a cross-origin opener policy to use for the new Document
  37. CrossOriginOpenerPolicy cross_origin_opener_policy;
  38. // a cross-origin opener policy enforcement result, used for reporting and potentially for causing a browsing context group switch
  39. CrossOriginOpenerPolicyEnforcementResult coop_enforcement_result;
  40. // null or an environment reserved for the new Document
  41. Optional<Environment> reserved_environment;
  42. // the browsing context to be navigated (or discarded, if a browsing context group switch occurs)
  43. NonnullRefPtr<HTML::BrowsingContext> browsing_context;
  44. // a history handling behavior
  45. HistoryHandlingBehavior history_handling { HistoryHandlingBehavior::Default };
  46. // a boolean
  47. bool has_cross_origin_redirects { false };
  48. // FIXME: an algorithm expecting a response
  49. void* process_response_end_of_body { nullptr };
  50. // FIXME: null or an algorithm accepting a Document, once it has been created
  51. void* commit_early_hints { nullptr };
  52. };
  53. }