diff options
author | Sam Atkins <atkinssj@gmail.com> | 2021-07-09 20:08:09 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-11 23:19:56 +0200 |
commit | 86994336a72db1f2c49baa40162730baa4599732 (patch) | |
tree | 6598f7fae785ccc22d9addc78b4645aef82559fb | |
parent | c249fbd17c1fad27d6532842b965e5ef658b8469 (diff) | |
download | serenity-86994336a72db1f2c49baa40162730baa4599732.zip |
LibWeb: Correct parsing invalid list of declarations
We were only discarding at most one token when a declaration is
invalid, when we should discard all until we see a ; or EOF.
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index d195cadf05..a222aab909 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -890,8 +890,10 @@ Vector<DeclarationOrAtRule> Parser::consume_a_list_of_declarations(TokenStream<T log_parse_error(); tokens.reconsume_current_input_token(); auto peek = tokens.peek_token(); - if (!(peek.is(Token::Type::Semicolon) || peek.is(Token::Type::EndOfFile))) { + while (!(peek.is(Token::Type::Semicolon) || peek.is(Token::Type::EndOfFile))) { + dbgln("Discarding token: '{}'", peek.to_debug_string()); (void)consume_a_component_value(tokens); + peek = tokens.peek_token(); } } |