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

LibWeb: Remove unnecessary WeakPtr creation in XMLHttpRequest::send()

This commit is contained in:
Andreas Kling 2021-09-19 14:59:02 +02:00
parent 57f3535c4a
commit 398a95c3c9

View file

@ -180,11 +180,8 @@ DOM::ExceptionOr<void> XMLHttpRequest::send()
if (should_enforce_same_origin_policy && !m_window->associated_document().origin().is_same(request_url_origin)) { if (should_enforce_same_origin_policy && !m_window->associated_document().origin().is_same(request_url_origin)) {
dbgln("XHR failed to load: Same-Origin Policy violation: {} may not load {}", m_window->associated_document().url(), request_url); dbgln("XHR failed to load: Same-Origin Policy violation: {} may not load {}", m_window->associated_document().url(), request_url);
auto weak_this = make_weak_ptr(); set_ready_state(ReadyState::Done);
if (!weak_this) dispatch_event(DOM::Event::create(HTML::EventNames::error));
return {};
const_cast<XMLHttpRequest&>(*weak_this).set_ready_state(ReadyState::Done);
const_cast<XMLHttpRequest&>(*weak_this).dispatch_event(DOM::Event::create(HTML::EventNames::error));
return {}; return {};
} }