mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
LibWeb: Remove redundant JS::Value() calls in XMLHttpRequest::response()
This commit is contained in:
parent
183462acfd
commit
58b0edef7d
Notes:
sideshowbarker
2024-07-17 07:38:17 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/58b0edef7d Pull-request: https://github.com/SerenityOS/serenity/pull/15474
1 changed files with 4 additions and 4 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue