mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 11:06:10 +00:00
LibWeb: Change load_html_document to run parsing from deferred_invoke()
...callback, otherwise Networking task source will be blocked until the end of HTML parsing. This is a preparation before forbidding to interleave HTML tasks with the same source.
This commit is contained in:
parent
2bd767909c
commit
ba633882bf
Notes:
sideshowbarker
2024-07-17 18:46:57 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: ba633882bf
Pull-request: https://github.com/SerenityOS/serenity/pull/23903
1 changed files with 5 additions and 2 deletions
|
@ -21,6 +21,7 @@
|
|||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
#include <LibWeb/Loader/GeneratedPagesLoader.h>
|
||||
#include <LibWeb/Namespace.h>
|
||||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||
#include <LibWeb/XML/XMLDocumentBuilder.h>
|
||||
|
||||
namespace Web {
|
||||
|
@ -149,8 +150,10 @@ static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOM::Document>> load_html_document(H
|
|||
else {
|
||||
// FIXME: Parse as we receive the document data, instead of waiting for the whole document to be fetched first.
|
||||
auto process_body = [document, url = navigation_params.response->url().value()](ByteBuffer data) {
|
||||
auto parser = HTML::HTMLParser::create_with_uncertain_encoding(document, data);
|
||||
parser->run(url);
|
||||
Platform::EventLoopPlugin::the().deferred_invoke([document = document, data = move(data), url = url] {
|
||||
auto parser = HTML::HTMLParser::create_with_uncertain_encoding(document, data);
|
||||
parser->run(url);
|
||||
});
|
||||
};
|
||||
|
||||
auto process_body_error = [](auto) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue