From 832bb978f558ab23a65c24f451645e7dac722a50 Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Thu, 1 May 2025 13:04:32 +0200 Subject: [PATCH] LibWeb: Reject CSS values with unprocessed tokens / extra semicolons --- Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp | 2 +- .../expected/wpt-import/css/geometry/DOMMatrix-001.txt | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp index 708d990a7fa..ee26b884b35 100644 --- a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp @@ -370,7 +370,7 @@ Parser::ParseErrorOr> Parser::parse_css_value if (token.is(Token::Type::Semicolon)) { unprocessed_tokens.reconsume_current_input_token(); - break; + return ParseError::SyntaxError; } if (property_id != PropertyID::Custom) { diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/geometry/DOMMatrix-001.txt b/Tests/LibWeb/Text/expected/wpt-import/css/geometry/DOMMatrix-001.txt index 3d283fc30c9..92ed988c994 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/geometry/DOMMatrix-001.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/geometry/DOMMatrix-001.txt @@ -2,8 +2,7 @@ Harness status: OK Found 126 tests -124 Pass -2 Fail +126 Pass Pass new DOMMatrix() Pass new DOMMatrix(undefined) Pass new DOMMatrix(new DOMMatrix()) @@ -53,7 +52,7 @@ Pass new DOMMatrix(" ") Pass new DOMMatrix("/**/") Pass new DOMMatrix("\0") Pass new DOMMatrix(";") -Fail new DOMMatrix("none;") +Pass new DOMMatrix("none;") Pass new DOMMatrix("null") Pass new DOMMatrix(null) Pass new DOMMatrix("undefined") @@ -116,7 +115,7 @@ Pass new DOMMatrixReadOnly(" ") Pass new DOMMatrixReadOnly("/**/") Pass new DOMMatrixReadOnly("\0") Pass new DOMMatrixReadOnly(";") -Fail new DOMMatrixReadOnly("none;") +Pass new DOMMatrixReadOnly("none;") Pass new DOMMatrixReadOnly("null") Pass new DOMMatrixReadOnly(null) Pass new DOMMatrixReadOnly("undefined")