LibWeb: Make HTML tokenizer stop at insertion point after state switch

If we reach the insertion point at the same time as we switch to another
tokenizer state, we have to bail immediately without proceeding with the
next code point. Otherwise we'd fetch the next token, get an EOF marker,
and then proceed as if we're at the end of the input stream, even though
more data may be coming (with more calls to document.write()..)
This commit is contained in:
Andreas Kling 2024-11-23 18:30:01 +01:00 committed by Andreas Kling
commit 69367194a6
Notes: github-actions[bot] 2024-11-23 18:20:21 +00:00
18 changed files with 44 additions and 42 deletions

View file

@ -34,6 +34,8 @@ namespace Web::HTML {
do { \ do { \
will_switch_to(State::new_state); \ will_switch_to(State::new_state); \
m_state = State::new_state; \ m_state = State::new_state; \
if (stop_at_insertion_point == StopAtInsertionPoint::Yes && is_insertion_point_reached()) \
return {}; \
CONSUME_NEXT_INPUT_CHARACTER; \ CONSUME_NEXT_INPUT_CHARACTER; \
goto new_state; \ goto new_state; \
} while (0) } while (0)

View file

@ -6,9 +6,9 @@ Rerun
Found 3 tests Found 3 tests
1 Pass 2 Pass
2 Fail 1 Fail
Details Details
Result Test Name MessageFail Check number of divs Result Test Name MessagePass Check number of divs
Pass Check div structure: network Pass Check div structure: network
Fail Check div structure: document.write Cannot access property "childNodes" on undefined object "div" Fail Check div structure: document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Cannot access property "firstChild" on null object "document.body" Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Cannot access property "childNodes" on null object "document.body" Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write Result Test Name MessagePass document.write

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write plaintext Result Test Name MessagePass document.write plaintext

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write into iframe Result Test Name MessagePass document.write into iframe

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write plaintext into iframe Result Test Name MessagePass document.write plaintext into iframe

View file

@ -6,6 +6,6 @@ Rerun
Found 1 tests Found 1 tests
1 Fail 1 Pass
Details Details
Result Test Name MessageFail document.write plaintext into iframe Result Test Name MessagePass document.write plaintext into iframe