mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 05:10:57 +00:00 
			
		
		
		
	LibWeb: Correct behavior of Comment* states in HTMLTokenizer
Previously, this would lead to assertion failures when parsing HTML comments. This fixes #8757.
This commit is contained in:
		
							parent
							
								
									af0b483123
								
							
						
					
					
						commit
						bb2aed7d76
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-18 09:00:55 +09:00 
				
			
			Author: https://github.com/MaxWipfli
Commit: bb2aed7d76
Pull-request: https://github.com/SerenityOS/serenity/pull/8759
Issue: https://github.com/SerenityOS/serenity/issues/8757
			
					 1 changed files with 15 additions and 11 deletions
				
			
		|  | @ -1351,18 +1351,17 @@ _StartOfFunction: | |||
|             { | ||||
|                 ON('-') | ||||
|                 { | ||||
|                     SWITCH_TO_WITH_UNCLEAN_BUILDER(CommentEnd); | ||||
|                     SWITCH_TO(CommentEnd); | ||||
|                 } | ||||
|                 ON('>') | ||||
|                 { | ||||
|                     log_parse_error(); | ||||
|                     consume_current_builder(); | ||||
|                     SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data); | ||||
|                 } | ||||
|                 ON_EOF | ||||
|                 { | ||||
|                     log_parse_error(); | ||||
|                     m_queued_tokens.enqueue(move(m_current_token)); | ||||
|                     EMIT_CURRENT_TOKEN; | ||||
|                     EMIT_EOF; | ||||
|                 } | ||||
|                 ANYTHING_ELSE | ||||
|  | @ -1393,7 +1392,8 @@ _StartOfFunction: | |||
|                 ON_EOF | ||||
|                 { | ||||
|                     log_parse_error(); | ||||
|                     m_queued_tokens.enqueue(move(m_current_token)); | ||||
|                     m_current_token.m_comment_or_character.data = consume_current_builder(); | ||||
|                     EMIT_CURRENT_TOKEN; | ||||
|                     EMIT_EOF; | ||||
|                 } | ||||
|                 ANYTHING_ELSE | ||||
|  | @ -1413,7 +1413,7 @@ _StartOfFunction: | |||
|                 } | ||||
|                 ON('!') | ||||
|                 { | ||||
|                     SWITCH_TO(CommentEndBang); | ||||
|                     SWITCH_TO_WITH_UNCLEAN_BUILDER(CommentEndBang); | ||||
|                 } | ||||
|                 ON('-') | ||||
|                 { | ||||
|  | @ -1423,7 +1423,8 @@ _StartOfFunction: | |||
|                 ON_EOF | ||||
|                 { | ||||
|                     log_parse_error(); | ||||
|                     m_queued_tokens.enqueue(move(m_current_token)); | ||||
|                     m_current_token.m_comment_or_character.data = consume_current_builder(); | ||||
|                     EMIT_CURRENT_TOKEN; | ||||
|                     EMIT_EOF; | ||||
|                 } | ||||
|                 ANYTHING_ELSE | ||||
|  | @ -1439,17 +1440,19 @@ _StartOfFunction: | |||
|                 ON('-') | ||||
|                 { | ||||
|                     m_current_builder.append("--!"); | ||||
|                     SWITCH_TO(CommentEndDash); | ||||
|                     SWITCH_TO_WITH_UNCLEAN_BUILDER(CommentEndDash); | ||||
|                 } | ||||
|                 ON('>') | ||||
|                 { | ||||
|                     log_parse_error(); | ||||
|                     m_current_token.m_comment_or_character.data = consume_current_builder(); | ||||
|                     SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data); | ||||
|                 } | ||||
|                 ON_EOF | ||||
|                 { | ||||
|                     log_parse_error(); | ||||
|                     m_queued_tokens.enqueue(move(m_current_token)); | ||||
|                     m_current_token.m_comment_or_character.data = consume_current_builder(); | ||||
|                     EMIT_CURRENT_TOKEN; | ||||
|                     EMIT_EOF; | ||||
|                 } | ||||
|                 ANYTHING_ELSE | ||||
|  | @ -1469,7 +1472,8 @@ _StartOfFunction: | |||
|                 ON_EOF | ||||
|                 { | ||||
|                     log_parse_error(); | ||||
|                     m_queued_tokens.enqueue(move(m_current_token)); | ||||
|                     m_current_token.m_comment_or_character.data = consume_current_builder(); | ||||
|                     EMIT_CURRENT_TOKEN; | ||||
|                     EMIT_EOF; | ||||
|                 } | ||||
|                 ANYTHING_ELSE | ||||
|  | @ -1503,7 +1507,7 @@ _StartOfFunction: | |||
|             { | ||||
|                 ON('-') | ||||
|                 { | ||||
|                     SWITCH_TO(CommentLessThanSignBangDash); | ||||
|                     SWITCH_TO_WITH_UNCLEAN_BUILDER(CommentLessThanSignBangDash); | ||||
|                 } | ||||
|                 ANYTHING_ELSE | ||||
|                 { | ||||
|  | @ -1516,7 +1520,7 @@ _StartOfFunction: | |||
|             { | ||||
|                 ON('-') | ||||
|                 { | ||||
|                     SWITCH_TO(CommentLessThanSignBangDashDash); | ||||
|                     SWITCH_TO_WITH_UNCLEAN_BUILDER(CommentLessThanSignBangDashDash); | ||||
|                 } | ||||
|                 ANYTHING_ELSE | ||||
|                 { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Max Wipfli
						Max Wipfli