瀏覽代碼

LibHTML: Decrement the pending loads counter when a load finishes

This ensures that the browser statusbar shows the correct number of
still pending resource loads.
Andreas Kling 5 年之前
父節點
當前提交
e691d16f1c
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      Libraries/LibHTML/ResourceLoader.cpp

+ 4 - 1
Libraries/LibHTML/ResourceLoader.cpp

@@ -37,7 +37,10 @@ void ResourceLoader::load(const URL& url, Function<void(const ByteBuffer&)> call
 
     if (url.protocol() == "http") {
         auto download = protocol_client().start_download(url.to_string());
-        download->on_finish = [callback = move(callback)](bool success, const ByteBuffer& payload, auto) {
+        download->on_finish = [this, callback = move(callback)](bool success, const ByteBuffer& payload, auto) {
+            --m_pending_loads;
+            if (on_load_counter_change)
+                on_load_counter_change();
             if (!success) {
                 dbg() << "HTTP load failed!";
                 ASSERT_NOT_REACHED();