Prechádzať zdrojové kódy

LibWeb: Remove redundant JS::Value() calls in XMLHttpRequest::response()

Linus Groh 2 rokov pred
rodič
commit
58b0edef7d

+ 4 - 4
Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp

@@ -103,10 +103,10 @@ WebIDL::ExceptionOr<JS::Value> XMLHttpRequest::response()
     if (m_response_type == Bindings::XMLHttpRequestResponseType::Empty || m_response_type == Bindings::XMLHttpRequestResponseType::Text) {
         // 1. If this’s state is not loading or done, then return the empty string.
         if (m_ready_state != ReadyState::Loading && m_ready_state != ReadyState::Done)
-            return JS::Value(JS::js_string(vm, ""));
+            return JS::js_string(vm, "");
 
         // 2. Return the result of getting a text response for this.
-        return JS::Value(JS::js_string(vm, get_text_response()));
+        return JS::js_string(vm, get_text_response());
     }
     // 2. If this’s state is not done, then return null.
     if (m_ready_state != ReadyState::Done)
@@ -152,12 +152,12 @@ WebIDL::ExceptionOr<JS::Value> XMLHttpRequest::response()
         // 2. If this’s response’s body is null, then return null.
         // FIXME: Implement this once we have 'Response'.
         if (m_received_bytes.is_empty())
-            return JS::Value(JS::js_null());
+            return JS::js_null();
 
         // 3. Let jsonObject be the result of running parse JSON from bytes on this’s received bytes. If that threw an exception, then return null.
         auto json_object_result = Infra::parse_json_bytes_to_javascript_value(vm, m_received_bytes);
         if (json_object_result.is_error())
-            return JS::Value(JS::js_null());
+            return JS::js_null();
 
         // 4. Set this’s response object to jsonObject.
         m_response_object = json_object_result.release_value();