瀏覽代碼

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

Linus Groh 2 年之前
父節點
當前提交
58b0edef7d
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp

+ 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) {
     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.
         // 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)
         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.
         // 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.
     // 2. If this’s state is not done, then return null.
     if (m_ready_state != ReadyState::Done)
     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.
         // 2. If this’s response’s body is null, then return null.
         // FIXME: Implement this once we have 'Response'.
         // FIXME: Implement this once we have 'Response'.
         if (m_received_bytes.is_empty())
         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.
         // 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);
         auto json_object_result = Infra::parse_json_bytes_to_javascript_value(vm, m_received_bytes);
         if (json_object_result.is_error())
         if (json_object_result.is_error())
-            return JS::Value(JS::js_null());
+            return JS::js_null();
 
 
         // 4. Set this’s response object to jsonObject.
         // 4. Set this’s response object to jsonObject.
         m_response_object = json_object_result.release_value();
         m_response_object = json_object_result.release_value();