Commit 29237193 authored by Benjamin Otte's avatar Benjamin Otte

css: Handle invalid :not() selectors

We weren't correctly ending the ( ) block when encountering an error.

Testcases added.

Fixes #2281
parent 564e8f48
......@@ -1396,6 +1396,7 @@ gtk_css_selector_parse_selector_pseudo_class (GtkCssParser *parser,
else
{
gtk_css_parser_error_syntax (parser, "Invalid contents of :not() selector");
gtk_css_parser_end_block (parser);
if (selector)
_gtk_css_selector_free (selector);
selector = NULL;
......@@ -1406,6 +1407,7 @@ gtk_css_selector_parse_selector_pseudo_class (GtkCssParser *parser,
if (!gtk_css_token_is (token, GTK_CSS_TOKEN_EOF))
{
gtk_css_parser_error_syntax (parser, "Invalid contents of :not() selector");
gtk_css_parser_end_block (parser);
if (selector)
_gtk_css_selector_free (selector);
selector = NULL;
......
......@@ -369,6 +369,9 @@ test_data = [
'no-semicolon.ref.css',
'not.css',
'not.ref.css',
'not-unclosed.css',
'not-unclosed.errors',
'not-unclosed.ref.css',
'nth-child.css',
'nth-child.ref.css',
'opacity.css',
......
:not(valid invalid) {}
:not(
not-unclosed.css:1:12-19: error: GTK_CSS_PARSER_ERROR_SYNTAX
not-unclosed.css:4:1: error: GTK_CSS_PARSER_ERROR_SYNTAX
not-unclosed.css:3:2-4:1: error: GTK_CSS_PARSER_WARNING_SYNTAX
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment