mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +00:00
LibWeb: Emit the current token before EOF on invalid comments
The spec for each of these state: -> EOF: This is an eof-in-comment parse error. Emit the current comment token. Emit an end-of-file token. We were neglecting to emit the current comment token before emitting an EOF token. Note the existing EMIT_CURRENT_TOKEN macro was unused.
This commit is contained in:
parent
775282f9fc
commit
feddecde5b
Notes:
sideshowbarker
2024-07-16 21:30:46 +09:00
Author: https://github.com/trflynn89
Commit: feddecde5b
Pull-request: https://github.com/SerenityOS/serenity/pull/23686
Issue: https://github.com/SerenityOS/serenity/issues/23683
1 changed files with 12 additions and 6 deletions
|
@ -137,11 +137,17 @@ namespace Web::HTML {
|
||||||
return m_queued_tokens.dequeue(); \
|
return m_queued_tokens.dequeue(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define EMIT_CURRENT_TOKEN \
|
#define EMIT_CURRENT_TOKEN_FOLLOWED_BY_EOF \
|
||||||
do { \
|
do { \
|
||||||
VERIFY(m_current_builder.is_empty()); \
|
VERIFY(m_current_builder.is_empty()); \
|
||||||
will_emit(m_current_token); \
|
will_emit(m_current_token); \
|
||||||
m_queued_tokens.enqueue(move(m_current_token)); \
|
m_queued_tokens.enqueue(move(m_current_token)); \
|
||||||
|
\
|
||||||
|
m_has_emitted_eof = true; \
|
||||||
|
create_new_token(HTMLToken::Type::EndOfFile); \
|
||||||
|
will_emit(m_current_token); \
|
||||||
|
m_queued_tokens.enqueue(move(m_current_token)); \
|
||||||
|
\
|
||||||
return m_queued_tokens.dequeue(); \
|
return m_queued_tokens.dequeue(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -1428,7 +1434,7 @@ _StartOfFunction:
|
||||||
ON_EOF
|
ON_EOF
|
||||||
{
|
{
|
||||||
log_parse_error();
|
log_parse_error();
|
||||||
EMIT_EOF;
|
EMIT_CURRENT_TOKEN_FOLLOWED_BY_EOF;
|
||||||
}
|
}
|
||||||
ANYTHING_ELSE
|
ANYTHING_ELSE
|
||||||
{
|
{
|
||||||
|
@ -1460,7 +1466,7 @@ _StartOfFunction:
|
||||||
{
|
{
|
||||||
log_parse_error();
|
log_parse_error();
|
||||||
m_current_token.set_comment(consume_current_builder());
|
m_current_token.set_comment(consume_current_builder());
|
||||||
EMIT_EOF;
|
EMIT_CURRENT_TOKEN_FOLLOWED_BY_EOF;
|
||||||
}
|
}
|
||||||
ANYTHING_ELSE
|
ANYTHING_ELSE
|
||||||
{
|
{
|
||||||
|
@ -1491,7 +1497,7 @@ _StartOfFunction:
|
||||||
{
|
{
|
||||||
log_parse_error();
|
log_parse_error();
|
||||||
m_current_token.set_comment(consume_current_builder());
|
m_current_token.set_comment(consume_current_builder());
|
||||||
EMIT_EOF;
|
EMIT_CURRENT_TOKEN_FOLLOWED_BY_EOF;
|
||||||
}
|
}
|
||||||
ANYTHING_ELSE
|
ANYTHING_ELSE
|
||||||
{
|
{
|
||||||
|
@ -1519,7 +1525,7 @@ _StartOfFunction:
|
||||||
{
|
{
|
||||||
log_parse_error();
|
log_parse_error();
|
||||||
m_current_token.set_comment(consume_current_builder());
|
m_current_token.set_comment(consume_current_builder());
|
||||||
EMIT_EOF;
|
EMIT_CURRENT_TOKEN_FOLLOWED_BY_EOF;
|
||||||
}
|
}
|
||||||
ANYTHING_ELSE
|
ANYTHING_ELSE
|
||||||
{
|
{
|
||||||
|
@ -1540,7 +1546,7 @@ _StartOfFunction:
|
||||||
{
|
{
|
||||||
log_parse_error();
|
log_parse_error();
|
||||||
m_current_token.set_comment(consume_current_builder());
|
m_current_token.set_comment(consume_current_builder());
|
||||||
EMIT_EOF;
|
EMIT_CURRENT_TOKEN_FOLLOWED_BY_EOF;
|
||||||
}
|
}
|
||||||
ANYTHING_ELSE
|
ANYTHING_ELSE
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue