mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-25 18:34:14 +00:00
LibWeb/Fetch: Implement "fetch destination from module type" AO
See:
- 37659e9
This commit is contained in:
parent
1b043d259a
commit
e2f242a552
Notes:
sideshowbarker
2024-07-16 23:55:09 +09:00
Author: https://github.com/jamierocks
Commit: e2f242a552
Pull-request: https://github.com/SerenityOS/serenity/pull/24193
2 changed files with 17 additions and 0 deletions
|
|
@ -593,6 +593,21 @@ void fetch_descendants_of_a_module_script(JS::Realm& realm, JavaScriptModuleScri
|
|||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-destination-from-module-type
|
||||
Fetch::Infrastructure::Request::Destination fetch_destination_from_module_type(Fetch::Infrastructure::Request::Destination default_destination, ByteString const& module_type)
|
||||
{
|
||||
// 1. If moduleType is "json", then return "json".
|
||||
if (module_type == "json"sv)
|
||||
return Fetch::Infrastructure::Request::Destination::JSON;
|
||||
|
||||
// 2. If moduleType is "css", then return "style".
|
||||
if (module_type == "css"sv)
|
||||
return Fetch::Infrastructure::Request::Destination::Style;
|
||||
|
||||
// 3. Return defaultDestination.
|
||||
return default_destination;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script
|
||||
void fetch_single_module_script(JS::Realm& realm,
|
||||
URL::URL const& url,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue