mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +00: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
1 changed files with 3 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue