瀏覽代碼

LibWeb: Use correct Window object when dispatching Document load event

Andreas Kling 2 年之前
父節點
當前提交
dd9cd3050b
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Userland/Libraries/LibWeb/DOM/Document.cpp

+ 2 - 2
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -1410,8 +1410,8 @@ void Document::completely_finish_loading()
     }
     }
     // Otherwise, if container is non-null, then queue an element task on the DOM manipulation task source given container to fire an event named load at container.
     // Otherwise, if container is non-null, then queue an element task on the DOM manipulation task source given container to fire an event named load at container.
     else if (container) {
     else if (container) {
-        container->queue_an_element_task(HTML::Task::Source::DOMManipulation, [container, this]() mutable {
-            container->dispatch_event(*DOM::Event::create(window(), HTML::EventNames::load));
+        container->queue_an_element_task(HTML::Task::Source::DOMManipulation, [container]() mutable {
+            container->dispatch_event(*DOM::Event::create(container->window(), HTML::EventNames::load));
         });
         });
     }
     }
 }
 }