1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 16:44:58 +00:00

LibWeb: Add helper to create default classic script fetch options

This commit is contained in:
networkException 2023-10-29 02:51:32 +01:00 committed by Andreas Kling
parent d1c1218d42
commit dd90ed11b3
2 changed files with 18 additions and 0 deletions

View file

@ -32,6 +32,21 @@ OnFetchScriptComplete create_on_fetch_script_complete(JS::Heap& heap, Function<v
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
DeprecatedString module_type_from_module_request(JS::ModuleRequest const& module_request)
{