mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 11:24:58 +00:00
LibWeb: Implement aborting the HTML parser
This is roughly on-spec, although I had to invent a simple "aborted" state for the tokenizer.
This commit is contained in:
parent
37ed1b28fa
commit
ab8432783e
4 changed files with 33 additions and 0 deletions
|
@ -3751,4 +3751,25 @@ JS::Realm& HTMLParser::realm()
|
|||
return m_document->realm();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#abort-a-parser
|
||||
void HTMLParser::abort()
|
||||
{
|
||||
// 1. Throw away any pending content in the input stream, and discard any future content that would have been added to it.
|
||||
m_tokenizer.abort();
|
||||
|
||||
// FIXME: 2. Stop the speculative HTML parser for this HTML parser.
|
||||
|
||||
// 3. Update the current document readiness to "interactive".
|
||||
m_document->update_readiness(DocumentReadyState::Interactive);
|
||||
|
||||
// 4. Pop all the nodes off the stack of open elements.
|
||||
while (!m_stack_of_open_elements.is_empty())
|
||||
m_stack_of_open_elements.pop();
|
||||
|
||||
// 5. Update the current document readiness to "complete".
|
||||
m_document->update_readiness(DocumentReadyState::Complete);
|
||||
|
||||
m_aborted = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue