diff options
author | Max Wipfli <mail@maxwipfli.ch> | 2021-07-15 01:25:34 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-15 01:47:22 +0200 |
commit | 2404ad689729902fd27fe37f8ecbab935a6394e5 (patch) | |
tree | b87c02e3e1d6564193f25f3dfb70a6749a9502ca /Userland/Libraries/LibWeb | |
parent | c82c652ee4bb66d940b278b5d7473e1ca07855d2 (diff) | |
download | serenity-2404ad689729902fd27fe37f8ecbab935a6394e5.zip |
LibWeb: Fix assertion failure when tokenizing JS regex literals
This fixes parsing the following regular expression: /</g;
It also adds a simple script element to the HTMLTokenizer regression
test, which also contains that specific regex.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp index 2736897a72..bb7e3a4590 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp @@ -2561,6 +2561,8 @@ _StartOfFunction: { m_queued_tokens.enqueue(HTMLToken::make_character('<')); m_queued_tokens.enqueue(HTMLToken::make_character('/')); + // NOTE: The spec doesn't mention this, but it seems that m_current_token (an end tag) is just dropped in this case. + m_current_builder.clear(); for (auto code_point : m_temporary_buffer) m_queued_tokens.enqueue(HTMLToken::make_character(code_point)); RECONSUME_IN(ScriptData); |