Truly independent web browser
/*
* Copyright (c) 2022-2023, Linus Groh <[email protected]>
* Copyright (c) 2023, networkException <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/ByteString.h>
#include <AK/Error.h>
#include <AK/Forward.h>
#include <AK/NonnullRefPtr.h>
#include <AK/Optional.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <AK/Time.h>
#include <AK/Utf16String.h>
#include <AK/Utf16View.h>
#include <AK/Variant.h>
#include <AK/Vector.h>
#include <LibHTTP/Cache/CacheMode.h>
#include <LibHTTP/Cookie/Cookie.h>
#include <LibHTTP/HeaderList.h>
#include <LibURL/Origin.h>
#include <LibURL/URL.h>
#include <LibWeb/ContentSecurityPolicy/PolicyList.h>
#include <LibWeb/Export.h>
#include <LibWeb/Fetch/Infrastructure/ClientContextSnapshot.h>
#include <LibWeb/Fetch/Infrastructure/HTTP.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/FetchBody.h>
#include <LibWeb/Fetch/Infrastructure/KeepaliveQuotaAccountant.h>
#include <LibWeb/Fetch/Infrastructure/NetworkObservation.h>
#include <LibWeb/HTML/Scripting/EnvironmentSettingsObjectAddress.h>
#include <LibWeb/HTML/Scripting/RemoteEnvironmentSettings.h>
#include <LibWebCommon/Fetch/Infrastructure/HTTP/RequestPriority.h>
#include <LibWebCommon/Fetch/Infrastructure/HTTP/RequestReferrer.h>
#include <LibWebCommon/HTML/CrossProcessId.h>
#include <LibWebCommon/HTML/Scripting/EnvironmentId.h>
namespace Web::Fetch::Infrastructure {
class Response;
// https://fetch.spec.whatwg.org/#concept-request
class WEB_API Request final : public RefCounted<Request> {
public:
GC_HOLDS_NO_CELL_EDGES;
enum class CredentialsMode {
Omit,
SameOrigin,
Include,
};
enum class Destination {
Audio,
AudioWorklet,
Document,
Embed,
Font,
Frame,
IFrame,
Image,
JSON,
Manifest,
Object,
PaintWorklet,
Report,
Script,
ServiceWorker,
SharedWorker,
Style,
Text,
Track,
Video,
WebIdentity,
Worker,
XSLT,
};
enum class Initiator {
Download,
ImageSet,
Manifest,
Prefetch,
Prerender,
XSLT,
};
enum class InitiatorType {
Audio,
Beacon,
Body,
CSS,
EarlyHint,
Embed,
Fetch,
Font,
Frame,
IFrame,
Image,
IMG,
Input,
Link,
Object,
Ping,
Script,
Track,
Video,
XMLHttpRequest,
Other,
};
enum class Mode {
SameOrigin,
CORS,
NoCORS,
Navigate,
WebSocket,
};
enum class Origin {
Client,
};
enum class ParserMetadata {
ParserInserted,
NotParserInserted,
};
enum class PolicyContainer {
Client,
};
enum class RedirectMode {
Follow,
Error,
Manual,
};
using Referrer = RequestReferrer;
enum class ResponseTainting {
Basic,
CORS,
Opaque,
};
enum class ServiceWorkersMode {
All,
None,
};
enum class TraversableForUserPrompts {
NoTraversable,
Client,
};
using Priority = RequestPriority;
// Members are implementation-defined
struct InternalPriority { };
using BodyType = Variant<Empty, ByteBuffer, FetchBody>;
using OriginType = Variant<Origin, URL::Origin>;
using PolicyContainerType = Variant<PolicyContainer, NonnullRefPtr<HTML::PolicyContainer const>>;
using ReferrerType = RequestReferrerType;
using TraversableForUserPromptsType = Variant<TraversableForUserPrompts, HTML::CrossProcessId>;
using ClientType = Variant<HTML::EnvironmentSettingsObjectAddress, NonnullRefPtr<HTML::RemoteEnvironmentSettings const>>;
[[nodiscard]] static NonnullRefPtr<Request> create();
~Request();
[[nodiscard]] ByteString const& method() const { return m_method; }
void set_method(ByteString method) { m_method = move(method); }
[[nodiscard]] bool local_urls_only() const { return m_local_urls_only; }
void set_local_urls_only(bool local_urls_only) { m_local_urls_only = local_urls_only; }
NonnullRefPtr<HTTP::HeaderList> const& header_list() const { return m_header_list; }
void set_header_list(NonnullRefPtr<HTTP::HeaderList> header_list) { m_header_list = move(header_list); }
[[nodiscard]] bool unsafe_request() const { return m_unsafe_request; }
void set_unsafe_request(bool unsafe_request) { m_unsafe_request = unsafe_request; }
[[nodiscard]] BodyType const& body() const { return m_body; }
[[nodiscard]] BodyType& body() { return m_body; }
void set_body(BodyType body)
{
if (body.has<Empty>())
m_keepalive_quota_reservation.clear();
m_body = move(body);
}
[[nodiscard]] Optional<ClientType> const& client() const { return m_client; }
void set_client(Optional<ClientType> client) { m_client = move(client); }
[[nodiscard]] RefPtr<ClientContextSnapshot const> const& client_snapshot() const { return m_client_snapshot; }
void set_client_snapshot(RefPtr<ClientContextSnapshot const> client_snapshot) { m_client_snapshot = move(client_snapshot); }
[[nodiscard]] Optional<HTML::RemoteClientNavigation> const& remote_client_navigation() const { return m_remote_client_navigation; }
void set_remote_client_navigation(Optional<HTML::RemoteClientNavigation> remote_client_navigation) { m_remote_client_navigation = move(remote_client_navigation); }
struct ChildNavigableNavigation {
HTML::CrossProcessId navigable_id;
Optional<Utf16String> navigation_id;
ContentSecurityPolicy::PolicyList container_document_csp_list;
};
[[nodiscard]] Optional<ChildNavigableNavigation> const& child_navigable_navigation() const { return m_child_navigable_navigation; }
void set_child_navigable_navigation(Optional<ChildNavigableNavigation> child_navigable_navigation) { m_child_navigable_navigation = move(child_navigable_navigation); }
[[nodiscard]] RefPtr<ReservedClientContextSnapshot const> const& reserved_client_snapshot() const { return m_reserved_client_snapshot; }
void set_reserved_client_snapshot(RefPtr<ReservedClientContextSnapshot const> reserved_client_snapshot) { m_reserved_client_snapshot = move(reserved_client_snapshot); }
[[nodiscard]] HTML::EnvironmentId const& replaces_client_id() const { return m_replaces_client_id; }
void set_replaces_client_id(HTML::EnvironmentId replaces_client_id) { m_replaces_client_id = move(replaces_client_id); }
[[nodiscard]] TraversableForUserPromptsType const& traversable_for_user_prompts() const { return m_traversable_for_user_prompts; }
void set_traversable_for_user_prompts(TraversableForUserPromptsType traversable_for_user_prompts) { m_traversable_for_user_prompts = move(traversable_for_user_prompts); }
[[nodiscard]] bool keepalive() const { return m_keepalive; }
void set_keepalive(bool keepalive) { m_keepalive = keepalive; }
[[nodiscard]] Optional<InitiatorType> const& initiator_type() const { return m_initiator_type; }
void set_initiator_type(Optional<InitiatorType> initiator_type) { m_initiator_type = move(initiator_type); }
[[nodiscard]] ServiceWorkersMode service_workers_mode() const { return m_service_workers_mode; }
void set_service_workers_mode(ServiceWorkersMode service_workers_mode) { m_service_workers_mode = service_workers_mode; }
[[nodiscard]] Optional<Initiator> const& initiator() const { return m_initiator; }
void set_initiator(Optional<Initiator> initiator) { m_initiator = move(initiator); }
[[nodiscard]] Optional<Destination> const& destination() const { return m_destination; }
void set_destination(Optional<Destination> destination) { m_destination = move(destination); }
[[nodiscard]] Priority const& priority() const { return m_priority; }
void set_priority(Priority priority) { m_priority = priority; }
[[nodiscard]] OriginType const& origin() const { return m_origin; }
void set_origin(OriginType origin) { m_origin = move(origin); }
[[nodiscard]] HTTP::Cookie::SameSiteStatus same_site_status() const;
[[nodiscard]] HTTP::Cookie::SameSiteContext same_site_context() const;
void set_reloaded_document_same_site_status(HTTP::Cookie::SameSiteStatus status) { m_reloaded_document_same_site_status = status; }
[[nodiscard]] Optional<URL::Origin> const& top_level_navigation_initiator_origin() const { return m_top_level_navigation_initiator_origin; }
void set_top_level_navigation_initiator_origin(Optional<URL::Origin> top_level_navigation_initiator_origin) { m_top_level_navigation_initiator_origin = move(top_level_navigation_initiator_origin); }
[[nodiscard]] PolicyContainerType const& policy_container() const { return m_policy_container; }
void set_policy_container(PolicyContainerType);
void set_policy_container(NonnullRefPtr<HTML::PolicyContainer const>);
[[nodiscard]] Mode mode() const { return m_mode; }
void set_mode(Mode mode) { m_mode = mode; }
[[nodiscard]] bool use_cors_preflight() const { return m_use_cors_preflight; }
void set_use_cors_preflight(bool use_cors_preflight) { m_use_cors_preflight = use_cors_preflight; }
[[nodiscard]] CredentialsMode credentials_mode() const { return m_credentials_mode; }
void set_credentials_mode(CredentialsMode credentials_mode) { m_credentials_mode = credentials_mode; }
[[nodiscard]] bool use_url_credentials() const { return m_use_url_credentials; }
void set_use_url_credentials(bool use_url_credentials) { m_use_url_credentials = use_url_credentials; }
[[nodiscard]] HTTP::CacheMode cache_mode() const { return m_cache_mode; }
void set_cache_mode(HTTP::CacheMode cache_mode) { m_cache_mode = cache_mode; }
[[nodiscard]] RedirectMode redirect_mode() const { return m_redirect_mode; }
void set_redirect_mode(RedirectMode redirect_mode) { m_redirect_mode = redirect_mode; }
[[nodiscard]] Utf16String const& integrity_metadata() const { return m_integrity_metadata; }
void set_integrity_metadata(Utf16String integrity_metadata) { m_integrity_metadata = move(integrity_metadata); }
[[nodiscard]] Utf16String const& cryptographic_nonce_metadata() const { return m_cryptographic_nonce_metadata; }
void set_cryptographic_nonce_metadata(Utf16String cryptographic_nonce_metadata) { m_cryptographic_nonce_metadata = move(cryptographic_nonce_metadata); }
[[nodiscard]] Optional<ParserMetadata> const& parser_metadata() const { return m_parser_metadata; }
void set_parser_metadata(Optional<ParserMetadata> parser_metadata) { m_parser_metadata = move(parser_metadata); }
[[nodiscard]] bool reload_navigation() const { return m_reload_navigation; }
void set_reload_navigation(bool reload_navigation) { m_reload_navigation = reload_navigation; }
[[nodiscard]] bool history_navigation() const { return m_history_navigation; }
void set_history_navigation(bool history_navigation) { m_history_navigation = history_navigation; }
[[nodiscard]] bool user_activation() const { return m_user_activation; }
void set_user_activation(bool user_activation) { m_user_activation = user_activation; }
[[nodiscard]] bool text_directive_user_activation() const { return m_text_directive_user_activation; }
void set_text_directive_user_activation(bool value) { m_text_directive_user_activation = value; }
[[nodiscard]] bool browsing_context_group_has_multiple_contexts() const { return m_browsing_context_group_has_multiple_contexts; }
void set_browsing_context_group_has_multiple_contexts(bool value) { m_browsing_context_group_has_multiple_contexts = value; }
[[nodiscard]] bool user_agent_initiated() const { return m_user_agent_initiated; }
void set_user_agent_initiated(bool user_agent_initiated) { m_user_agent_initiated = user_agent_initiated; }
[[nodiscard]] bool is_form_submission() const { return m_form_submission; }
void set_form_submission(bool form_submission) { m_form_submission = form_submission; }
[[nodiscard]] bool render_blocking() const { return m_render_blocking; }
void set_render_blocking(bool render_blocking) { m_render_blocking = render_blocking; }
[[nodiscard]] Vector<URL::URL> const& url_list() const { return m_url_list; }
[[nodiscard]] Vector<URL::URL>& url_list() { return m_url_list; }
void set_url_list(Vector<URL::URL> url_list) { m_url_list = move(url_list); }
[[nodiscard]] u8 redirect_count() const { return m_redirect_count; }
void set_redirect_count(u8 redirect_count) { m_redirect_count = redirect_count; }
[[nodiscard]] ReferrerType const& referrer() const { return m_referrer; }
void set_referrer(ReferrerType referrer) { m_referrer = move(referrer); }
[[nodiscard]] ReferrerPolicy::ReferrerPolicy const& referrer_policy() const { return m_referrer_policy; }
void set_referrer_policy(ReferrerPolicy::ReferrerPolicy referrer_policy) { m_referrer_policy = move(referrer_policy); }
[[nodiscard]] ResponseTainting response_tainting() const { return m_response_tainting; }
void set_response_tainting(ResponseTainting response_tainting) { m_response_tainting = response_tainting; }
[[nodiscard]] bool prevent_no_cache_cache_control_header_modification() const { return m_prevent_no_cache_cache_control_header_modification; }
void set_prevent_no_cache_cache_control_header_modification(bool prevent_no_cache_cache_control_header_modification) { m_prevent_no_cache_cache_control_header_modification = prevent_no_cache_cache_control_header_modification; }
[[nodiscard]] bool done() const { return m_done; }
void set_done(bool done)
{
m_done = done;
if (done)
m_keepalive_quota_reservation.clear();
}
void set_keepalive_quota_reservation(KeepaliveQuotaAccountant::Reservation reservation) { m_keepalive_quota_reservation = move(reservation); }
[[nodiscard]] bool timing_allow_failed() const { return m_timing_allow_failed; }
void set_timing_allow_failed(bool timing_allow_failed) { m_timing_allow_failed = timing_allow_failed; }
[[nodiscard]] Vector<Vector<String>> const& navigation_timing_allow_values_list() const { return m_navigation_timing_allow_values_list; }
void append_to_navigation_timing_allow_values_list(Response const&);
[[nodiscard]] URL::URL& url();
[[nodiscard]] URL::URL const& url() const;
[[nodiscard]] URL::URL& current_url();
[[nodiscard]] URL::URL const& current_url() const;
void set_url(URL::URL url);
[[nodiscard]] bool destination_is_script_like() const;
[[nodiscard]] bool is_subresource_request() const;
[[nodiscard]] bool is_navigation_request() const;
[[nodiscard]] RedirectTaint redirect_taint() const;
[[nodiscard]] String serialize_origin() const;
[[nodiscard]] ByteString byte_serialize_origin() const;
[[nodiscard]] NonnullRefPtr<Request> clone() const;
void add_range_header(u64 first, Optional<u64> const& last);
void add_origin_header();
[[nodiscard]] bool cross_origin_embedder_policy_allows_credentials() const;
UnixDateTime request_time() const { return m_request_time; }
[[nodiscard]] RefPtr<NetworkObservation> const& network_observation() const { return m_network_observation; }
[[nodiscard]] NonnullRefPtr<NetworkObservation> ensure_network_observation();
private:
explicit Request(NonnullRefPtr<HTTP::HeaderList>);
// https://fetch.spec.whatwg.org/#concept-request-method
// A request has an associated method (a method). Unless stated otherwise it is `GET`.
ByteString m_method { "GET"sv };
// https://fetch.spec.whatwg.org/#local-urls-only-flag
// A request has an associated local-URLs-only flag. Unless stated otherwise it is unset.
bool m_local_urls_only { false };
// https://fetch.spec.whatwg.org/#concept-request-header-list
// A request has an associated header list (a header list). Unless stated otherwise it is empty.
NonnullRefPtr<HTTP::HeaderList> m_header_list;
// https://fetch.spec.whatwg.org/#unsafe-request-flag
// A request has an associated unsafe-request flag. Unless stated otherwise it is unset.
bool m_unsafe_request { false };
// https://fetch.spec.whatwg.org/#concept-request-body
// A request has an associated body (null, a byte sequence, or a body). Unless stated otherwise it is null.
BodyType m_body;
// https://fetch.spec.whatwg.org/#concept-request-client
// A request has an associated client (null or an environment settings object).
// NB: A settings object of this process is held by its address.
Optional<ClientType> m_client;
// What fetching reads from the client, null when the client is.
RefPtr<ClientContextSnapshot const> m_client_snapshot;
// The navigation of a navigation request whose client another process hosts, through which the UI process finds that
// client.
Optional<HTML::RemoteClientNavigation> m_remote_client_navigation;
// AD-HOC: The navigation of a navigation request whose navigable is a child navigable, with a copy of the CSP list
// of the navigable's container's node document. That document's frame-src governs where the
// navigable can be navigated to, whichever document started the navigation.
// See https://github.com/w3c/webappsec-csp/issues/624.
Optional<ChildNavigableNavigation> m_child_navigable_navigation;
// https://fetch.spec.whatwg.org/#concept-request-reserved-client
// A request has an associated reserved client (null, an environment, or an environment settings object). Unless
// stated otherwise it is null.
// NB: The reserved client is held as a snapshot of what fetching reads from it.
RefPtr<ReservedClientContextSnapshot const> m_reserved_client_snapshot;
// https://fetch.spec.whatwg.org/#concept-request-replaces-client-id
// A request has an associated replaces client id (a string). Unless stated otherwise it is the empty string.
HTML::EnvironmentId m_replaces_client_id;
// https://fetch.spec.whatwg.org/#concept-request-window
// A request has an associated traversable for user prompts, that is "no-traversable", "client", or a traversable
// navigable. Unless stated otherwise it is "client".
// NB: A traversable navigable is held by its id.
TraversableForUserPromptsType m_traversable_for_user_prompts { TraversableForUserPrompts::Client };
// https://fetch.spec.whatwg.org/#request-keepalive-flag
// A request has an associated boolean keepalive. Unless stated otherwise it is false.
bool m_keepalive { false };
// https://fetch.spec.whatwg.org/#request-initiator-type
// A request has an associated initiator type, which is null, "audio", "beacon", "body", "css", "early-hint",
// "embed", "fetch", "font", "frame", "iframe", "image", "img", "input", "link", "object", "ping", "script",
// "track", "video", "xmlhttprequest", or "other". Unless stated otherwise it is null. [RESOURCE-TIMING]
Optional<InitiatorType> m_initiator_type;
// https://fetch.spec.whatwg.org/#request-service-workers-mode
// A request has an associated service-workers mode, that is "all" or "none". Unless stated otherwise it is "all".
ServiceWorkersMode m_service_workers_mode { ServiceWorkersMode::All };
// https://fetch.spec.whatwg.org/#concept-request-initiator
// A request has an associated initiator, which is the empty string, "download", "imageset", "manifest",
// "prefetch", "prerender", or "xslt". Unless stated otherwise it is the empty string.
Optional<Initiator> m_initiator;
// https://fetch.spec.whatwg.org/#concept-request-destination
// A request has an associated destination, which is the empty string, "audio", "audioworklet", "document",
// "embed", "font", "frame", "iframe", "image", "json", "manifest", "object", "paintworklet", "report", "script",
// "serviceworker", "sharedworker", "style", "track", "video", "webidentity", "worker", or "xslt". Unless stated
// otherwise it is the empty string.
// NOTE: These are reflected on RequestDestination except for "serviceworker" and "webidentity" as fetches with
// those destinations skip service workers.
Optional<Destination> m_destination;
// https://fetch.spec.whatwg.org/#request-priority
// A request has an associated priority, which is "high", "low", or "auto". Unless stated otherwise it is "auto".
Priority m_priority { Priority::Auto };
// https://fetch.spec.whatwg.org/#request-internal-priority
// A request has an associated internal priority (null or an implementation-defined object). Unless otherwise stated it is null.
Optional<InternalPriority> m_internal_priority;
// https://fetch.spec.whatwg.org/#concept-request-origin
// A request has an associated origin, which is "client" or an origin. Unless stated otherwise it is "client".
OriginType m_origin { Origin::Client };
Optional<HTTP::Cookie::SameSiteStatus> m_reloaded_document_same_site_status;
// https://fetch.spec.whatwg.org/#request-top-level-navigation-initiator-origin
// A request has an associated top-level navigation initiator origin, which is an origin or null. Unless stated otherwise it is null.
Optional<URL::Origin> m_top_level_navigation_initiator_origin;
// https://fetch.spec.whatwg.org/#concept-request-policy-container
// A request has an associated policy container, which is "client" or a policy container. Unless stated otherwise
// it is "client".
PolicyContainerType m_policy_container { PolicyContainer::Client };
// https://fetch.spec.whatwg.org/#concept-request-referrer
// A request has an associated referrer, which is "no-referrer", "client", or a URL. Unless stated otherwise it is
// "client".
ReferrerType m_referrer { Referrer::Client };
// https://fetch.spec.whatwg.org/#concept-request-referrer-policy
// A request has an associated referrer policy, which is a referrer policy. Unless stated otherwise it is the empty
// string.
ReferrerPolicy::ReferrerPolicy m_referrer_policy { ReferrerPolicy::ReferrerPolicy::EmptyString };
// https://fetch.spec.whatwg.org/#concept-request-mode
// A request has an associated mode, which is "same-origin", "cors", "no-cors", "navigate", or "websocket". Unless
// stated otherwise, it is "no-cors".
Mode m_mode { Mode::NoCORS };
// https://fetch.spec.whatwg.org/#use-cors-preflight-flag
// A request has an associated use-CORS-preflight flag. Unless stated otherwise, it is unset.
bool m_use_cors_preflight { false };
// https://fetch.spec.whatwg.org/#concept-request-credentials-mode
// A request has an associated credentials mode, which is "omit", "same-origin", or "include". Unless stated
// otherwise, it is "same-origin".
CredentialsMode m_credentials_mode { CredentialsMode::SameOrigin };
// https://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag
// A request has an associated use-URL-credentials flag. Unless stated otherwise, it is unset.
// NOTE: When this flag is set, when a request’s URL has a username and password, and there is an available
// authentication entry for the request, then the URL’s credentials are preferred over that of the
// authentication entry. Modern specifications avoid setting this flag, since putting credentials in URLs is
// discouraged, but some older features set it for compatibility reasons.
bool m_use_url_credentials { false };
// https://fetch.spec.whatwg.org/#concept-request-cache-mode
// A request has an associated cache mode, which is "default", "no-store", "reload", "no-cache", "force-cache", or
// "only-if-cached". Unless stated otherwise, it is "default".
HTTP::CacheMode m_cache_mode { HTTP::CacheMode::Default };
// https://fetch.spec.whatwg.org/#concept-request-redirect-mode
// A request has an associated redirect mode, which is "follow", "error", or "manual". Unless stated otherwise, it
// is "follow".
RedirectMode m_redirect_mode { RedirectMode::Follow };
// https://fetch.spec.whatwg.org/#concept-request-integrity-metadata
// A request has associated integrity metadata (a string). Unless stated otherwise, it is the empty string.
Utf16String m_integrity_metadata;
// https://fetch.spec.whatwg.org/#concept-request-nonce-metadata
// A request has associated cryptographic nonce metadata (a string). Unless stated otherwise, it is the empty
// string.
Utf16String m_cryptographic_nonce_metadata;
// https://fetch.spec.whatwg.org/#concept-request-parser-metadata
// A request has associated parser metadata which is the empty string, "parser-inserted", or
// "not-parser-inserted". Unless otherwise stated, it is the empty string.
Optional<ParserMetadata> m_parser_metadata;
// https://fetch.spec.whatwg.org/#concept-request-reload-navigation-flag
// A request has an associated reload-navigation flag. Unless stated otherwise, it is unset.
bool m_reload_navigation { false };
// https://fetch.spec.whatwg.org/#concept-request-history-navigation-flag
// A request has an associated history-navigation flag. Unless stated otherwise, it is unset.
bool m_history_navigation { false };
// https://fetch.spec.whatwg.org/#request-user-activation
// A request has an associated boolean user-activation. Unless stated otherwise, it is false.
bool m_user_activation { false };
// https://wicg.github.io/scroll-to-text-fragment/#restricting-the-text-fragment
// The one-shot authorization to scroll to a text directive, propagated through navigation requests.
bool m_text_directive_user_activation { false };
bool m_browsing_context_group_has_multiple_contexts { false };
// NB: Not a Fetch concept. Fetch Metadata's "set site" sends Sec-Fetch-Site:none for a navigation whose URL
// the user agent itself supplied, and populating a history entry sets this from the entry's document state.
bool m_user_agent_initiated { false };
// NB: Not a Fetch concept. Upgrade Insecure Requests asks whether a navigation request is a form submission, and
// creating navigation params by fetching sets this from the navigation's CSP navigation type.
bool m_form_submission { false };
// https://fetch.spec.whatwg.org/#request-render-blocking
// A request has an associated boolean render-blocking. Unless stated otherwise, it is false.
bool m_render_blocking { false };
// https://fetch.spec.whatwg.org/#concept-request-url-list
// A request has an associated URL list (a list of one or more URLs). Unless stated otherwise, it is a list
// containing a copy of request’s URL.
Vector<URL::URL> m_url_list;
// https://fetch.spec.whatwg.org/#concept-request-redirect-count
// A request has an associated redirect count. Unless stated otherwise, it is zero.
// NOTE: '4.4. HTTP-redirect fetch' infers a limit of 20.
u8 m_redirect_count { 0 };
// https://fetch.spec.whatwg.org/#concept-request-response-tainting
// A request has an associated response tainting, which is "basic", "cors", or "opaque". Unless stated otherwise,
// it is "basic".
ResponseTainting m_response_tainting { ResponseTainting::Basic };
// https://fetch.spec.whatwg.org/#no-cache-prevent-cache-control
// A request has an associated prevent no-cache cache-control header modification flag. Unless stated otherwise, it
// is unset.
bool m_prevent_no_cache_cache_control_header_modification { false };
// https://fetch.spec.whatwg.org/#done-flag
// A request has an associated done flag. Unless stated otherwise, it is unset.
bool m_done { false };
// Counts this request's body against its client's keepalive quota until its done flag is set, its body is null or
// it is destroyed.
Optional<KeepaliveQuotaAccountant::Reservation> m_keepalive_quota_reservation;
// https://fetch.spec.whatwg.org/#timing-allow-failed
// A request has an associated timing allow failed flag. Unless stated otherwise, it is unset.
bool m_timing_allow_failed { false };
// https://fetch.spec.whatwg.org/#request-navigation-timing-allow-values-list
// A request has an associated navigation timing allow values list (a list of lists of strings). Unless stated otherwise, it is « ».
Vector<Vector<String>> m_navigation_timing_allow_values_list;
// Non-standard
UnixDateTime m_request_time;
RefPtr<NetworkObservation> m_network_observation;
};
WEB_API StringView request_destination_to_string(Request::Destination);
Optional<Request::Destination> translate_potential_destination(Utf16View potential_destination);
bool destination_is_script_like(Request::Destination);
WEB_API StringView request_mode_to_string(Request::Mode);
WEB_API Utf16FlyString initiator_type_to_string(Request::InitiatorType);
Optional<Request::Priority> request_priority_from_string(Utf16View);
Optional<Request::Priority> request_priority_from_string(Utf16String const&);
}