From ddec4cd7f2237da0df4a85eb9cd7c96981b6fa74 Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Thu, 23 Mar 2023 18:37:21 +0000 Subject: LibWeb: Create the correct error objects in XHR::handle_errors Aborts and network errors were accidentally creating TimeoutError exceptions instead of AbortError and NetworkError respectively. --- Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 35d3f335ea..8015d7c14d 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -1112,11 +1112,11 @@ WebIDL::ExceptionOr XMLHttpRequest::handle_errors() // 3. Otherwise, if xhr’s response’s aborted flag is set, run the request error steps for xhr, abort, and "AbortError" DOMException. if (m_response->aborted()) - return TRY(request_error_steps(EventNames::abort, WebIDL::TimeoutError::create(realm(), "Aborted"sv))); + return TRY(request_error_steps(EventNames::abort, WebIDL::AbortError::create(realm(), "Aborted"sv))); // 4. Otherwise, if xhr’s response is a network error, then run the request error steps for xhr, error, and "NetworkError" DOMException. if (m_response->is_network_error()) - return TRY(request_error_steps(EventNames::error, WebIDL::TimeoutError::create(realm(), "Network error"sv))); + return TRY(request_error_steps(EventNames::error, WebIDL::NetworkError::create(realm(), "Network error"sv))); return {}; } -- cgit v1.2.3