From 42e76d8de9e172226661e6bdca3fa5a00a8370d4 Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Thu, 14 Jul 2022 19:56:25 +0200 Subject: [PATCH] LibWeb: Rename safely_extract_body() to extract_body() We have not yet implemented safely_extract_body so renaming this to extract_body() and adding a spec link. --- Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 9ff16aa4e7..c8b78821dc 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -310,7 +310,8 @@ Optional XMLHttpRequest::extract_mime_type(Fetch::HeaderLis return mime_type; } -static XMLHttpRequest::BodyWithType safely_extract_body(XMLHttpRequestBodyInit& body) +// https://fetch.spec.whatwg.org/#concept-bodyinit-extract +static XMLHttpRequest::BodyWithType extract_body(XMLHttpRequestBodyInit& body) { if (body.has>()) { return { @@ -464,7 +465,7 @@ DOM::ExceptionOr XMLHttpRequest::send(Optional bod if (m_method.is_one_of("GET"sv, "HEAD"sv)) body = {}; - auto body_with_type = body.has_value() ? safely_extract_body(body.value()) : XMLHttpRequest::BodyWithType {}; + auto body_with_type = body.has_value() ? extract_body(body.value()) : XMLHttpRequest::BodyWithType {}; AK::URL request_url = m_window->associated_document().parse_url(m_url.to_string()); dbgln("XHR send from {} to {}", m_window->associated_document().url(), request_url);