LibWeb: Make javascript mime matching spec compliant

When mime essence matching, the spec only asks for a string comparison
ignoring ascii case. The whitespace trimming and parsing of the mime
produces unexpected and wrong results.
Fixes tests on WPT html/semantics/scripting-1/the-script-element :^)
This commit is contained in:
Hermes Junior 2024-10-29 23:59:32 +01:00 committed by Tim Ledbetter
parent 437879f849
commit cdd78be2d3
Notes: github-actions[bot] 2024-11-01 22:51:58 +00:00
3 changed files with 28 additions and 40 deletions

View file

@ -217,7 +217,7 @@ void HTMLScriptElement::prepare_script()
}
// 9. If the script block's type string is a JavaScript MIME type essence match,
if (MimeSniff::is_javascript_mime_type_essence_match(MUST(script_block_type.trim(Infra::ASCII_WHITESPACE)))) {
if (MimeSniff::is_javascript_mime_type_essence_match(script_block_type)) {
// then set el's type to "classic".
m_script_type = ScriptType::Classic;
}