1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

LibWeb: Run on_load_start/finish callbacks when loading HTML directly

I need this for the upcoming "load-reference-page" debug request. But it
generally seems like the correct thing to do. :^)
This commit is contained in:
Sam Atkins 2023-09-12 16:32:43 +01:00 committed by Andreas Kling
parent cb8c4cd2e6
commit 7ba686dcb3

View file

@ -146,6 +146,9 @@ bool FrameLoader::load(const AK::URL& url, Type type)
void FrameLoader::load_html(StringView html, const AK::URL& url)
{
if (auto* page = browsing_context().page())
page->client().page_did_start_loading(url, false);
auto& vm = Bindings::main_thread_vm();
auto response = Fetch::Infrastructure::Response::create(vm);
response->url_list().append(url);
@ -167,6 +170,9 @@ void FrameLoader::load_html(StringView html, const AK::URL& url)
auto parser = HTML::HTMLParser::create(document, html, "utf-8");
parser->run(url);
if (auto* page = browsing_context().page())
page->client().page_did_finish_loading(url);
}
static DeprecatedString s_resource_directory_url = "file:///res";