LibWeb: Bring up basic external script execution in the new parser

This only works in some narrow cases, but should be enough for our own
welcome.html at least. :^)
This commit is contained in:
Andreas Kling 2020-05-27 23:01:04 +02:00
parent 2cb50f6750
commit 4c9c6b3a7b
Notes: sideshowbarker 2024-07-19 06:03:49 +09:00
7 changed files with 60 additions and 3 deletions

View file

@ -704,8 +704,48 @@ void HTMLDocumentParser::handle_text(HTMLToken& token)
if (script_nesting_level() == 0)
m_parser_pause_flag = false;
// FIXME: Handle tokenizer insertion point stuff here too.
while (document().pending_parsing_blocking_script()) {
if (script_nesting_level() != 0) {
m_parser_pause_flag = true;
// FIXME: Abort the processing of any nested invocations of the tokenizer,
// yielding control back to the caller. (Tokenization will resume when
// the caller returns to the "outer" tree construction stage.)
TODO();
} else {
auto the_script = document().take_pending_parsing_blocking_script({});
m_tokenizer.set_blocked(true);
// FIXME: If the parser's Document has a style sheet that is blocking scripts
// or the script's "ready to be parser-executed" flag is not set:
// spin the event loop until the parser's Document has no style sheet
// that is blocking scripts and the script's "ready to be parser-executed"
// flag is set.
ASSERT(the_script->is_ready_to_be_parser_executed());
if (m_aborted)
return;
m_tokenizer.set_blocked(false);
// FIXME: Handle tokenizer insertion point stuff here too.
ASSERT(script_nesting_level() == 0);
increment_script_nesting_level();
the_script->execute_script();
decrement_script_nesting_level();
ASSERT(script_nesting_level() == 0);
m_parser_pause_flag = false;
// FIXME: Handle tokenizer insertion point stuff here too.
}
}
return;
}
if (token.is_end_tag()) {
m_stack_of_open_elements.pop();
m_insertion_mode = m_original_insertion_mode;