1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +00:00

LibWeb: Wire up XHR::ontimeout event

This commit is contained in:
Kenneth Myhra 2022-07-02 22:33:17 +02:00 committed by Linus Groh
parent 92a3803066
commit 445c3050d4

View file

@ -638,7 +638,14 @@ DOM::ExceptionOr<void> XMLHttpRequest::send(String body)
xhr.set_status(status_code.value_or(0));
xhr.dispatch_event(DOM::Event::create(HTML::EventNames::error));
},
m_timeout);
m_timeout,
[weak_this = make_weak_ptr()] {
auto strong_this = weak_this.strong_ref();
if (!strong_this)
return;
auto& xhr = const_cast<XMLHttpRequest&>(*strong_this);
xhr.dispatch_event(DOM::Event::create(EventNames::timeout));
});
} else {
TODO();
}