mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-06 19:22:53 +00:00
LibWeb: Handle two kinds of deferred script executions
This patch adds two script lists to Document: - Scripts to execute when parsing has finished - Scripts to execute as soon as possible Since we don't actually load scripts asynchronously yet (we just do a synchronous load when parsing the <script> element for simplicity), these are already loaded by the time we get to "The end" of parsing.
This commit is contained in:
parent
6f85422e8a
commit
e82226f3fb
Notes:
sideshowbarker
2024-07-19 05:57:26 +09:00
Author: https://github.com/awesomekling
Commit: e82226f3fb
4 changed files with 41 additions and 6 deletions
|
@ -80,7 +80,17 @@ void HTMLDocumentParser::run(const URL& url)
|
|||
|
||||
// "The end"
|
||||
|
||||
auto scripts_to_execute_when_parsing_has_finished = m_document->take_scripts_to_execute_when_parsing_has_finished({});
|
||||
for (auto& script : scripts_to_execute_when_parsing_has_finished) {
|
||||
script.execute_script();
|
||||
}
|
||||
|
||||
m_document->dispatch_event(Event::create("DOMContentLoaded"));
|
||||
|
||||
auto scripts_to_execute_as_soon_as_possible = m_document->take_scripts_to_execute_as_soon_as_possible({});
|
||||
for (auto& script : scripts_to_execute_as_soon_as_possible) {
|
||||
script.execute_script();
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLDocumentParser::process_using_the_rules_for(InsertionMode mode, HTMLToken& token)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue