summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-19 14:59:02 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-19 14:59:02 +0200
commit398a95c3c9e8e8de98857f3ea16bd13cf376d8cb (patch)
tree065504b79d466d750a3dca5bd35706762f0de58f /Userland
parent57f3535c4a47ed155ab7fbe59880988a51b01414 (diff)
downloadserenity-398a95c3c9e8e8de98857f3ea16bd13cf376d8cb.zip
LibWeb: Remove unnecessary WeakPtr creation in XMLHttpRequest::send()
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
index 172aaa8d00..0cc462d59b 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
@@ -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)) {
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();
- if (!weak_this)
- return {};
- const_cast<XMLHttpRequest&>(*weak_this).set_ready_state(ReadyState::Done);
- const_cast<XMLHttpRequest&>(*weak_this).dispatch_event(DOM::Event::create(HTML::EventNames::error));
+ set_ready_state(ReadyState::Done);
+ dispatch_event(DOM::Event::create(HTML::EventNames::error));
return {};
}