Fetching.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
  3. * Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/Forward.h>
  9. #include <LibJS/Forward.h>
  10. #include <LibJS/Heap/GCPtr.h>
  11. #include <LibWeb/Forward.h>
  12. namespace Web::Fetch::Fetching {
  13. #define ENUMERATE_BOOL_PARAMS \
  14. __ENUMERATE_BOOL_PARAM(IncludeCredentials) \
  15. __ENUMERATE_BOOL_PARAM(IsAuthenticationFetch) \
  16. __ENUMERATE_BOOL_PARAM(IsNewConnectionFetch) \
  17. __ENUMERATE_BOOL_PARAM(MakeCORSPreflight) \
  18. __ENUMERATE_BOOL_PARAM(Recursive) \
  19. __ENUMERATE_BOOL_PARAM(UseParallelQueue)
  20. #define __ENUMERATE_BOOL_PARAM(Name) \
  21. enum class Name { \
  22. Yes, \
  23. No, \
  24. };
  25. ENUMERATE_BOOL_PARAMS
  26. #undef __ENUMERATE_BOOL_PARAM
  27. WebIDL::ExceptionOr<JS::NonnullGCPtr<Infrastructure::FetchController>> fetch(JS::Realm&, Infrastructure::Request&, Infrastructure::FetchAlgorithms const&, UseParallelQueue use_parallel_queue = UseParallelQueue::No);
  28. WebIDL::ExceptionOr<JS::GCPtr<PendingResponse>> main_fetch(JS::Realm&, Infrastructure::FetchParams const&, Recursive recursive = Recursive::No);
  29. void fetch_response_handover(JS::Realm&, Infrastructure::FetchParams const&, Infrastructure::Response&);
  30. WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> scheme_fetch(JS::Realm&, Infrastructure::FetchParams const&);
  31. WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_fetch(JS::Realm&, Infrastructure::FetchParams const&, MakeCORSPreflight make_cors_preflight = MakeCORSPreflight::No);
  32. WebIDL::ExceptionOr<JS::GCPtr<PendingResponse>> http_redirect_fetch(JS::Realm&, Infrastructure::FetchParams const&, Infrastructure::Response&);
  33. WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fetch(JS::Realm&, Infrastructure::FetchParams const&, IsAuthenticationFetch is_authentication_fetch = IsAuthenticationFetch::No, IsNewConnectionFetch is_new_connection_fetch = IsNewConnectionFetch::No);
  34. WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> nonstandard_resource_loader_file_or_http_network_fetch(JS::Realm&, Infrastructure::FetchParams const&, IncludeCredentials include_credentials = IncludeCredentials::No, IsNewConnectionFetch is_new_connection_fetch = IsNewConnectionFetch::No);
  35. WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> cors_preflight_fetch(JS::Realm&, Infrastructure::Request&);
  36. void set_sec_fetch_dest_header(Infrastructure::Request&);
  37. void set_sec_fetch_mode_header(Infrastructure::Request&);
  38. void set_sec_fetch_site_header(Infrastructure::Request&);
  39. void set_sec_fetch_user_header(Infrastructure::Request&);
  40. void append_fetch_metadata_headers_for_request(Infrastructure::Request&);
  41. }