mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Extract some CORS and MIME Fetch helpers to their own files
An upcoming commit will migrate the contents of Headers.h/cpp to LibHTTP for use outside of LibWeb. These CORS and MIME helpers depend on other LibWeb facilities, however, so they cannot be moved.
This commit is contained in:
parent
0fd80a8f99
commit
3dce6766a3
Notes:
github-actions[bot]
2025-11-27 13:58:58 +00:00
Author: https://github.com/trflynn89
Commit: 3dce6766a3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6944
Reviewed-by: https://github.com/gmta ✅
30 changed files with 382 additions and 299 deletions
|
|
@ -23,6 +23,7 @@
|
|||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/ResponsePrototype.h>
|
||||
#include <LibWeb/ContentSecurityPolicy/BlockingAlgorithms.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/MIME.h>
|
||||
#include <LibWeb/Fetch/Response.h>
|
||||
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
|
||||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||
|
|
@ -891,7 +892,7 @@ GC::Ref<WebIDL::Promise> compile_potential_webassembly_response(JS::VM& vm, GC::
|
|||
// 5. If mimeType is not a byte-case-insensitive match for `application/wasm`, reject returnValue with a TypeError and abort these substeps.
|
||||
// Note: extra parameters are not allowed, including the empty `application/wasm;`.
|
||||
// FIXME: Validate these extra constraints that are not checked by extract_mime_type()
|
||||
if (auto mime = response->header_list()->extract_mime_type(); !mime.has_value() || mime.value().essence() != "application/wasm"sv) {
|
||||
if (auto mime = Fetch::Infrastructure::extract_mime_type(response->header_list()); !mime.has_value() || mime.value().essence() != "application/wasm"sv) {
|
||||
WebIDL::reject_promise(realm, return_value, vm.throw_completion<JS::TypeError>("Response does not match the application/wasm MIME type"sv).value());
|
||||
return JS::js_undefined();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue