1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

LibWeb/MimeSniff: Add sniffing in a browsing context

This commit is contained in:
Kemal Zebari 2023-11-30 12:44:27 -08:00 committed by Andrew Kaster
parent f6d3ea33fa
commit ea15501f37
3 changed files with 29 additions and 2 deletions

View file

@ -10,7 +10,13 @@
namespace Web::MimeSniff {
enum class SniffingContext {
None,
Browsing
};
struct SniffingConfiguration {
SniffingContext sniffing_context { SniffingContext::None };
StringView scheme { ""sv };
Optional<MimeType> supplied_type = {};
bool no_sniff { false };
@ -33,6 +39,7 @@ private:
void read_the_resource_header(ReadonlyBytes data);
ErrorOr<void> supplied_mime_type_detection_algorithm(StringView scheme, Optional<MimeType> supplied_type);
ErrorOr<void> mime_type_sniffing_algorithm();
ErrorOr<void> context_specific_sniffing_algorithm(SniffingContext sniffing_context);
// https://mimesniff.spec.whatwg.org/#supplied-mime-type
// A supplied MIME type, the MIME type determined by the supplied MIME type detection algorithm.