mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:57:35 +00:00
LibWeb/MimeSniff: Add MimeType::is_scriptable()
This commit is contained in:
parent
644cc1d7ee
commit
b110e4649e
2 changed files with 8 additions and 0 deletions
|
@ -306,6 +306,13 @@ bool MimeType::is_html() const
|
||||||
return essence().is_one_of("text/html"sv);
|
return essence().is_one_of("text/html"sv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://mimesniff.spec.whatwg.org/#scriptable-mime-type
|
||||||
|
bool MimeType::is_scriptable() const
|
||||||
|
{
|
||||||
|
// A scriptable MIME type is an XML MIME type, HTML MIME type, or any MIME type whose essence is "application/pdf".
|
||||||
|
return is_xml() || is_html() || essence() == "application/pdf"sv;
|
||||||
|
}
|
||||||
|
|
||||||
// https://mimesniff.spec.whatwg.org/#javascript-mime-type
|
// https://mimesniff.spec.whatwg.org/#javascript-mime-type
|
||||||
bool MimeType::is_javascript() const
|
bool MimeType::is_javascript() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
bool is_archive() const;
|
bool is_archive() const;
|
||||||
bool is_xml() const;
|
bool is_xml() const;
|
||||||
bool is_html() const;
|
bool is_html() const;
|
||||||
|
bool is_scriptable() const;
|
||||||
bool is_javascript() const;
|
bool is_javascript() const;
|
||||||
|
|
||||||
ErrorOr<void> set_parameter(String name, String value);
|
ErrorOr<void> set_parameter(String name, String value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue