From 5b1d0d4d1bb5b7639b7c0d087b09df591af9e490 Mon Sep 17 00:00:00 2001 From: networkException Date: Sun, 29 Oct 2023 02:53:26 +0100 Subject: [PATCH] LibWeb: Add FetchContext as HostDefined JS::GraphLoadingState field This patch adds FetchContext as the type to be used in the HostDefined slot of JS::GraphLoadingState in web script fetching. --- .../Libraries/LibWeb/HTML/Scripting/Fetching.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.h b/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.h index f619a7da0e..0613ef2d9c 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.h +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.h @@ -46,6 +46,21 @@ struct ScriptFetchOptions { // https://html.spec.whatwg.org/multipage/webappapis.html#default-classic-script-fetch-options ScriptFetchOptions default_classic_script_fetch_options(); +struct FetchContext : JS::GraphLoadingState::HostDefined { + FetchContext(JS::GCPtr parse_error, Fetch::Infrastructure::Request::Destination destination, JS::GCPtr perform_fetch, EnvironmentSettingsObject& fetch_client) + : parse_error(parse_error) + , destination(destination) + , perform_fetch(perform_fetch) + , fetch_client(fetch_client) + { + } + + JS::GCPtr parse_error; // [[ParseError]] + Fetch::Infrastructure::Request::Destination destination; // [[Destination]] + JS::GCPtr perform_fetch; // [[PerformFetch]] + EnvironmentSettingsObject& fetch_client; // [[FetchClient]] +}; + DeprecatedString module_type_from_module_request(JS::ModuleRequest const&); WebIDL::ExceptionOr resolve_module_specifier(Optional referring_script, DeprecatedString const& specifier); WebIDL::ExceptionOr> resolve_imports_match(DeprecatedString const& normalized_specifier, Optional as_url, ModuleSpecifierMap const&);