mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-08 18:11:52 +00:00
LibWeb: Treat media query with an invalid media type as invalid
This commit is contained in:
parent
667cb01b60
commit
bf15b7ac12
Notes:
github-actions[bot]
2025-03-09 17:49:36 +00:00
Author: https://github.com/tcl3
Commit: bf15b7ac12
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3878
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 35 additions and 0 deletions
|
@ -112,6 +112,10 @@ NonnullRefPtr<MediaQuery> Parser::parse_media_query(TokenStream<ComponentValue>&
|
|||
|
||||
// `<media-type>`
|
||||
if (auto media_type = parse_media_type(tokens); media_type.has_value()) {
|
||||
// https://drafts.csswg.org/mediaqueries-4/#error-handling
|
||||
// An unknown <media-type> must be treated as not matching.
|
||||
if (media_type.value() == MediaQuery::MediaType::Unknown)
|
||||
return invalid_media_query();
|
||||
media_query->m_media_type = media_type.value();
|
||||
tokens.discard_whitespace();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue