mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibWeb: Don't delay document load event forever with cached style sheets
If we try to <link> a stylesheet that was already cached, we'll get a synchronous resource_did_load() callback. Because of this, it's necessary to set up the document load event delayer *before* calling set_resource(), as otherwise we'd be stuck without a load event forever.
This commit is contained in:
parent
9f02afd8fe
commit
32b8023ad1
Notes:
sideshowbarker
2024-07-17 18:45:51 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/32b8023ad1
@ -33,8 +33,10 @@ void HTMLLinkElement::inserted()
|
||||
auto url = document().parse_url(href());
|
||||
dbgln_if(CSS_LOADER_DEBUG, "HTMLLinkElement: Loading import URL: {}", url);
|
||||
auto request = LoadRequest::create_for_url_on_page(url, document().page());
|
||||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
||||
// NOTE: Mark this element as delaying the document load event *before* calling set_resource()
|
||||
// as it may trigger a synchronous resource_did_load() callback.
|
||||
m_document_load_event_delayer.emplace(document());
|
||||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
||||
}
|
||||
|
||||
if (m_relationship & Relationship::Preload) {
|
||||
|
Loading…
Reference in New Issue
Block a user