diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-09 01:06:01 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-09 02:30:53 +0200 |
commit | 33f67e4c0fe817fcc066f2779e19de11077fad7d (patch) | |
tree | f8384fe0cba011d02406c6eb3089ef4e0db2154c | |
parent | aa3ba629bad705b4b6616d94e60106fe05800b59 (diff) | |
download | serenity-33f67e4c0fe817fcc066f2779e19de11077fad7d.zip |
LibWeb: Use the task queue to fire "load" and "error" events on images
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 039e58f3e7..e34442cea5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -22,13 +22,17 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, QualifiedName qualif { m_image_loader.on_load = [this] { this->document().update_layout(); - dispatch_event(DOM::Event::create(EventNames::load)); + queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] { + dispatch_event(DOM::Event::create(EventNames::load)); + }); }; m_image_loader.on_fail = [this] { dbgln("HTMLImageElement: Resource did fail: {}", src()); this->document().update_layout(); - dispatch_event(DOM::Event::create(EventNames::error)); + queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] { + dispatch_event(DOM::Event::create(EventNames::error)); + }); }; m_image_loader.on_animate = [this] { |