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

LibWeb: Add XMLHttpRequest Document response type

This commit is contained in:
Bastiaan van der Plaat 2023-09-14 21:07:53 +02:00 committed by Alexander Kalenik
parent b8f8b22aa5
commit 222cc29c5c
7 changed files with 122 additions and 12 deletions

View file

@ -238,6 +238,18 @@ ErrorOr<void> MimeType::set_parameter(String name, String value)
return {};
}
// https://mimesniff.spec.whatwg.org/#xml-mime-type
bool MimeType::is_xml() const
{
return m_subtype.ends_with_bytes("+xml"sv) || essence().is_one_of("text/xml"sv, "application/xml"sv);
}
// https://mimesniff.spec.whatwg.org/#html-mime-type
bool MimeType::is_html() const
{
return essence().is_one_of("text/html"sv);
}
// https://mimesniff.spec.whatwg.org/#javascript-mime-type
bool MimeType::is_javascript() const
{

View file

@ -25,6 +25,8 @@ public:
String const& subtype() const { return m_subtype; }
OrderedHashMap<String, String> const& parameters() const { return m_parameters; }
bool is_xml() const;
bool is_html() const;
bool is_javascript() const;
ErrorOr<void> set_parameter(String name, String value);