Pārlūkot izejas kodu

LibWeb: Don't delay document "load" event for non-loading link elements

If we try loading a link element but it's reject for whatever reason
(broken URL, content filtering, etc.) make sure we don't mark that link
element as delaying the document load event.
Andreas Kling 3 gadi atpakaļ
vecāks
revīzija
ceb055a75e
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. 4 0
      Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp

+ 4 - 0
Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp

@@ -35,6 +35,10 @@ void HTMLLinkElement::inserted()
         //       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));
+
+        // NOTE: If we ended up not loading a resource for whatever reason, don't delay the load event.
+        if (!resource())
+            m_document_load_event_delayer.clear();
     }
 
     if (m_relationship & Relationship::Preload) {