mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 19:05:08 +00:00
LibWeb: Add helper to create default classic script fetch options
This commit is contained in:
parent
d1c1218d42
commit
dd90ed11b3
2 changed files with 18 additions and 0 deletions
|
@ -32,6 +32,21 @@ OnFetchScriptComplete create_on_fetch_script_complete(JS::Heap& heap, Function<v
|
||||||
return JS::create_heap_function(heap, move(function));
|
return JS::create_heap_function(heap, move(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScriptFetchOptions default_classic_script_fetch_options()
|
||||||
|
{
|
||||||
|
// The default classic script fetch options are a script fetch options whose cryptographic nonce is the empty string,
|
||||||
|
// integrity metadata is the empty string, parser metadata is "not-parser-inserted", credentials mode is "same-origin",
|
||||||
|
// referrer policy is the empty string, and fetch priority is "auto".
|
||||||
|
return ScriptFetchOptions {
|
||||||
|
.cryptographic_nonce = {},
|
||||||
|
.integrity_metadata = {},
|
||||||
|
.parser_metadata = Fetch::Infrastructure::Request::ParserMetadata::NotParserInserted,
|
||||||
|
.credentials_mode = Fetch::Infrastructure::Request::CredentialsMode::SameOrigin,
|
||||||
|
.referrer_policy = {},
|
||||||
|
.fetch_priority = Fetch::Infrastructure::Request::Priority::Auto
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/webappapis.html#module-type-from-module-request
|
// https://html.spec.whatwg.org/multipage/webappapis.html#module-type-from-module-request
|
||||||
DeprecatedString module_type_from_module_request(JS::ModuleRequest const& module_request)
|
DeprecatedString module_type_from_module_request(JS::ModuleRequest const& module_request)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,9 @@ struct ScriptFetchOptions {
|
||||||
Fetch::Infrastructure::Request::Priority fetch_priority {};
|
Fetch::Infrastructure::Request::Priority fetch_priority {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/webappapis.html#default-classic-script-fetch-options
|
||||||
|
ScriptFetchOptions default_classic_script_fetch_options();
|
||||||
|
|
||||||
DeprecatedString module_type_from_module_request(JS::ModuleRequest const&);
|
DeprecatedString module_type_from_module_request(JS::ModuleRequest const&);
|
||||||
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, DeprecatedString const& specifier);
|
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, DeprecatedString const& specifier);
|
||||||
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(DeprecatedString const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const&);
|
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(DeprecatedString const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue