LibWeb: Always flush character insertions before exiting HTML parser
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

This fixes an issue where document.write() with only text input would
leave all the character data as unflushed text in the parser.

This fixes many of the WPT tests for document.write().
This commit is contained in:
Andreas Kling 2024-09-21 09:24:09 +02:00 committed by Andreas Kling
parent 089139f09d
commit a0ed12e839
Notes: github-actions[bot] 2024-09-21 13:51:07 +00:00
3 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,6 @@
<script src="../include.js"></script>
<script>
test(() => {
document.write("PASS");
});
</script>

View file

@ -177,7 +177,7 @@ void HTMLParser::run(HTMLTokenizer::StopAtInsertionPoint stop_at_insertion_point
for (;;) { for (;;) {
// FIXME: Find a better way to say that we come from Document::close() and want to process EOF. // FIXME: Find a better way to say that we come from Document::close() and want to process EOF.
if (!m_tokenizer.is_eof_inserted() && m_tokenizer.is_insertion_point_reached()) if (!m_tokenizer.is_eof_inserted() && m_tokenizer.is_insertion_point_reached())
return; break;
auto optional_token = m_tokenizer.next_token(stop_at_insertion_point); auto optional_token = m_tokenizer.next_token(stop_at_insertion_point);
if (!optional_token.has_value()) if (!optional_token.has_value())