From d7036daa89b24524cd34f69626376a9a7775cd68 Mon Sep 17 00:00:00 2001 From: Callum Law Date: Sat, 21 Jun 2025 00:46:06 +1200 Subject: [PATCH] LibWeb: Disallow trailing tokens in @supports() --- Libraries/LibWeb/CSS/Parser/Parser.cpp | 2 +- .../css/css-conditional/at-supports-038.html | 14 +++++++ .../css/css-conditional/at-supports-039.html | 14 +++++++ .../css/css-conditional/at-supports-038.html | 42 +++++++++++++++++++ .../css/css-conditional/at-supports-039.html | 42 +++++++++++++++++++ 5 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 Tests/LibWeb/Ref/expected/wpt-import/css/css-conditional/at-supports-038.html create mode 100644 Tests/LibWeb/Ref/expected/wpt-import/css/css-conditional/at-supports-039.html create mode 100644 Tests/LibWeb/Ref/input/wpt-import/css/css-conditional/at-supports-038.html create mode 100644 Tests/LibWeb/Ref/input/wpt-import/css/css-conditional/at-supports-039.html diff --git a/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Libraries/LibWeb/CSS/Parser/Parser.cpp index cf1e4e8593b..f5a29c88aa8 100644 --- a/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -291,7 +291,7 @@ OwnPtr Parser::parse_supports_feature(TokenStreamto_string(), diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-conditional/at-supports-038.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-conditional/at-supports-038.html new file mode 100644 index 00000000000..8ff3f2fccf5 --- /dev/null +++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-conditional/at-supports-038.html @@ -0,0 +1,14 @@ + + + +

+ Test passes if there is a filled green square and no red. +

+
+ diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-conditional/at-supports-039.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-conditional/at-supports-039.html new file mode 100644 index 00000000000..8ff3f2fccf5 --- /dev/null +++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-conditional/at-supports-039.html @@ -0,0 +1,14 @@ + + + +

+ Test passes if there is a filled green square and no red. +

+
+ diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-conditional/at-supports-038.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-conditional/at-supports-038.html new file mode 100644 index 00000000000..32b9a6f8a91 --- /dev/null +++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-conditional/at-supports-038.html @@ -0,0 +1,42 @@ + + + + + CSS Test (Conditional Rules): a supports condition declaration can not end with a semi-colon + + + + + + + + + + + + + +

Test passes if there is a filled green square and no red.

+ +
+ + + diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-conditional/at-supports-039.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-conditional/at-supports-039.html new file mode 100644 index 00000000000..c8f55a9b48b --- /dev/null +++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-conditional/at-supports-039.html @@ -0,0 +1,42 @@ + + + + + CSS Test (Conditional Rules): a supports condition declaration can not end with a semi-colon + + + + + + + + + + + + + +

Test passes if there is a filled green square and no red.

+ +
+ + +